Browse Source

fix(nc-gui): replace base icon from all places except sidebar

pull/7807/head
Ramesh Mane 10 months ago
parent
commit
79bc28c765
  1. 13
      packages/nc-gui/components/dlg/ProjectDelete.vue
  2. 13
      packages/nc-gui/components/dlg/share-and-collaborate/View.vue
  3. 3
      packages/nc-gui/components/general/BaseColorPicker.vue
  4. 12
      packages/nc-gui/components/project/View.vue
  5. 23
      packages/nc-gui/components/workspace/ProjectList.vue

13
packages/nc-gui/components/dlg/ProjectDelete.vue

@ -52,7 +52,18 @@ const onDelete = async () => {
<GeneralDeleteModal v-model:visible="visible" :entity-name="$t('objects.project')" :on-delete="onDelete"> <GeneralDeleteModal v-model:visible="visible" :entity-name="$t('objects.project')" :on-delete="onDelete">
<template #entity-preview> <template #entity-preview>
<div v-if="base" class="flex flex-row items-center py-2 px-2.25 bg-gray-50 rounded-lg text-gray-700 mb-4"> <div v-if="base" class="flex flex-row items-center py-2 px-2.25 bg-gray-50 rounded-lg text-gray-700 mb-4">
<GeneralProjectIcon :type="base.type" class="nc-view-icon px-1.5 w-10" /> <LazyGeneralBaseColorPicker
:key="parseProp(base.meta).iconHue"
:hue="parseProp(base.meta).iconHue"
size="small"
class="!w-auto !h-auto"
iconClass="nc-view-icon w-6 h-6"
readonly
>
<template #default>
<GeneralProjectIcon :type="base.type" class="nc-view-icon w-6 h-6" />
</template>
</LazyGeneralBaseColorPicker>
<div <div
class="capitalize text-ellipsis overflow-hidden select-none w-full pl-1.75" class="capitalize text-ellipsis overflow-hidden select-none w-full pl-1.75"
:style="{ wordBreak: 'keep-all', whiteSpace: 'nowrap', display: 'inline' }" :style="{ wordBreak: 'keep-all', whiteSpace: 'nowrap', display: 'inline' }"

13
packages/nc-gui/components/dlg/share-and-collaborate/View.vue

@ -154,7 +154,18 @@ watch(showShareModal, (val) => {
</div> </div>
<div class="share-base"> <div class="share-base">
<div class="flex flex-row items-center gap-x-2 px-4 pt-3 pb-3 select-none"> <div class="flex flex-row items-center gap-x-2 px-4 pt-3 pb-3 select-none">
<GeneralProjectIcon :type="base.type" class="nc-view-icon group-hover" /> <LazyGeneralBaseColorPicker
:key="parseProp(base.meta).iconHue"
:hue="parseProp(base.meta).iconHue"
size="small"
class="!w-auto !h-auto"
iconClass="nc-view-icon group-hover"
readonly
>
<template #default>
<GeneralProjectIcon :type="base.type" class="nc-view-icon group-hover" />
</template>
</LazyGeneralBaseColorPicker>
<div>{{ $t('activity.shareBase.label') }}</div> <div>{{ $t('activity.shareBase.label') }}</div>
<div <div

3
packages/nc-gui/components/general/BaseColorPicker.vue

@ -9,6 +9,7 @@ const props = defineProps<{
size?: 'small' | 'medium' | 'large' | 'xlarge' size?: 'small' | 'medium' | 'large' | 'xlarge'
readonly?: boolean readonly?: boolean
disableClearing?: boolean disableClearing?: boolean
iconClass?: string
}>() }>()
const emit = defineEmits(['colorSelected']) const emit = defineEmits(['colorSelected'])
@ -96,7 +97,7 @@ watch(
<slot name="default" /> <slot name="default" />
</template> </template>
<template v-else> <template v-else>
<svg width="16" height="16" viewBox="0 0 1073 1073" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 1073 1073" fill="none" xmlns="http://www.w3.org/2000/svg" :class="iconClass">
<mask <mask
id="mask0_1749_80944" id="mask0_1749_80944"
style="mask-type: luminance" style="mask-type: luminance"

12
packages/nc-gui/components/project/View.vue

@ -82,7 +82,17 @@ watch(
<div class="flex flex-row items-center gap-x-3"> <div class="flex flex-row items-center gap-x-3">
<GeneralOpenLeftSidebarBtn /> <GeneralOpenLeftSidebarBtn />
<div class="flex flex-row items-center h-full gap-x-2.5"> <div class="flex flex-row items-center h-full gap-x-2.5">
<GeneralProjectIcon :type="openedProject?.type" /> <LazyGeneralBaseColorPicker
:key="parseProp(openedProject?.meta).iconHue"
:hue="parseProp(openedProject?.meta).iconHue"
size="small"
class="!w-auto !h-auto"
readonly
>
<template #default>
<GeneralProjectIcon :type="openedProject?.type" />
</template>
</LazyGeneralBaseColorPicker>
<NcTooltip class="flex font-medium text-sm capitalize truncate max-w-150" show-on-truncate-only> <NcTooltip class="flex font-medium text-sm capitalize truncate max-w-150" show-on-truncate-only>
<template #title> {{ openedProject?.title }}</template> <template #title> {{ openedProject?.title }}</template>
<span class="truncate"> <span class="truncate">

23
packages/nc-gui/components/workspace/ProjectList.vue

@ -17,6 +17,7 @@ import {
useNuxtApp, useNuxtApp,
useRoles, useRoles,
useWorkspace, useWorkspace,
parseProp,
} from '#imports' } from '#imports'
const workspaceStore = useWorkspace() const workspaceStore = useWorkspace()
@ -181,16 +182,16 @@ function onProjectTitleClick(index: number) {
} }
} }
const setIcon = async (icon: string, base: BaseType) => { const setColor = async (hue: number, base: BaseType) => {
try { try {
const meta = { const meta = {
...((base.meta as object) || {}), ...parseProp(base.meta),
icon, iconHue: hue,
} }
basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) }) basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) })
$e('a:base:icon:navdraw', { icon }) $e('a:base:icon:color:navdraw', { iconHue: hue })
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
@ -250,15 +251,17 @@ const setIcon = async (icon: string, base: BaseType) => {
<template v-if="column.dataIndex === 'title'"> <template v-if="column.dataIndex === 'title'">
<div class="flex items-center nc-base-title gap-2.5 max-w-full -ml-1.5"> <div class="flex items-center nc-base-title gap-2.5 max-w-full -ml-1.5">
<div class="flex items-center gap-2 text-center"> <div class="flex items-center gap-2 text-center">
<LazyGeneralEmojiPicker <LazyGeneralBaseColorPicker
:key="record.id" :key="parseProp(record.meta).iconHue"
:emoji="record.meta?.icon" :hue="parseProp(record.meta).iconHue"
size="small" size="small"
readonly readonly
@emoji-selected="setIcon($event, record)" @color-selected="setColor($event, record)"
> >
<GeneralProjectIcon :type="record.type" /> <template #default>
</LazyGeneralEmojiPicker> <GeneralProjectIcon :type="record.type" />
</template>
</LazyGeneralBaseColorPicker>
<!-- todo: replace with switch --> <!-- todo: replace with switch -->
</div> </div>

Loading…
Cancel
Save