From 561ee1b7608749db9ce075c9931435eb58d345dd Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Tue, 21 Jan 2025 02:40:46 +0530 Subject: [PATCH] fix: Full screen editor - fix: z-index of command box when full screen editor is open. - fix: templates form - rename route meta - updates default status constants. --- frontend/src/assets/styles/main.scss | 2 +- .../{AddEditOIDC.vue => CreateEditOIDC.vue} | 0 ...ditTemplate.vue => CreateEditTemplate.vue} | 30 ++++-- .../admin/templates/TemplateForm.vue | 42 ++++---- .../components/admin/templates/Templates.vue | 79 ++++++++------- .../admin/templates/dataTableDropdown.vue | 6 +- .../components/admin/templates/formSchema.js | 2 +- .../src/components/command/CommandBox.vue | 33 +++---- .../conversation/ConversationTextEditor.vue | 13 ++- .../src/components/conversation/ReplyBox.vue | 96 +++++++++++++++---- .../sidebar/ConversationSideBar.vue | 2 +- frontend/src/components/sidebar/Sidebar.vue | 71 ++++++++------ .../components/ui/command/CommandDialog.vue | 5 +- frontend/src/constants/conversation.js | 11 +-- frontend/src/router/index.js | 19 ++-- 15 files changed, 258 insertions(+), 153 deletions(-) rename frontend/src/components/admin/oidc/{AddEditOIDC.vue => CreateEditOIDC.vue} (100%) rename frontend/src/components/admin/templates/{AddEditTemplate.vue => CreateEditTemplate.vue} (76%) diff --git a/frontend/src/assets/styles/main.scss b/frontend/src/assets/styles/main.scss index a21df598..bb41779b 100644 --- a/frontend/src/assets/styles/main.scss +++ b/frontend/src/assets/styles/main.scss @@ -12,7 +12,7 @@ height: 100%; overflow-y: scroll; padding-bottom: 100px; - @apply bg-slate-50; + @apply bg-accent } @layer base { diff --git a/frontend/src/components/admin/oidc/AddEditOIDC.vue b/frontend/src/components/admin/oidc/CreateEditOIDC.vue similarity index 100% rename from frontend/src/components/admin/oidc/AddEditOIDC.vue rename to frontend/src/components/admin/oidc/CreateEditOIDC.vue diff --git a/frontend/src/components/admin/templates/AddEditTemplate.vue b/frontend/src/components/admin/templates/CreateEditTemplate.vue similarity index 76% rename from frontend/src/components/admin/templates/AddEditTemplate.vue rename to frontend/src/components/admin/templates/CreateEditTemplate.vue index 9bccc59c..57410cad 100644 --- a/frontend/src/components/admin/templates/AddEditTemplate.vue +++ b/frontend/src/components/admin/templates/CreateEditTemplate.vue @@ -3,15 +3,19 @@ - + diff --git a/frontend/src/components/admin/templates/TemplateForm.vue b/frontend/src/components/admin/templates/TemplateForm.vue index f54200a4..de47398d 100644 --- a/frontend/src/components/admin/templates/TemplateForm.vue +++ b/frontend/src/components/admin/templates/TemplateForm.vue @@ -4,31 +4,38 @@ Name - + -
- - - Subject - - - - - - -
+ + + Subject + + + + + + Body - + - {{ `Make sure the template has \{\{ template "content" . \}\}` }} + + {{ `Make sure the template has \{\{ template "content" . \}\} only once.` }} @@ -67,7 +74,7 @@ import { FormDescription } from '@/components/ui/form' import { Input } from '@/components/ui/input' -import CodeEditor from '@/components/common/CodeEditor.vue'; +import CodeEditor from '@/components/common/CodeEditor.vue' import { Checkbox } from '@/components/ui/checkbox' import { Label } from '@/components/ui/label' const props = defineProps({ @@ -86,12 +93,13 @@ const props = defineProps({ }, isLoading: { type: Boolean, - required: false, + required: false } }) const form = useForm({ - validationSchema: toTypedSchema(formSchema) + validationSchema: toTypedSchema(formSchema), + initialValues: props.initialValues }) const onSubmit = form.handleSubmit((values) => { diff --git a/frontend/src/components/admin/templates/Templates.vue b/frontend/src/components/admin/templates/Templates.vue index 4b2d6bd2..00833116 100644 --- a/frontend/src/components/admin/templates/Templates.vue +++ b/frontend/src/components/admin/templates/Templates.vue @@ -1,48 +1,48 @@ diff --git a/frontend/src/components/admin/templates/dataTableDropdown.vue b/frontend/src/components/admin/templates/dataTableDropdown.vue index 480bfb69..726f1188 100644 --- a/frontend/src/components/admin/templates/dataTableDropdown.vue +++ b/frontend/src/components/admin/templates/dataTableDropdown.vue @@ -14,7 +14,7 @@ import { handleHTTPError } from '@/utils/http' import api from '@/api' const router = useRouter() -const emit = useEmitter() +const emitter = useEmitter() const props = defineProps({ template: { type: Object, @@ -32,11 +32,11 @@ const editTemplate = (id) => { const deleteTemplate = async (id) => { try { await api.deleteTemplate(id) - emit.emit(EMITTER_EVENTS.REFRESH_LIST, { + emitter.emit(EMITTER_EVENTS.REFRESH_LIST, { model: 'templates' }) } catch (error) { - emit.emit(EMITTER_EVENTS.SHOW_TOAST, { + emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { title: 'Error', variant: 'destructive', description: handleHTTPError(error).message diff --git a/frontend/src/components/admin/templates/formSchema.js b/frontend/src/components/admin/templates/formSchema.js index 7da8177a..f8206692 100644 --- a/frontend/src/components/admin/templates/formSchema.js +++ b/frontend/src/components/admin/templates/formSchema.js @@ -10,7 +10,7 @@ export const formSchema = z }), type: z.string().optional(), subject: z.string().optional(), - is_default: z.boolean().optional(), + is_default: z.boolean().optional().default(false), }) .superRefine((data, ctx) => { if (data.type !== 'email_outgoing' && !data.subject) { diff --git a/frontend/src/components/command/CommandBox.vue b/frontend/src/components/command/CommandBox.vue index 1042a478..24a53f36 100644 --- a/frontend/src/components/command/CommandBox.vue +++ b/frontend/src/components/command/CommandBox.vue @@ -1,5 +1,5 @@