Browse Source

refactor(gui-v2): row comment ui improvements

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3025/head
Pranav C 2 years ago
parent
commit
18d318e047
  1. 2
      packages/nc-gui-v2/components/smartsheet/Grid.vue
  2. 32
      packages/nc-gui-v2/components/smartsheet/expanded-form/Comments.vue
  3. 7
      packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue

2
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -432,7 +432,7 @@ const expandForm = (row: Row, state: Record<string, any>) => {
<SmartsheetPagination /> <SmartsheetPagination />
<SmartsheetExpandedForm <SmartsheetExpandedForm
v-if="expandedFormRow" v-if="expandedFormRow && expandedFormDlg"
v-model="expandedFormDlg" v-model="expandedFormDlg"
:row="expandedFormRow" :row="expandedFormRow"
:state="expandedFormRowState" :state="expandedFormRowState"

32
packages/nc-gui-v2/components/smartsheet/expanded-form/Comments.vue

@ -1,8 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useExpandedFormStoreOrThrow } from '#imports' import { nextTick, useExpandedFormStoreOrThrow } from '#imports'
import { nextTick } from '#imports'
import { enumColor, timeAgo } from '~/utils' import { enumColor, timeAgo } from '~/utils'
import MdiKeyboardReturnIcon from '~icons/mdi/keyboard-return'
import MdiAccountIcon from '~icons/mdi/account-circle' import MdiAccountIcon from '~icons/mdi/account-circle'
const { loadCommentsAndLogs, commentsAndLogs, isCommentsLoading, commentsOnly, saveComment, isYou, comment, row } = const { loadCommentsAndLogs, commentsAndLogs, isCommentsLoading, commentsOnly, saveComment, isYou, comment, row } =
@ -10,23 +8,22 @@ const { loadCommentsAndLogs, commentsAndLogs, isCommentsLoading, commentsOnly, s
const commentsWrapperEl = ref<HTMLDivElement>() const commentsWrapperEl = ref<HTMLDivElement>()
await loadCommentsAndLogs() await loadCommentsAndLogs()
watch( watch(
commentsAndLogs, commentsAndLogs,
() => { () => {
nextTick(() => { nextTick(() => {
if (commentsWrapperEl.value) if (commentsWrapperEl.value) commentsWrapperEl.value.scrollTop = commentsWrapperEl.value?.scrollHeight
commentsWrapperEl.value.scrollTop = commentsWrapperEl.value?.scrollHeight
}) })
}, { immediate: true }) },
{ immediate: true },
)
</script> </script>
<template> <template>
<div class="h-full d-flex flex-column w-full"> <div class="h-full d-flex flex-column w-full">
<div class="flex-grow-1 min-h-[100px] overflow-y-auto p-2" ref="commentsWrapperEl"> <div ref="commentsWrapperEl" class="flex-grow-1 min-h-[100px] overflow-y-auto scrollbar-thin-primary p-2">
<v-skeleton-loader v-if="isCommentsLoading && !commentsAndLogs" type="list-item-avatar-two-line@8" /> <v-skeleton-loader v-if="isCommentsLoading && !commentsAndLogs" type="list-item-avatar-two-line@8" />
<template v-else> <template v-else>
@ -55,22 +52,29 @@ watch(
</template> </template>
</div> </div>
<div class="border-1 my-2 w-full ml-6" /> <div class="border-1 my-2 w-full ml-6" />
<div class="p-2"> <div class="p-0">
<div class="flex justify-center">
<a-checkbox v-model:checked="commentsOnly" @change="loadCommentsAndLogs" <a-checkbox v-model:checked="commentsOnly" @change="loadCommentsAndLogs"
><span class="text-xs">Comments only</span> ><span class="text-[11px]">Comments only</span>
</a-checkbox> </a-checkbox>
</div>
<div class="flex-shrink-1 mt-2 d-flex pl-4"> <div class="flex-shrink-1 mt-2 d-flex pl-4">
<v-icon color="pink lighten-2" class="mr-2"> mdi-account-circle</v-icon>
<a-input <a-input
v-model:value="comment" v-model:value="comment"
class="caption comment-box" class="!text-xs"
ghost
:class="{ focus: showborder }" :class="{ focus: showborder }"
@focusin="showborder = true" @focusin="showborder = true"
@focusout="showborder = false" @focusout="showborder = false"
@keyup.enter.prevent="saveComment" @keyup.enter.prevent="saveComment"
> >
<template #addonBefore>
<div class="flex align-center">
<mdi-account-circle class="text-lg text-pink-300" small @click="saveComment" />
</div>
</template>
<template #suffix> <template #suffix>
<MdiKeyboardReturnIcon v-if="comment" class="text-sm" small @click="saveComment" /> <mdi-keyboard-return v-if="comment" class="text-sm" small @click="saveComment" />
</template> </template>
</a-input> </a-input>
</div> </div>

7
packages/nc-gui-v2/components/smartsheet/expanded-form/index.vue

@ -81,7 +81,7 @@ const isExpanded = useVModel(props, 'modelValue', emits)
<Header @cancel="isExpanded = false" /> <Header @cancel="isExpanded = false" />
<a-card class="!bg-gray-100"> <a-card class="!bg-gray-100">
<div class="flex h-full nc-form-wrapper items-stretch"> <div class="flex h-full nc-form-wrapper items-stretch">
<div class="flex-grow overflow-auto"> <div class="flex-grow overflow-auto scrollbar-thin-primary">
<div class="w-[500px] mx-auto"> <div class="w-[500px] mx-auto">
<div v-for="col in fields" :key="col.title" class="mt-2"> <div v-for="col in fields" :key="col.title" class="mt-2">
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" /> <SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" />
@ -101,10 +101,7 @@ const isExpanded = useVModel(props, 'modelValue', emits)
</div> </div>
</div> </div>
<div <div class="nc-comments-drawer min-w-0 min-h-full max-h-full" :class="{ active: commentsDrawer }">
class="nc-comments-drawer min-w-0 min-h-full max-h-full"
:class="{ active: commentsDrawer }"
>
<div class="h-full"> <div class="h-full">
<Comments v-if="commentsDrawer" /> <Comments v-if="commentsDrawer" />
</div> </div>

Loading…
Cancel
Save