Browse Source

fix: project list color badge

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/3481/head
mertmit 2 years ago committed by Raju Udava
parent
commit
da3127fc44
  1. 1
      packages/nc-gui-v2/pages/[projectType]/[projectId]/index.vue
  2. 19
      packages/nc-gui-v2/pages/index/index/index.vue

1
packages/nc-gui-v2/pages/[projectType]/[projectId]/index.vue

@ -17,7 +17,6 @@ import {
useProject, useProject,
useRoute, useRoute,
useTabs, useTabs,
useTheme,
useUIPermission, useUIPermission,
} from '#imports' } from '#imports'
import { TabType } from '~/composables' import { TabType } from '~/composables'

19
packages/nc-gui-v2/pages/index/index/index.vue

@ -83,8 +83,25 @@ const handleProjectColor = async (projectId: string, color: string) => {
}, },
}), }),
}) })
// Update local project
const localProject = projects.value?.find((p) => p.id === projectId)
if (localProject) {
localProject.color = color
localProject.meta = JSON.stringify({
...meta,
theme: {
primaryColor: color,
accentColor: complement.toHex8String(),
},
})
}
} }
} }
const getProjectPrimary = (project: ProjectType) => {
const meta = project?.meta && typeof project.meta === 'string' ? JSON.parse(project.meta) : project.meta || {}
return meta?.theme?.primaryColor || themeV2Colors['royal-blue'].DEFAULT
}
</script> </script>
<template> <template>
@ -192,7 +209,7 @@ const handleProjectColor = async (projectId: string, color: string) => {
<div <div
class="color-selector" class="color-selector"
:style="{ :style="{
'background-color': record.color || themeV2Colors['royal-blue'].DEFAULT, 'background-color': getProjectPrimary(record),
'width': '8px', 'width': '8px',
'height': '100%', 'height': '100%',
}" }"

Loading…
Cancel
Save