Browse Source

fix(gui-v2): set accent color after updating meta successfully

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3456/head
Pranav C 2 years ago
parent
commit
808b4cffcb
  1. 11
      packages/nc-gui-v2/pages/[projectType]/[projectId]/index.vue

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

@ -91,21 +91,25 @@ const themeAccentColor = ref<any>(theme.value.accentColor)
const { t } = useI18n() const { t } = useI18n()
// Chrome provides object so if custom picker used we only edit primary otherwise use complement as accent // Chrome provides object so if custom picker used we only edit primary otherwise use complement as accent
watch(themePrimaryColor, (nextColor) => { watch(themePrimaryColor, async (nextColor) => {
const hexColor = nextColor.hex8 ? nextColor.hex8 : nextColor const hexColor = nextColor.hex8 ? nextColor.hex8 : nextColor
const tcolor = tinycolor(hexColor) const tcolor = tinycolor(hexColor)
if (tcolor) { if (tcolor) {
const complement = tcolor.complement() const complement = tcolor.complement()
themeAccentColor.value = nextColor.hex8 ? theme.value.accentColor : complement.toHex8String() await saveTheme({
saveTheme({
primaryColor: hexColor, primaryColor: hexColor,
accentColor: themeAccentColor.value, accentColor: themeAccentColor.value,
}) })
themeAccentColor.value = nextColor.hex8 ? theme.value.accentColor : complement.toHex8String()
} }
}) })
watch(themeAccentColor, (nextColor) => { watch(themeAccentColor, (nextColor) => {
const hexColor = nextColor.hex8 ? nextColor.hex8 : nextColor const hexColor = nextColor.hex8 ? nextColor.hex8 : nextColor
// skip if the color is same as saved
if (hexColor === theme.value.accentColor) return
saveTheme({ saveTheme({
primaryColor: theme.value.primaryColor, primaryColor: theme.value.primaryColor,
accentColor: hexColor, accentColor: hexColor,
@ -137,7 +141,6 @@ const copyProjectInfo = async () => {
const copyAuthToken = async () => { const copyAuthToken = async () => {
try { try {
await copy(token.value!) await copy(token.value!)
// Copied to clipboard // Copied to clipboard
message.info(t('msg.info.copiedToClipboard')) message.info(t('msg.info.copiedToClipboard'))
} catch (e: any) { } catch (e: any) {

Loading…
Cancel
Save