Make boursecu branch boursecu-only and simplify app loading.
Remove multi-tenant branches and default views, show logo-only boot and splash screens, and polish boursecu transactions tab styling. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,13 +32,8 @@ const KATOD_DEVIATION_FACTOR = 200
|
||||
|
||||
/** نمودار boursecu وقتی metal_type = کاتد مس */
|
||||
export function shouldAmplifyKatodMesChart(options: {
|
||||
isBoursecu: boolean
|
||||
metalTypeSetting?: string | number | null
|
||||
}): boolean {
|
||||
if (!options.isBoursecu) {
|
||||
return false
|
||||
}
|
||||
|
||||
const metal = String(options.metalTypeSetting ?? '').trim()
|
||||
return metal === 'کاتد مس'
|
||||
}
|
||||
|
||||
+30
-123
@@ -9,14 +9,9 @@ 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'
|
||||
import bazretalaLoginLogo from '@/assets/img/bazretala-login-logo.png'
|
||||
import bazretalaNavLogo from '@/assets/img/bazretala-nav-logo.png'
|
||||
import bazretalaFundBg from '@/assets/img/bazretala-fund-bg.png'
|
||||
import bazretalaEmptyFund from '@/assets/img/bazretala-empty-fund.png'
|
||||
import soroushgoldLoginLogo from '@/assets/img/soroushgold-login-logo.png'
|
||||
|
||||
export function getConfigApp(key: string) {
|
||||
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user:{}
|
||||
const config = window.__APP_CONFIG__ ? window.__APP_CONFIG__.user : {}
|
||||
|
||||
if (config) {
|
||||
return config[key]
|
||||
@@ -24,32 +19,15 @@ export function getConfigApp(key: string) {
|
||||
return null
|
||||
}
|
||||
|
||||
/** boursecu-only branch */
|
||||
export function isBoursecuProject() {
|
||||
return getConfigApp('name') === 'boursecu'
|
||||
return true
|
||||
}
|
||||
|
||||
export function isBazretalaProject() {
|
||||
return getConfigApp('name') === 'bazretala'
|
||||
}
|
||||
|
||||
export function isSoroushgoldProject() {
|
||||
return getConfigApp('name') === 'soroushgold'
|
||||
}
|
||||
|
||||
export function isNiazitalaProject() {
|
||||
return getConfigApp('name') === 'niazitala'
|
||||
}
|
||||
|
||||
const DEFAULT_WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL = [10_000_000, 50_000_000, 100_000_000] as const
|
||||
|
||||
/** niazitala: 5 / 10 / 15 میلیون تومان — ذخیره و نمایش به ریال */
|
||||
const NIAZITALA_WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL = [50_000_000, 100_000_000, 150_000_000] as const
|
||||
const WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL = [10_000_000, 50_000_000, 100_000_000] as const
|
||||
|
||||
export function getWalletDepositQuickAmountsRial(): readonly number[] {
|
||||
if (isNiazitalaProject()) {
|
||||
return NIAZITALA_WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL
|
||||
}
|
||||
return DEFAULT_WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL
|
||||
return WALLET_DEPOSIT_QUICK_AMOUNTS_RIAL
|
||||
}
|
||||
|
||||
export function getBoursecuTransactionsIcon() {
|
||||
@@ -100,7 +78,7 @@ export function getBoursecuActionIconSrc(actionId: string): string | undefined {
|
||||
}
|
||||
|
||||
export function hasCustomLoginLogoLayout() {
|
||||
return isBoursecuProject() || isBazretalaProject()
|
||||
return true
|
||||
}
|
||||
|
||||
export const BOURSECU_BRAND_RED = '#bc3c3b'
|
||||
@@ -111,22 +89,21 @@ export const BOURSECU_COPPER_BG_LIGHT = '#fdf0e6'
|
||||
export const BOURSECU_COPPER_BG_GRADIENT = 'linear-gradient(135deg, #c98a4a 0%, #a86528 100%)'
|
||||
|
||||
export function getProjectBrandRed() {
|
||||
return isBoursecuProject() ? BOURSECU_BRAND_RED : null
|
||||
return BOURSECU_BRAND_RED
|
||||
}
|
||||
|
||||
/** رنگ accent تم از تنظیمات tenant — بدون override پروژهای */
|
||||
/** رنگ 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 || !isBoursecuProject()) {
|
||||
if (!color) {
|
||||
return color
|
||||
}
|
||||
|
||||
@@ -137,131 +114,66 @@ export function resolveProjectColor(color?: string | null) {
|
||||
return color
|
||||
}
|
||||
|
||||
/** لوگوی پنل برند لاگین دسکتاپ — فقط soroushgold لوگوی اختصاصی دارد */
|
||||
export function getProjectDesktopLoginBrandLogo(avatar?: string | null) {
|
||||
if (isSoroushgoldProject()) {
|
||||
return soroushgoldLoginLogo
|
||||
}
|
||||
return getProjectSplashLogo(avatar)
|
||||
export function getProjectDesktopLoginBrandLogo(_avatar?: string | null) {
|
||||
return getProjectSplashLogo()
|
||||
}
|
||||
|
||||
export function getProjectLoginLogo(avatar?: string | null) {
|
||||
if (isBoursecuProject()) {
|
||||
return boursecuLoginLogo
|
||||
}
|
||||
if (isBazretalaProject()) {
|
||||
return bazretalaLoginLogo
|
||||
}
|
||||
return avatar ?? getConfigApp('avatar')
|
||||
export function getProjectLoginLogo(_avatar?: string | null) {
|
||||
return boursecuLoginLogo
|
||||
}
|
||||
|
||||
/** لوگوی صفحه لودینگ اولیه — جدا از لوگوی لاگین/ناوبری */
|
||||
export function getProjectSplashLogo(avatar?: string | null) {
|
||||
if (isBoursecuProject()) {
|
||||
return boursecuSplashLogo
|
||||
}
|
||||
return getProjectLoginLogo(avatar)
|
||||
export function getProjectSplashLogo(_avatar?: string | null) {
|
||||
return boursecuSplashLogo
|
||||
}
|
||||
|
||||
export function getProjectNavLogo(avatar?: string | null) {
|
||||
if (isBazretalaProject()) {
|
||||
return bazretalaNavLogo
|
||||
}
|
||||
if (isBoursecuProject()) {
|
||||
return boursecuLogo
|
||||
}
|
||||
return avatar ?? getConfigApp('avatar')
|
||||
export function getProjectNavLogo(_avatar?: string | null) {
|
||||
return boursecuLogo
|
||||
}
|
||||
|
||||
/** لوگوی ناوبری موبایل — boursecu همان لوگوی لاگین (پسزمینه سفید) */
|
||||
export function getProjectMobileNavLogo(avatar?: string | null) {
|
||||
if (isBoursecuProject()) {
|
||||
return boursecuLoginLogo
|
||||
}
|
||||
if (isSoroushgoldProject()) {
|
||||
return soroushgoldLoginLogo
|
||||
}
|
||||
return getProjectNavLogo(avatar)
|
||||
export function getProjectMobileNavLogo(_avatar?: string | null) {
|
||||
return boursecuLoginLogo
|
||||
}
|
||||
|
||||
export const BAZRETALA_SUPPORT_PHONE = '09121784258'
|
||||
|
||||
export function getProjectSupportPhone() {
|
||||
if (isBazretalaProject()) {
|
||||
return BAZRETALA_SUPPORT_PHONE
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
export function getProjectSupportPhoneLink() {
|
||||
const phone = getProjectSupportPhone()
|
||||
return phone ? `tel:${phone}` : 'tel:'
|
||||
return 'tel:'
|
||||
}
|
||||
|
||||
export const BAZRETALA_BALE_ID = 'bazretala'
|
||||
|
||||
export function getProjectBaleLink() {
|
||||
if (isBazretalaProject()) {
|
||||
return `https://ble.ir/${BAZRETALA_BALE_ID}`
|
||||
}
|
||||
return 'https://ble.ir/'
|
||||
}
|
||||
|
||||
export function getProjectBaleContactLink() {
|
||||
if (getConfigApp('name') === 'garoosi') {
|
||||
return 'https://ble.ir/garoosiadmin'
|
||||
}
|
||||
return getProjectBaleLink()
|
||||
}
|
||||
|
||||
/** لینک دکمه «تماس با پشتیبانی» — bazretala به بله، garoosi تماس، بقیه تلفن پشتیبانی */
|
||||
export function getProjectSupportContactLink() {
|
||||
if (isBazretalaProject()) {
|
||||
return getProjectBaleLink()
|
||||
}
|
||||
if (getConfigApp('name') === 'garoosi') {
|
||||
return 'tel:09031265925'
|
||||
}
|
||||
return getProjectSupportPhoneLink()
|
||||
}
|
||||
|
||||
export function getProjectFundHeaderBackground(defaultBackground: string) {
|
||||
if (isBazretalaProject()) {
|
||||
return bazretalaFundBg
|
||||
}
|
||||
return defaultBackground
|
||||
}
|
||||
|
||||
export function getProjectFundEmptyImage(defaultImage: string) {
|
||||
if (isBazretalaProject()) {
|
||||
return bazretalaEmptyFund
|
||||
}
|
||||
return defaultImage
|
||||
}
|
||||
|
||||
export function getProjectFundEmptyText() {
|
||||
if (isBazretalaProject()) {
|
||||
return 'یک بذر جدید بکار!'
|
||||
}
|
||||
return 'یک گنج جدید بساز!'
|
||||
}
|
||||
|
||||
export function getProjectLoginTaglineLines() {
|
||||
if (!isBoursecuProject()) {
|
||||
return null
|
||||
}
|
||||
|
||||
return [
|
||||
'مرجع هوشمند معاملات',
|
||||
' و سرمایهگذاری در صنعت مس',
|
||||
]
|
||||
return ['مرجع هوشمند معاملات', ' و سرمایهگذاری در صنعت مس']
|
||||
}
|
||||
|
||||
export function getProjectSplashBackground() {
|
||||
return isBoursecuProject() ? BOURSECU_BRAND_NAV : '#ffffff'
|
||||
return BOURSECU_BRAND_NAV
|
||||
}
|
||||
|
||||
/** Reset splash-time inline backgrounds so mobile overscroll shows white again. */
|
||||
export function resetAppSurfaceBackground() {
|
||||
const background = '#ffffff'
|
||||
document.documentElement.style.backgroundColor = background
|
||||
@@ -274,30 +186,25 @@ export function resetAppSurfaceBackground() {
|
||||
}
|
||||
|
||||
export function getProjectFontFamily() {
|
||||
return getConfigApp('name') === 'boursecu' ? "'dana', sans-serif" : "'iran-sans', sans-serif"
|
||||
return "'dana', sans-serif"
|
||||
}
|
||||
|
||||
export function applyProjectFont() {
|
||||
document.documentElement.style.setProperty('--App-font-family', getProjectFontFamily())
|
||||
if (getConfigApp('name') === 'boursecu') {
|
||||
document.documentElement.classList.add('font-dana')
|
||||
}
|
||||
document.documentElement.classList.add('font-dana')
|
||||
}
|
||||
|
||||
export function isTWA() {
|
||||
if (sessionStorage.getItem('appMode') === 'twa') return true;
|
||||
if (sessionStorage.getItem('appMode') === 'twa') return true
|
||||
if (document.referrer.startsWith('android-app://')) {
|
||||
sessionStorage.setItem('appMode', 'twa');
|
||||
return true;
|
||||
sessionStorage.setItem('appMode', 'twa')
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
|
||||
export function applyProjectTheme() {
|
||||
applyProjectFont()
|
||||
|
||||
if (!isBoursecuProject()) {
|
||||
return
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -76,14 +76,7 @@ export function resolveBoursecuAssetMetalTotals(
|
||||
return ordered
|
||||
}
|
||||
|
||||
export function resolveMetalAssetsDisplayLabel(
|
||||
metal: WalletMetalTotal,
|
||||
isBoursecuLayout: boolean
|
||||
): string {
|
||||
if (!isBoursecuLayout) {
|
||||
return metal.label
|
||||
}
|
||||
|
||||
export function resolveMetalAssetsDisplayLabel(metal: WalletMetalTotal): string {
|
||||
switch (metal.metal_id) {
|
||||
case METAL_COPPER:
|
||||
return 'دارایی مس'
|
||||
@@ -121,7 +114,7 @@ export function formatBoursecuMetalModalText(metal: WalletMetalTotal): string {
|
||||
case METAL_SILVER:
|
||||
return 'دارایی نقره = موجودی نقره'
|
||||
default:
|
||||
return `${resolveMetalAssetsDisplayLabel(metal, true)} = موجودی ${metal.label}`
|
||||
return `${resolveMetalAssetsDisplayLabel(metal)} = موجودی ${metal.label}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { SelectItem } from '@/models/SelectItem'
|
||||
import type { Product } from '@/models/products'
|
||||
import type { WalletInventoryCard } from '@/models/walletAssets'
|
||||
import { isBoursecuProject } from '@/utils/config'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import {
|
||||
isLegacyMaftolGroup,
|
||||
@@ -25,10 +24,6 @@ export const BOURSECU_GROUP_MAFTOL = LEGACY_GROUP_MAFTOL
|
||||
export const BOURSECU_WALLET_LABEL_GENERIC = 'موجودی کیف'
|
||||
|
||||
export function isBoursecuDealProductGroup(groupType?: string | null) {
|
||||
if (!isBoursecuProject()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const group = normalizeProductGroupType(groupType)
|
||||
return group === BOURSECU_GROUP_MAFTOL
|
||||
|| group === BOURSECU_GROUP_KATOD
|
||||
@@ -38,7 +33,7 @@ export function isBoursecuDealProductGroup(groupType?: string | null) {
|
||||
|
||||
export function isMaftolMesGroup(groupType?: string | null) {
|
||||
const group = normalizeProductGroupType(groupType)
|
||||
return group === BOURSECU_GROUP_MAFTOL || (isBoursecuProject() && group === 'مس')
|
||||
return group === BOURSECU_GROUP_MAFTOL || group === 'مس'
|
||||
}
|
||||
|
||||
export function isKatodMesGroup(groupType?: string | null) {
|
||||
@@ -46,10 +41,6 @@ export function isKatodMesGroup(groupType?: string | null) {
|
||||
}
|
||||
|
||||
export function isShamshMesGroup(groupType?: string | null, title?: string | null) {
|
||||
if (!isBoursecuProject()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const group = normalizeProductGroupType(groupType)
|
||||
if (group === 'شمش') {
|
||||
return true
|
||||
@@ -115,11 +106,9 @@ export function getProductWeightUnit(product?: ProductUnitSource | null) {
|
||||
return unit
|
||||
}
|
||||
|
||||
if (isBoursecuProject()) {
|
||||
const group = normalizeProductGroupType(product?.group_type)
|
||||
if (group === BOURSECU_GROUP_MAFTOL || group === BOURSECU_GROUP_KATOD || group === BOURSECU_GROUP_ABSHODE || group === 'مس' || isMeltedTradeGroup(group)) {
|
||||
return getWeightUnit()
|
||||
}
|
||||
const group = normalizeProductGroupType(product?.group_type)
|
||||
if (group === BOURSECU_GROUP_MAFTOL || group === BOURSECU_GROUP_KATOD || group === BOURSECU_GROUP_ABSHODE || group === 'مس' || isMeltedTradeGroup(group)) {
|
||||
return getWeightUnit()
|
||||
}
|
||||
|
||||
if (!isCountBasedProduct(product) || isMeltedTradeGroup(product?.group_type)) {
|
||||
@@ -209,7 +198,7 @@ export function isCountBasedProduct(product?: ProductUnitSource | null) {
|
||||
}
|
||||
|
||||
const group = normalizeProductGroupType(product.group_type)
|
||||
if (group === BOURSECU_GROUP_MAFTOL || isLegacyMaftolGroup(group) || (isBoursecuProject() && group === 'مس')) {
|
||||
if (group === BOURSECU_GROUP_MAFTOL || isLegacyMaftolGroup(group) || group === 'مس') {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -407,10 +396,6 @@ export function getProductDealMethodOptions(
|
||||
): SelectItem[] {
|
||||
const settingsStore = useSettingsStore()
|
||||
|
||||
if (!isBoursecuProject()) {
|
||||
return getDefaultTypeDealOptions(context, isBuy)
|
||||
}
|
||||
|
||||
if (isMaftolMesGroup(groupType)) {
|
||||
if (isBuy) {
|
||||
return [
|
||||
@@ -518,10 +503,6 @@ export function getBoursecuMetalWalletLabel(groupType?: string | null) {
|
||||
}
|
||||
|
||||
export function getGoldWalletLabel(groupType?: string | null) {
|
||||
if (!isBoursecuProject()) {
|
||||
return getMainMetalWalletLabel()
|
||||
}
|
||||
|
||||
const group = normalizeProductGroupType(groupType)
|
||||
if (group === BOURSECU_GROUP_MAFTOL
|
||||
|| group === BOURSECU_GROUP_KATOD
|
||||
@@ -575,7 +556,7 @@ export function formatCashWalletBalanceText(cashFormatted: string | number, grou
|
||||
|
||||
/** برچسب کیف فلزی متناسب با نحوه پرداخت (مثلاً کاتد مس برای خرید مفتول با کیف کاتد) */
|
||||
export function getMetalWalletLabelForDealMethod(method?: string | null, groupType?: string | null) {
|
||||
if (!isBoursecuProject() || method === 'katod') {
|
||||
if (method === 'katod') {
|
||||
return getMainMetalWalletLabel()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user