Files
boursecu_user/src/utils/config.ts
T

220 lines
6.0 KiB
TypeScript

import boursecuLogo from '@/assets/img/boursemes_logofull.png'
import boursecuSplashLogo from '@/assets/img/boursemes-splash.png'
import boursecuLoginLogo from '@/assets/img/boursemes-login.png'
import boursecuTransactionsIcon from '@/assets/img/boursecu-transactions-icon.png'
import boursecuPhysicalReceiveIcon from '@/assets/img/boursecu-physical-receive-icon.png'
import boursecuConvertIcon from '@/assets/img/boursecu-convert-icon.png'
import boursecuWalletIcon from '@/assets/img/boursecu-wallet-icon.png'
import boursecuBuySellIcon from '@/assets/img/boursecu-buy-sell-icon.png'
import boursecuAssetsIcon from '@/assets/img/boursecu-assets-icon.png'
import boursecuHomeIcon from '@/assets/img/boursecu-home-icon.png'
import boursecuSettingsIcon from '@/assets/img/boursecu-settings-icon.png'
export function getConfigApp(key: string) {
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user : {}
if (config) {
return config[key]
}
return null
}
/** boursecu-only branch */
export function isBoursecuProject() {
return true
}
/** فقط برای سازگاری با منطق پشتیبانی modular — در boursecu همیشه false */
export function isBazretalaProject() {
return false
}
const WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL = [10_000_000, 50_000_000, 100_000_000] as const
export function getWalletDepositQuickAmountsRial(): readonly number[] {
return WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL
}
export function getBoursecuTransactionsIcon() {
return boursecuTransactionsIcon
}
export function getBoursecuPhysicalReceiveIcon() {
return boursecuPhysicalReceiveIcon
}
export function getBoursecuConvertIcon() {
return boursecuConvertIcon
}
export function getBoursecuWalletIcon() {
return boursecuWalletIcon
}
export function getBoursecuBuySellIcon() {
return boursecuBuySellIcon
}
export function getBoursecuAssetsIcon() {
return boursecuAssetsIcon
}
export function getBoursecuHomeIcon() {
return boursecuHomeIcon
}
export function getBoursecuSettingsIcon() {
return boursecuSettingsIcon
}
export function getBoursecuActionIconSrc(actionId: string): string | undefined {
const icons: Record<string, string> = {
buySell: boursecuBuySellIcon,
wallet: boursecuWalletIcon,
assets: boursecuAssetsIcon,
transactions: boursecuTransactionsIcon,
physicalReceive: boursecuPhysicalReceiveIcon,
convert: boursecuConvertIcon,
home: boursecuHomeIcon,
settings: boursecuSettingsIcon,
}
return icons[actionId]
}
export function hasCustomLoginLogoLayout() {
return true
}
export const BOURSECU_BRAND_RED = '#bc3c3b'
export const BOURSECU_BRAND_BLUE = '#2178b5'
export const BOURSECU_BRAND_NAV = '#133050'
export const BOURSECU_COPPER_BG = '#b87333'
export const BOURSECU_COPPER_BG_LIGHT = '#fdf0e6'
export const BOURSECU_COPPER_BG_GRADIENT = 'linear-gradient(135deg, #c98a4a 0%, #a86528 100%)'
export function getProjectBrandRed() {
return BOURSECU_BRAND_RED
}
/** رنگ accent تم از تنظیمات tenant */
export function getProjectPrimaryColor() {
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) {
return color
}
if (color === 'red' || color.startsWith('red-')) {
return BOURSECU_BRAND_RED
}
return color
}
export function getProjectDesktopLoginBrandLogo(_avatar?: string | null) {
return getProjectSplashLogo()
}
export function getProjectLoginLogo(_avatar?: string | null) {
return boursecuLoginLogo
}
export function getProjectSplashLogo(_avatar?: string | null) {
return boursecuSplashLogo
}
export function getProjectNavLogo(_avatar?: string | null) {
return boursecuLogo
}
export function getProjectMobileNavLogo(_avatar?: string | null) {
return boursecuLoginLogo
}
export function getProjectSupportPhone() {
return ''
}
export function getProjectSupportPhoneLink() {
return 'tel:'
}
export function getProjectBaleLink() {
return 'https://ble.ir/'
}
export function getProjectBaleContactLink() {
return getProjectBaleLink()
}
export function getProjectSupportContactLink() {
return getProjectSupportPhoneLink()
}
export function getProjectFundHeaderBackground(defaultBackground: string) {
return defaultBackground
}
export function getProjectFundEmptyImage(defaultImage: string) {
return defaultImage
}
export function getProjectFundEmptyText() {
return 'یک گنج جدید بساز!'
}
export function getProjectLoginTaglineLines() {
return ['مرجع هوشمند معاملات', ' و سرمایه‌گذاری در صنعت مس']
}
export function getProjectSplashBackground() {
return BOURSECU_BRAND_NAV
}
export function resetAppSurfaceBackground() {
const background = '#ffffff'
document.documentElement.style.backgroundColor = background
document.body.style.backgroundColor = background
const metaTheme = document.querySelector('meta[name="theme-color"]')
if (metaTheme) {
metaTheme.setAttribute('content', background)
}
}
export function getProjectFontFamily() {
return "'dana', sans-serif"
}
export function applyProjectFont() {
document.documentElement.style.setProperty('--App-font-family', getProjectFontFamily())
document.documentElement.classList.add('font-dana')
}
export function isTWA() {
if (sessionStorage.getItem('appMode') === 'twa') return true
if (document.referrer.startsWith('android-app://')) {
sessionStorage.setItem('appMode', 'twa')
return true
}
return false
}
export function applyProjectTheme() {
applyProjectFont()
document.documentElement.classList.add('project-boursecu')
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')
document.documentElement.style.setProperty('--App-brand-red-100', '#f0d8d8')
document.documentElement.style.setProperty('--App-brand-red-700', '#963130')
}