Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const CannedResponsesRoute: FC = () => {
firstMessage: string;
};

type Scope = 'global' | 'department' | 'user';

const { values, handlers } = useForm({
sharing: '',
createdBy: '',
Expand Down Expand Up @@ -83,6 +85,15 @@ const CannedResponsesRoute: FC = () => {
}),
);

const defaultOptions = useMemo(
() => ({
global: t('Public'),
department: t('Department'),
user: t('Private'),
}),
[t],
);

const { value: data, reload } = useEndpointData('canned-responses', query);
const {
value: totalData,
Expand Down Expand Up @@ -158,7 +169,7 @@ const CannedResponsesRoute: FC = () => {
qa-user-id={_id}
>
<Table.Cell withTruncatedText>{shortcut}</Table.Cell>
<Table.Cell withTruncatedText>{scope}</Table.Cell>
<Table.Cell withTruncatedText>{defaultOptions[scope as Scope]}</Table.Cell>
<Table.Cell withTruncatedText>
<Box display='flex' alignItems='center'>
<UserAvatar size='x24' username={createdBy.username} />
Expand All @@ -176,7 +187,7 @@ const CannedResponsesRoute: FC = () => {
<RemoveCannedResponseButton _id={_id} reload={reload} totalDataReload={totalDataReload} />
</Table.Row>
),
[getTime, onRowClick, reload, totalDataReload],
[getTime, onRowClick, reload, totalDataReload, defaultOptions],
);

if (context === 'edit' && id) {
Expand Down