fix: changed email box design

This commit is contained in:
Shariq Ansari 2023-12-21 19:26:55 +05:30
parent 0c08ba2300
commit a501d7fd45
2 changed files with 46 additions and 53 deletions

View File

@ -1,57 +1,52 @@
<template> <template>
<div class="flex gap-3 px-10 pb-6 pt-2"> <div class="flex gap-1.5 border-t px-10 py-2.5">
<UserAvatar
:user="getUser().name"
size="xl"
:class="showCommunicationBox ? 'mt-3' : ''"
/>
<Button <Button
ref="sendEmailRef" ref="sendEmailRef"
variant="outline" variant="ghost"
size="md" :class="[showCommunicationBox ? '!bg-gray-300 hover:!bg-gray-200' : '']"
class="inline-flex h-8.5 w-full justify-between" label="Reply"
@click="showCommunicationBox = true" @click="showCommunicationBox = !showCommunicationBox"
v-show="!showCommunicationBox"
> >
<div class="text-base text-gray-600">Add a reply...</div> <template #prefix>
<template #suffix> <EmailIcon class="h-4" />
<div class="flex gap-3">
<!-- <FeatherIcon name="paperclip" class="h-4" /> -->
</div>
</template> </template>
</Button> </Button>
<div <!-- <Button variant="ghost" label="Comment">
v-show="showCommunicationBox" <template #prefix>
class="w-full rounded-lg border bg-white p-4 focus-within:border-gray-400" <CommentIcon class="h-4" />
@keydown.ctrl.enter.capture.stop="submitComment" </template>
@keydown.meta.enter.capture.stop="submitComment" </Button> -->
> </div>
<EmailEditor <div
ref="newEmailEditor" v-show="showCommunicationBox"
:value="newEmail" @keydown.ctrl.enter.capture.stop="submitComment"
@change="onNewEmailChange" @keydown.meta.enter.capture.stop="submitComment"
:submitButtonProps="{ >
variant: 'solid', <EmailEditor
onClick: submitComment, ref="newEmailEditor"
disabled: emailEmpty, :value="newEmail"
}" @change="onNewEmailChange"
:discardButtonProps="{ :submitButtonProps="{
onClick: () => { variant: 'solid',
showCommunicationBox = false onClick: submitComment,
newEmail = '' disabled: emailEmpty,
}, }"
}" :discardButtonProps="{
:editable="showCommunicationBox" onClick: () => {
v-model="doc.data" showCommunicationBox = false
placeholder="Add a reply..." newEmail = ''
/> },
</div> }"
:editable="showCommunicationBox"
v-model="doc.data"
placeholder="Add a reply..."
/>
</div> </div>
</template> </template>
<script setup> <script setup>
import UserAvatar from '@/components/UserAvatar.vue'
import EmailEditor from '@/components/EmailEditor.vue' import EmailEditor from '@/components/EmailEditor.vue'
import EmailIcon from '@/components/icons/EmailIcon.vue'
import { usersStore } from '@/stores/users' import { usersStore } from '@/stores/users'
import { call } from 'frappe-ui' import { call } from 'frappe-ui'
import { ref, watch, computed, defineModel } from 'vue' import { ref, watch, computed, defineModel } from 'vue'

View File

@ -1,7 +1,7 @@
<template> <template>
<TextEditor <TextEditor
ref="textEditor" ref="textEditor"
:editor-class="['prose-sm max-w-none', editable && 'min-h-[4rem]']" :editor-class="['prose-sm max-w-none', editable && 'min-h-[7rem]']"
:content="value" :content="value"
@change="editable ? $emit('change', $event) : null" @change="editable ? $emit('change', $event) : null"
:starterkit-options="{ heading: { levels: [2, 3, 4, 5, 6] } }" :starterkit-options="{ heading: { levels: [2, 3, 4, 5, 6] } }"
@ -9,26 +9,24 @@
:editable="editable" :editable="editable"
> >
<template #top> <template #top>
<div class="mb-2"> <div class="mx-10 border-t border-b py-2.5">
<span class="text-base text-gray-600">To:</span> <span class="text-xs text-gray-500">TO:</span>
<span <span
v-if="modelValue.email" v-if="modelValue.email"
class="ml-2 bg-gray-100 px-2 py-1 rounded-md text-sm text-gray-800 cursor-pointer" class="ml-2 cursor-pointer rounded-md bg-gray-100 px-2 py-1 text-sm text-gray-800"
>{{ modelValue.email }}</span
> >
{{ modelValue.email }}
</span>
</div> </div>
</template> </template>
<template v-slot:editor="{ editor }"> <template v-slot:editor="{ editor }">
<EditorContent <EditorContent
:class="[editable && 'max-h-[50vh] overflow-y-auto']" :class="[editable && 'mx-10 py-3 max-h-[50vh] overflow-y-auto']"
:editor="editor" :editor="editor"
/> />
</template> </template>
<template v-slot:bottom> <template v-slot:bottom>
<div <div v-if="editable" class="flex justify-between border-t px-10 py-2.5">
v-if="editable"
class="mt-2 flex flex-col justify-between sm:flex-row sm:items-center"
>
<TextEditorFixedMenu <TextEditorFixedMenu
class="-ml-1 overflow-x-auto" class="-ml-1 overflow-x-auto"
:buttons="textEditorMenuButtons" :buttons="textEditorMenuButtons"