refactor code to nuxt and add ssr and edit some text in landing
This commit is contained in:
+20
-8
@@ -10,19 +10,24 @@ 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 : {}
|
||||
import { getConfig } from '@/config/app-config'
|
||||
|
||||
if (config) {
|
||||
return config[key]
|
||||
}
|
||||
return null
|
||||
export function getConfigApp(key: string) {
|
||||
return getConfig(key)
|
||||
}
|
||||
|
||||
/** Login URL در اپ اصلی */
|
||||
export function getLoginAppUrl() {
|
||||
const configured = import.meta.env.VITE_LOGIN_APP_URL
|
||||
const fallback = 'https://app.boursemes.com/home'
|
||||
let configured: unknown
|
||||
|
||||
try {
|
||||
configured = useRuntimeConfig().public.loginAppUrl
|
||||
} catch {
|
||||
configured =
|
||||
(import.meta as ImportMeta & { env?: Record<string, string> }).env?.NUXT_PUBLIC_LOGIN_APP_URL ||
|
||||
(import.meta as ImportMeta & { env?: Record<string, string> }).env?.VITE_LOGIN_APP_URL
|
||||
}
|
||||
|
||||
if (typeof configured !== 'string' || !configured.trim()) {
|
||||
return fallback
|
||||
@@ -34,7 +39,10 @@ export function getLoginAppUrl() {
|
||||
/** صفحه Login اپ اصلی با فلگ نصب PWA */
|
||||
export function getLoginInstallPwaUrl() {
|
||||
try {
|
||||
const origin = new URL(getLoginAppUrl(), window.location.origin).origin
|
||||
const loginUrl = getLoginAppUrl()
|
||||
const origin = import.meta.client
|
||||
? new URL(loginUrl, window.location.origin).origin
|
||||
: new URL(loginUrl).origin
|
||||
return `${origin}/login?installPwa=true`
|
||||
} catch {
|
||||
return 'https://app.boursemes.com/login?installPwa=true'
|
||||
@@ -202,6 +210,7 @@ export function getProjectSplashBackground() {
|
||||
}
|
||||
|
||||
export function resetAppSurfaceBackground() {
|
||||
if (!import.meta.client) return
|
||||
const background = '#ffffff'
|
||||
document.documentElement.style.backgroundColor = background
|
||||
document.body.style.backgroundColor = background
|
||||
@@ -217,11 +226,13 @@ export function getProjectFontFamily() {
|
||||
}
|
||||
|
||||
export function applyProjectFont() {
|
||||
if (!import.meta.client) return
|
||||
document.documentElement.style.setProperty('--App-font-family', getProjectFontFamily())
|
||||
document.documentElement.classList.add('font-dana')
|
||||
}
|
||||
|
||||
export function isTWA() {
|
||||
if (!import.meta.client) return false
|
||||
if (sessionStorage.getItem('appMode') === 'twa') return true
|
||||
if (document.referrer.startsWith('android-app://')) {
|
||||
sessionStorage.setItem('appMode', 'twa')
|
||||
@@ -231,6 +242,7 @@ export function isTWA() {
|
||||
}
|
||||
|
||||
export function applyProjectTheme() {
|
||||
if (!import.meta.client) return
|
||||
applyProjectFont()
|
||||
document.documentElement.classList.add('project-boursecu')
|
||||
document.documentElement.style.setProperty('--App-brand-nav', BOURSECU_BRAND_NAV)
|
||||
|
||||
Reference in New Issue
Block a user