Browse Source

fix(nc-gui): use colour picker for base icon instead of hue picker

pull/7807/head
Ramesh Mane 10 months ago
parent
commit
e4c917d3a4
  1. 7
      packages/nc-gui/components/cmd-k/index.vue
  2. 20
      packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue
  3. 13
      packages/nc-gui/components/dlg/ProjectDelete.vue
  4. 2
      packages/nc-gui/components/dlg/ProjectDuplicate.vue
  5. 13
      packages/nc-gui/components/dlg/share-and-collaborate/View.vue
  6. 191
      packages/nc-gui/components/general/BaseIconColorPicker.vue
  7. 104
      packages/nc-gui/components/general/ColorPicker.vue
  8. 48
      packages/nc-gui/components/general/ProjectIcon.vue
  9. 12
      packages/nc-gui/components/project/View.vue
  10. 14
      packages/nc-gui/components/smartsheet/Form.vue
  11. 2
      packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue
  12. 19
      packages/nc-gui/components/workspace/ProjectList.vue
  13. 4
      packages/nocodb/src/services/command-palette.service.ts

7
packages/nc-gui/components/cmd-k/index.vue

@ -17,7 +17,7 @@ interface CmdAction {
keywords?: string[] keywords?: string[]
section?: string section?: string
is_default?: number | null is_default?: number | null
iconHue?: number iconColor?: string
} }
const props = defineProps<{ const props = defineProps<{
@ -387,10 +387,7 @@ defineExpose({
> >
<div class="cmdk-action-content w-full"> <div class="cmdk-action-content w-full">
<template v-if="title === 'Bases' || act.icon === 'project'"> <template v-if="title === 'Bases' || act.icon === 'project'">
<GeneralBaseIconColorPicker :key="act.iconHue" :hue="act.iconHue" size="small" readonly> <GeneralBaseIconColorPicker :key="act.iconColor" :color="act.iconColor" type="database" readonly>
<template #default>
<GeneralProjectIcon type="database" />
</template>
</GeneralBaseIconColorPicker> </GeneralBaseIconColorPicker>
</template> </template>
<template v-else> <template v-else>

20
packages/nc-gui/components/dashboard/TreeView/ProjectNode.vue

@ -75,6 +75,8 @@ useTabs()
const { meta: metaKey, ctrlKey } = useMagicKeys() const { meta: metaKey, ctrlKey } = useMagicKeys()
const { refreshCommandPalette } = useCommandPalette()
const editMode = ref(false) const editMode = ref(false)
const tempTitle = ref('') const tempTitle = ref('')
@ -172,18 +174,20 @@ defineExpose({
enableEditMode, enableEditMode,
}) })
const setColor = async (hue: number, base: BaseType) => { const setColor = async (color: string, base: BaseType) => {
try { try {
const meta = { const meta = {
...parseProp(base.meta), ...parseProp(base.meta),
iconHue: hue, iconColor: color,
} }
basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) }) basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) })
$e('a:base:icon:color:navdraw', { iconHue: hue }) $e('a:base:icon:color:navdraw', { iconColor: color })
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} finally {
refreshCommandPalette()
} }
} }
@ -425,15 +429,13 @@ const projectDelete = () => {
<div v-else> <div v-else>
<GeneralBaseIconColorPicker <GeneralBaseIconColorPicker
:key="`${base.id}_${parseProp(base.meta).iconHue}`" :key="`${base.id}_${parseProp(base.meta).iconColor}`"
:hue="parseProp(base.meta).iconHue" :type="base?.type"
:model-value="parseProp(base.meta).iconColor"
size="small" size="small"
:readonly="(base?.type && base?.type !== 'database') || !isUIAllowed('baseRename')" :readonly="(base?.type && base?.type !== 'database') || !isUIAllowed('baseRename')"
@color-selected="setColor($event, base)" @update:model-value="setColor($event, base)"
> >
<template #default>
<GeneralProjectIcon :type="base?.type" />
</template>
</GeneralBaseIconColorPicker> </GeneralBaseIconColorPicker>
</div> </div>
</div> </div>

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

@ -52,18 +52,7 @@ 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">
<GeneralBaseIconColorPicker <GeneralProjectIcon :color="parseProp(base.meta).iconColor" :type="base.type" class="nc-view-icon w-6 h-6 mx-1" />
:key="parseProp(base.meta).iconHue"
:hue="parseProp(base.meta).iconHue"
size="small"
class="!w-auto !h-auto"
icon-class="nc-view-icon w-6 h-6"
readonly
>
<template #default>
<GeneralProjectIcon :type="base.type" class="nc-view-icon w-6 h-6" />
</template>
</GeneralBaseIconColorPicker>
<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' }"

2
packages/nc-gui/components/dlg/ProjectDuplicate.vue

@ -62,7 +62,7 @@ const _duplicate = async () => {
primaryColor: color, primaryColor: color,
accentColor: complement.toHex8String(), accentColor: complement.toHex8String(),
}, },
iconHue: parseProp(props.base.meta).iconHue, iconColor: parseProp(props.base.meta).iconColor,
}), }),
}, },
}) })

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

