fix banner and chart color
This commit is contained in:
@@ -276,10 +276,6 @@
|
||||
var tenantSecondary = normalizeHex(user.secondary_color)
|
||||
var tenantBackground = normalizeHex(user.background_color)
|
||||
|
||||
if (user.name === 'boursecu') {
|
||||
tenantColor = '#2178b5'
|
||||
}
|
||||
|
||||
/**
|
||||
* مهم:
|
||||
* background_color بکگراند اپ است.
|
||||
|
||||
@@ -5,7 +5,7 @@ import { startPwaManifest } from '@/modules/pwa/manifest'
|
||||
import { createVueApp } from '@/app/createApp'
|
||||
import { setupRouterGuards } from '@/app/setupRouter'
|
||||
import router from '@/router'
|
||||
import { applyProjectTheme, isBoursecuProject } from '@/utils/config'
|
||||
import { applyProjectTheme } from '@/utils/config'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
import { getToken } from '@/utils'
|
||||
@@ -71,7 +71,7 @@ function applyTenantThemeVars() {
|
||||
const secondaryColor = window.__APP_CONFIG__?.user?.secondary_color
|
||||
const backgroundColor = window.__APP_CONFIG__?.user?.background_color
|
||||
|
||||
if (color && !isBoursecuProject()) {
|
||||
if (color) {
|
||||
document.documentElement.style.setProperty('--App-primary-color', color)
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,11 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
if (value == null) {
|
||||
return false
|
||||
}
|
||||
return value === true || String(value).toLowerCase() === 'true'
|
||||
if (value === true) {
|
||||
return true
|
||||
}
|
||||
const normalized = String(value).trim().toLowerCase()
|
||||
return normalized === 'true' || normalized === '1' || normalized === 'yes'
|
||||
}
|
||||
|
||||
function mergeSettings(items?: AppSetting[] | null) {
|
||||
|
||||
+6
-6
@@ -93,16 +93,17 @@ export function getProjectBrandRed() {
|
||||
return isBoursecuProject() ? BOURSECU_BRAND_RED : null
|
||||
}
|
||||
|
||||
/** رنگ اصلی دکمهها و چارت — boursecu ثابت آبی، بقیه از تنظیمات tenant */
|
||||
/** رنگ accent تم از تنظیمات tenant — بدون override پروژهای */
|
||||
export function getProjectPrimaryColor() {
|
||||
if (isBoursecuProject()) {
|
||||
return BOURSECU_BRAND_BLUE
|
||||
}
|
||||
|
||||
const color = getConfigApp('color')
|
||||
return color != null ? String(color) : undefined
|
||||
}
|
||||
|
||||
/** فقط رنگ خط/ناحیه نمودار قیمت در بورس مس */
|
||||
export function getBoursecuChartColor() {
|
||||
return BOURSECU_BRAND_BLUE
|
||||
}
|
||||
|
||||
export function resolveProjectColor(color?: string | null) {
|
||||
if (!color || !isBoursecuProject()) {
|
||||
return color
|
||||
@@ -266,7 +267,6 @@ export function applyProjectTheme() {
|
||||
}
|
||||
|
||||
document.documentElement.classList.add('project-boursecu')
|
||||
document.documentElement.style.setProperty('--App-primary-color', BOURSECU_BRAND_BLUE)
|
||||
document.documentElement.style.setProperty('--App-brand-nav', BOURSECU_BRAND_NAV)
|
||||
document.documentElement.style.setProperty('--App-brand-red', BOURSECU_BRAND_RED)
|
||||
document.documentElement.style.setProperty('--App-brand-red-50', '#f8ecec')
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||
import { useConfigStore } from '@/store/configStore'
|
||||
import { usePrice } from '@/utils/usePrice'
|
||||
import { getProjectFontFamily, getProjectPrimaryColor } from '@/utils/config'
|
||||
import { getBoursecuChartColor, getProjectFontFamily } from '@/utils/config'
|
||||
import {
|
||||
computeKatodMesVisualYBounds,
|
||||
prepareKatodMesChartPoints,
|
||||
@@ -101,6 +101,14 @@ const chartInnerClass = computed(() =>
|
||||
|
||||
const showMetalSelector = computed(() => props.layout === 'boursecu')
|
||||
|
||||
const chartColor = computed(() => {
|
||||
if (props.layout === 'boursecu') {
|
||||
return getBoursecuChartColor()
|
||||
}
|
||||
|
||||
return config.config?.color ?? '#0A1B37'
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
updateData: [timeline: string]
|
||||
'update:selectedMetal': [metal: ChartMetalType]
|
||||
@@ -295,7 +303,7 @@ const chartOptions = computed(() => {
|
||||
}),
|
||||
style: { fontFamily },
|
||||
},
|
||||
colors: [getProjectPrimaryColor() ?? config.config?.color ?? '#2178b5'],
|
||||
colors: [chartColor.value],
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ref } from 'vue'
|
||||
import { getConstByKey } from '@/api/const'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
|
||||
function parseJsonArray(raw: unknown): unknown[] {
|
||||
if (raw == null || raw === '') {
|
||||
@@ -30,6 +31,13 @@ let bannersPromise: Promise<void> | null = null
|
||||
let bannersLoaded = false
|
||||
|
||||
async function fetchBanners(force = false) {
|
||||
const settingsStore = useSettingsStore()
|
||||
if (!settingsStore.isSettingTruthy('banner_enabled')) {
|
||||
banners.value = []
|
||||
bannersLoaded = true
|
||||
return
|
||||
}
|
||||
|
||||
if (!force && bannersLoaded) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user