@ -154,18 +154,7 @@ 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">
<GeneralBaseIconColorPicker <GeneralProjectIcon :color="parseProp(base.meta).iconColor" :type="base.type" class="nc-view-icon group-hover" />
:key="parseProp(base.meta).iconHue"
:hue="parseProp(base.meta).iconHue"
size="small"
class="!w-auto !h-auto"
icon-class="nc-view-icon group-hover"
readonly
>
<template #default>
<GeneralProjectIcon :type="base.type" class="nc-view-icon group-hover" />
</template>
</GeneralBaseIconColorPicker>
<div>{{ $t('activity.shareBase.label') }}</div> <div>{{ $t('activity.shareBase.label') }}</div>
<div <div

191
packages/nc-gui/components/general/BaseIconColorPicker.vue

@ -1,37 +1,37 @@
<script lang="ts" setup> <script lang="ts" setup>
import tinycolor from 'tinycolor2' import tinycolor from 'tinycolor2'
import { BASE_ICON_COLOR_HUE_DATA as preDefinedHueData } from '#imports' import { NcProjectType } from '#imports'
const props = defineProps<{ const props = withDefaults(
hue?: number | null defineProps<{
size?: 'small' | 'medium' | 'large' | 'xlarge' type?: NcProjectType | string
readonly?: boolean modelValue?: string
disableClearing?: boolean size?: 'small' | 'medium' | 'large' | 'xlarge'
iconClass?: string readonly?: boolean
}>() iconClass?: string
}>(),
const emit = defineEmits(['colorSelected']) {
type: NcProjectType.DB,
size: 'small',
},
)
const { hue, size = 'medium', readonly } = props const emit = defineEmits(['update:modelValue'])
const defaultHueColor = { const defaultIconColors = ['#36BFFF', '#FA8231', '#FCBE3A', '#27D665', '#6A7184', '#FF4A3F', '#FC3AC6', '#7D26CD']
h: 199,
s: 79,
v: 100,
}
const defaultHueValue = 199 const { modelValue, size, readonly } = props
const isOpen = ref(false) const isOpen = ref(false)
const colorRef = ref({ const colorRef = ref(tinycolor(modelValue).isValid() ? modelValue : defaultIconColors[0])
...defaultHueColor,
h: !(hue !== 0 && !hue) ? hue : defaultHueValue,
})
const updateColorHue = (value?: string | number | null) => { const updateIconColor = (color: string) => {
colorRef.value.h = !isNaN(parseInt(`${value}`)) ? +Math.min(parseInt(`${value}`), 360) : 0 const tcolor = tinycolor(color)
if (tcolor.isValid()) {
colorRef.value = color
}
} }
const onClick = (e: Event) => { const onClick = (e: Event) => {
@ -45,8 +45,8 @@ const onClick = (e: Event) => {
watch( watch(
isOpen, isOpen,
(value) => { (value) => {
if (!value && colorRef.value.h !== hue) { if (!value && colorRef.value !== modelValue) {
emit('colorSelected', colorRef.value.h) emit('update:modelValue', colorRef.value)
} }
}, },
{ {
@ -72,108 +72,25 @@ watch(
> >
<NcTooltip placement="topLeft" :disabled="readonly"> <NcTooltip placement="topLeft" :disabled="readonly">
<template #title> {{ $t('tooltip.changeIconColour') }} </template> <template #title> {{ $t('tooltip.changeIconColour') }} </template>
<template v-if="hue !== 0 && !hue && colorRef.h === defaultHueValue">
<slot name="default" /> <div>
</template> <GeneralProjectIcon :color="colorRef" :type="type" />
<template v-else> </div>
<svg width="16" height="16" viewBox="0 0 1073 1073" fill="none" xmlns="http://www.w3.org/2000/svg" :class="iconClass">
<mask
id="mask0_1749_80944"
style="mask-type: luminance"
maskUnits="userSpaceOnUse"
x="94"
y="40"
width="885"
height="993"
>
<path d="M978.723 40H94V1033H978.723V40Z" fill="white" />
</mask>
<g mask="url(#mask0_1749_80944)">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M638.951 291.265L936.342 462.949C966.129 480.145 980.256 502.958 978.723 525.482V774.266C980.256 796.789 966.129 819.602 936.342 836.798L638.951 1008.48C582.292 1041.19 490.431 1041.19 433.773 1008.48L136.381 836.798C106.595 819.602 92.4675 796.789 93.9999 774.266L93.9999 525.482C92.4675 502.957 106.595 480.145 136.381 462.949L433.773 291.265C490.431 258.556 582.292 258.556 638.951 291.265Z"
:fill="
tinycolor(
preDefinedHueData && preDefinedHueData[`_${colorRef.h}`]
? `hsv(${preDefinedHueData[`_${colorRef.h}`].shade.h},${preDefinedHueData[`_${colorRef.h}`].shade.s}%, ${
preDefinedHueData[`_${colorRef.h}`].shade.v
}%)`
: `hsv(${colorRef.h ?? defaultHueValue}, 100%, 30%)`,
).toHexString()
"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M638.951 65.0055L936.342 236.69C966.129 253.886 980.256 276.699 978.723 299.222V548.006C980.256 570.529 966.129 593.343 936.342 610.538L638.951 782.223C582.292 814.931 490.431 814.931 433.773 782.223L136.381 610.538C106.595 593.343 92.4675 570.529 93.9999 548.006L93.9999 299.222C92.4675 276.699 106.595 253.886 136.381 236.69L433.773 65.0055C490.431 32.2968 582.292 32.2968 638.951 65.0055Z"
:fill="
tinycolor(
preDefinedHueData && preDefinedHueData[`_${colorRef.h}`]
? `hsv(${preDefinedHueData[`_${colorRef.h}`].tint.h},${preDefinedHueData[`_${colorRef.h}`].tint.s}%, ${
preDefinedHueData[`_${colorRef.h}`].tint.v
}%)`
: `hsv(${colorRef.h ?? defaultHueValue}, 50%, 100%)`,
).toHexString()
"
/>
</g>
</svg>
</template>
</NcTooltip> </NcTooltip>
</div> </div>
<template #overlay>
<div class="nc-base-icon-color-picker-dropdown relative bg-white rounded-lg border-1 border-gray-200">
<div class="flex items-center p-2 space-x-2">
<div
v-for="(h, i) of Object.keys(preDefinedHueData)"
:key="i"
class="nc-pre-defined-hue-item-wrapper p-1 rounded cursor-pointer hover:bg-gray-200"
>
<div
class="nc-pre-defined-hue-item rounded h-6 w-6"
:tabindex="0"
:class="{
selected: `_${colorRef.h}` === h,
}"
:style="{
backgroundColor: preDefinedHueData[h].pickerColor,
}"
@click.stop="updateColorHue(preDefinedHueData[h].tint.h)"
@keydown.enter.stop="updateColorHue(preDefinedHueData[h].tint.h)"
></div>
</div>
</div>
<div class="p-3 border-t-1 border-gray-200 flex flex-col space-y-2.5"> <template #overlay>
<div class="uppercase text-xs font-medium">{{ $t('labels.customColour') }}</div> <div
class="nc-base-icon-color-picker-dropdown relative bg-white rounded-lg border-1 border-gray-200 overflow-hidden max-w-[342px]"
<div class="flex flex-row items-center gap-x-3"> >
<LazyGeneralColorSliderWrapper <div class="flex justify-start">
:model-value="colorRef" <GeneralColorPicker
class="!min-w-none" :model-value="colorRef"
@update:model-value=" :colors="defaultIconColors"
(value) => { :is-new-design="true"
updateColorHue(value?.h) class="nc-base-icon-color-picker"
} @input="updateIconColor"
" />
/>
<input
:value="parseInt(`${colorRef.h ?? 0}`)"
class="nc-color-hue-input"
:class="{
selected: !preDefinedHueData[`_${colorRef.h}`],
}"
type="number"
:min="0"
:max="360"
@input="
(value) => {
updateColorHue(value.target?.value)
}
"
/>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -185,28 +102,4 @@ watch(
.nc-base-icon-color-picker-dropdown { .nc-base-icon-color-picker-dropdown {
box-shadow: 0px 8px 8px -4px #0000000a, 0px 20px 24px -4px #0000001a; box-shadow: 0px 8px 8px -4px #0000000a, 0px 20px 24px -4px #0000001a;
} }
.nc-pre-defined-hue-item-wrapper {
.nc-pre-defined-hue-item:focus,
.nc-pre-defined-hue-item.selected {
@apply outline-none;
box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3069fe;
}
}
.nc-color-hue-input {
@apply outline-none text-sm rounded-lg border-gray-200 py-1 px-3 w-14 text-center;
-moz-appearance: textfield;
&:focus,
&.selected {
@apply ring-transparent border-brand-500;
}
/* Chrome, Safari, Edge, Opera */
&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
</style> </style>

104
packages/nc-gui/components/general/ColorPicker.vue

@ -1,4 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import tinycolor from 'tinycolor2'
import { computed, enumColor, ref, watch } from '#imports' import { computed, enumColor, ref, watch } from '#imports'
interface Props { interface Props {
@ -7,7 +8,7 @@ interface Props {
rowSize?: number rowSize?: number
advanced?: boolean advanced?: boolean
pickButton?: boolean pickButton?: boolean
borders?: string[] colorBoxBorder?: boolean
isNewDesign?: boolean isNewDesign?: boolean
} }
@ -17,6 +18,7 @@ const props = withDefaults(defineProps<Props>(), {
rowSize: 10, rowSize: 10,
advanced: true, advanced: true,
pickButton: false, pickButton: false,
colorBoxBorder: false,
isNewDesign: false, isNewDesign: false,
}) })
@ -41,7 +43,8 @@ const selectColor = (color: string, closeModal = false) => {
const isPickerOn = ref(false) const isPickerOn = ref(false)
const compare = (colorA: string, colorB: string) => colorA.toLowerCase() === colorB.toLowerCase() const compare = (colorA: string, colorB: string) =>
colorA.toLowerCase() === colorB.toLowerCase() || colorA.toLowerCase() === tinycolor(colorB).toHex8String().toLowerCase()
watch(picked, (n, _o) => { watch(picked, (n, _o) => {
vModel.value = n vModel.value = n
@ -50,31 +53,57 @@ watch(picked, (n, _o) => {
<template> <template>
<div class="color-picker"> <div class="color-picker">
<div v-for="colId in Math.ceil(props.colors.length / props.rowSize)" :key="colId" class="color-picker-row"> <div
<button v-for="colId in Math.ceil(props.colors.length / props.rowSize)"
:key="colId"
class="color-picker-row"
:class="{
'mt-2': colId > 1,
}"
>
<div
v-for="(color, i) of colors.slice((colId - 1) * rowSize, colId * rowSize)" v-for="(color, i) of colors.slice((colId - 1) * rowSize, colId * rowSize)"
:key="`color-${colId}-${i}`" :key="`color-${colId}-${i}`"
class="color-selector" class="p-1 rounded-md flex h-8"
:class="{ 'selected': compare(picked, color), 'new-design': isNewDesign }" :class="{
:style="{ 'hover:bg-gray-200': isNewDesign,
'background-color': `${color}`,
'border': borders?.length && borders[i] ? `1px solid ${borders[i]}` : undefined,
}" }"
@click="selectColor(color, true)"
> >
{{ compare(picked, color) && !isNewDesign ? '&#10003;' : '' }} <button
</button> class="color-selector"
<button class="h-6 w-6 mt-2.7 ml-1 border-1 border-[grey] rounded-md" @click="isPickerOn = !isPickerOn"> :class="{ 'selected': compare(picked, color), 'new-design': isNewDesign }"
<GeneralTooltip> :style="{
<template #title>{{ $t('activity.moreColors') }}</template> 'background-color': `${color}`,
<div class="flex items-center justify-center"> 'border': colorBoxBorder ? `1px solid ${tinycolor(color).darken(30).toString()}` : undefined,
<GeneralIcon :icon="isPickerOn ? 'minus' : 'plus'" class="w-4 h-4" /> }"
</div> @click="selectColor(color, true)"
</GeneralTooltip> >
</button> {{ compare(picked, color) && !isNewDesign ? '&#10003;' : '' }}
</button>
</div>
<div
class="p-1 rounded-md h-8"
:class="{
'hover:bg-gray-200': isNewDesign,
}"
>
<button class="nc-more-colors-trigger h-6 w-6 border-1 border-gray-400 rounded" @click="isPickerOn = !isPickerOn">
<GeneralTooltip>
<template #title>{{ $t('activity.moreColors') }}</template>
<div class="flex items-center justify-center">
<GeneralIcon :icon="isPickerOn ? 'minus' : 'plus'" class="w-4 h-4" />
</div>
</GeneralTooltip>
</button>
</div>
</div> </div>
<a-card v-if="props.advanced" class="w-full mt-2" :body-style="{ padding: '0px' }" :bordered="false"> <a-card
v-if="props.advanced"
class="w-full mt-2"
:body-style="{ paddingLeft: '4px !important', paddingRight: '4px !important' }"
:bordered="false"
>
<div v-if="isPickerOn" class="flex justify-center"> <div v-if="isPickerOn" class="flex justify-center">
<LazyGeneralChromeWrapper v-model="picked" class="!w-full !shadow-none" /> <LazyGeneralChromeWrapper v-model="picked" class="!w-full !shadow-none" />
</div> </div>
@ -82,25 +111,15 @@ watch(picked, (n, _o) => {
</div> </div>
</template> </template>
<style scoped> <style lansg="scss" scoped>
.color-picker { .color-picker {
display: flex; @apply flex flex-col items-center justify-center bg-white p-2.5;
align-items: center;
justify-content: center;
flex-direction: column;
background: white;
padding: 10px;
} }
.color-picker-row { .color-picker-row {
display: flex; @apply flex flex-row space-x-1;
flex-direction: row;
} }
.color-selector { .color-selector {
position: relative; @apply h-6 w-6 rounded;
height: 25px;
width: 25px;
margin: 10px 5px;
border-radius: 5px;
-webkit-text-stroke-width: 1px; -webkit-text-stroke-width: 1px;
-webkit-text-stroke-color: white; -webkit-text-stroke-color: white;
} }
@ -108,19 +127,14 @@ watch(picked, (n, _o) => {
filter: brightness(90%); filter: brightness(90%);
-webkit-filter: brightness(90%); -webkit-filter: brightness(90%);
} }
.color-selector:focus,
.color-selector.selected:not(.new-design) { .color-selector.selected,
filter: brightness(90%); .nc-more-colors-trigger:focus {
-webkit-filter: brightness(90%);
}
.color-selector:focus.new-design {
outline: none; outline: none;
box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe; box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
} }
.color-selector.selected.new-design {
box-shadow: 0px 0px 0px 2px #fff, 0px 0px 0px 4px #3069fe;
}
:deep(.vc-chrome-toggle-icon) { :deep(.vc-chrome-toggle-icon) {
@apply ml-3!important; @apply !ml-3;
} }
</style> </style>

48
packages/nc-gui/components/general/ProjectIcon.vue

@ -1,18 +1,58 @@
<script lang="ts" setup> <script lang="ts" setup>
const { hoverable } = defineProps<{ import tinycolor from 'tinycolor2'
const { hoverable, color } = defineProps<{
type?: string type?: string
hoverable?: boolean hoverable?: boolean
color?: string
}>() }>()
const iconColor = computed(() => {
return color
? {
tint: tinycolor(color || '#36BFFF')
.lighten(10)
.toHexString(),
shade: tinycolor(color || '#36BFFF')
.darken(40)
.toHexString(),
}
: {
tint: '#36BFFF',
shade: '#142966',
}
})
</script> </script>
<template> <template>
<GeneralIcon <svg
icon="project" width="16"
height="16"
viewBox="0 0 1073 1073"
fill="none"
xmlns="http://www.w3.org/2000/svg"
class="text-[#2824FB] base" class="text-[#2824FB] base"
:class="{ :class="{
'nc-base-icon-hoverable': hoverable, 'nc-base-icon-hoverable': hoverable,
}" }"
/> >
<mask id="mask0_1749_80944" style="mask-type: luminance" maskUnits="userSpaceOnUse" x="94" y="40" width="885" height="993">
<path d="M978.723 40H94V1033H978.723V40Z" fill="white" />
</mask>
<g mask="url(#mask0_1749_80944)">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M638.951 291.265L936.342 462.949C966.129 480.145 980.256 502.958 978.723 525.482V774.266C980.256 796.789 966.129 819.602 936.342 836.798L638.951 1008.48C582.292 1041.19 490.431 1041.19 433.773 1008.48L136.381 836.798C106.595 819.602 92.4675 796.789 93.9999 774.266L93.9999 525.482C92.4675 502.957 106.595 480.145 136.381 462.949L433.773 291.265C490.431 258.556 582.292 258.556 638.951 291.265Z"
:fill="iconColor.shade"
/>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M638.951 65.0055L936.342 236.69C966.129 253.886 980.256 276.699 978.723 299.222V548.006C980.256 570.529 966.129 593.343 936.342 610.538L638.951 782.223C582.292 814.931 490.431 814.931 433.773 782.223L136.381 610.538C106.595 593.343 92.4675 570.529 93.9999 548.006L93.9999 299.222C92.4675 276.699 106.595 253.886 136.381 236.69L433.773 65.0055C490.431 32.2968 582.292 32.2968 638.951 65.0055Z"
:fill="iconColor.tint"
/>
</g>
</svg>
</template> </template>
<style scoped> <style scoped>

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

@ -82,17 +82,7 @@ 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">
<GeneralBaseIconColorPicker <GeneralProjectIcon :type="openedProject?.type" :color="parseProp(openedProject?.meta).iconColor" />
: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>
</GeneralBaseIconColorPicker>
<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">

14
packages/nc-gui/components/smartsheet/Form.vue

@ -1541,19 +1541,9 @@ useEventListener(
'#E5D4F5', '#E5D4F5',
'#FFCFE6', '#FFCFE6',
]" ]"
:borders="[ :color-box-border="true"
'#6A7184',
'#FF4A3F',
'#FA8231',
'#FCBE3A',
'#27D665',
'#36BFFF',
'#FC3AC6',
'#7D26CD',
'#B33771',
]"
:is-new-design="true" :is-new-design="true"
class="nc-form-theme-color-picker !p-0 !-ml-1" class="nc-form-theme-color-picker !pb-0"
@input="handleChangeBackground" @input="handleChangeBackground"
/> />
</div> </div>

2
packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue

@ -50,7 +50,7 @@ const openedBaseUrl = computed(() => {
</template> </template>
<div class="flex flex-row items-center gap-x-1.5"> <div class="flex flex-row items-center gap-x-1.5">
<GeneralProjectIcon <GeneralProjectIcon
:meta="{ type: base?.type }" :type="base?.type"
class="!grayscale min-w-4" class="!grayscale min-w-4"
:style="{ :style="{
filter: 'grayscale(100%) brightness(115%)', filter: 'grayscale(100%) brightness(115%)',

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

@ -182,16 +182,16 @@ function onProjectTitleClick(index: number) {
} }
} }
const setColor = async (hue: number, base: BaseType) => { const setColor = async (color: string, base: BaseType) => {
try { try {
const meta = { const meta = {
...parseProp(base.meta), ...parseProp(base.meta),
iconHue: hue, iconColor: color,
} }
basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) }) basesStore.updateProject(base.id!, { meta: JSON.stringify(meta) })
$e('a:base:icon:color:navdraw', { iconHue: hue }) $e('a:base:icon:color:navdraw', { iconColor: color })
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
} }
@ -252,15 +252,12 @@ const setColor = async (hue: number, base: BaseType) => {
<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">
<GeneralBaseIconColorPicker <GeneralBaseIconColorPicker
:key="parseProp(record.meta).iconHue" :key="`${record.id}_${parseProp(record.meta).iconColor}`"
:hue="parseProp(record.meta).iconHue" :type="record?.type"
size="small" :model-value="parseProp(record.meta).iconColor"
readonly :readonly="(record?.type && record?.type !== 'database') || !isUIAllowed('baseRename')"
@color-selected="setColor($event, record)" @update:model-value="setColor($event, record)"
> >
<template #default>
<GeneralProjectIcon :type="record.type" />
</template>
</GeneralBaseIconColorPicker> </GeneralBaseIconColorPicker>
<!-- todo: replace with switch --> <!-- todo: replace with switch -->
</div> </div>

4
packages/nocodb/src/services/command-palette.service.ts

@ -29,7 +29,7 @@ export class CommandPaletteService {
id: `p-${base.id}`, id: `p-${base.id}`,
title: base.title, title: base.title,
icon: 'project', icon: 'project',
iconHue: deserializeJSON(base.meta)?.iconHue, iconColor: deserializeJSON(base.meta)?.iconColor,
section: 'Bases', section: 'Bases',
scopePayload: { scopePayload: {
scope: `p-${base.id}`, scope: `p-${base.id}`,
@ -72,7 +72,7 @@ export class CommandPaletteService {
id: `p-${b.id}`, id: `p-${b.id}`,
title: b.title, title: b.title,
icon: 'project', icon: 'project',
iconHue: deserializeJSON(b.meta)?.iconHue, iconColor: deserializeJSON(b.meta)?.iconColor,
section: 'Bases', section: 'Bases',
}); });
} }

Loading…
Cancel
Save