change condition of display banner
This commit is contained in:
@@ -24,6 +24,14 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
return item?.value ?? null
|
||||
}
|
||||
|
||||
function isSettingTruthy(key: string) {
|
||||
const value = getSettingByKey(key)
|
||||
if (value == null) {
|
||||
return false
|
||||
}
|
||||
return value === true || String(value).toLowerCase() === 'true'
|
||||
}
|
||||
|
||||
function mergeSettings(items?: AppSetting[] | null) {
|
||||
if (!items?.length) {
|
||||
return
|
||||
@@ -73,6 +81,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
fetchSettings,
|
||||
mergeSettings,
|
||||
getSettingByKey,
|
||||
isSettingTruthy,
|
||||
metalTypeSettingValue,
|
||||
metalTypeLabel,
|
||||
meltedGoldLabel,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
resolveAssetsRialValue,
|
||||
} from '@/utils/productAssets'
|
||||
import { useConfigStore } from '@/store/configStore'
|
||||
import { useSettingsStore } from '@/store/settingsStore'
|
||||
import { getTradeBuyPrice, lastPrice, stopLastPricePolling } from '@/utils/price'
|
||||
import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
|
||||
import { message, Modal } from 'ant-design-vue'
|
||||
@@ -30,6 +31,7 @@ import { resetProductsPageData } from '../../products/composables/useProductsPag
|
||||
export interface HomePageContext {
|
||||
homePageLoading: ReturnType<typeof useHomePageLoading>['homePageLoading']
|
||||
isGaroosi: ReturnType<typeof computed<boolean>>
|
||||
bannerEnabled: ReturnType<typeof computed<boolean>>
|
||||
limitedPrice: ReturnType<typeof computed>
|
||||
showClosedMessage: ReturnType<typeof computed<boolean>>
|
||||
closedMessage: ReturnType<typeof computed>
|
||||
@@ -57,6 +59,7 @@ export function useHomePage() {
|
||||
const userStore = useUserStore()
|
||||
const walletStore = useWalletStore()
|
||||
const configStore = useConfigStore()
|
||||
const settingsStore = useSettingsStore()
|
||||
const { assetsSummary, clearWalletAssets } = useWalletAssets()
|
||||
|
||||
const showLogoutConfirm = ref(false)
|
||||
@@ -77,6 +80,7 @@ export function useHomePage() {
|
||||
const isBoursecuHomeLayout = computed(() => getHomeLayoutId() === 'boursecu')
|
||||
|
||||
const isGaroosi = computed(() => configStore.config?.name === 'garoosi')
|
||||
const bannerEnabled = computed(() => settingsStore.isSettingTruthy('banner_enabled'))
|
||||
const closedMessage = computed(() => userStore.getValueByKey('closed_message'))
|
||||
const marketClosedText = computed(() => {
|
||||
if (!isStoreClosed()) return ''
|
||||
@@ -227,6 +231,7 @@ export function useHomePage() {
|
||||
const context: HomePageContext = {
|
||||
homePageLoading,
|
||||
isGaroosi,
|
||||
bannerEnabled,
|
||||
limitedPrice,
|
||||
showClosedMessage,
|
||||
closedMessage: marketClosedText,
|
||||
|
||||
@@ -9,7 +9,7 @@ const ctx = inject(HOME_PAGE_CONTEXT_KEY)!
|
||||
|
||||
<template>
|
||||
<DesktopHomeSection
|
||||
v-if="ctx.isGaroosi.value && ctx.banners.value?.length"
|
||||
v-if="ctx.bannerEnabled.value && ctx.banners.value?.length"
|
||||
title="بنرها"
|
||||
>
|
||||
<BannerSlider
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<Vue3Odometer
|
||||
:value="displayGoldVal"
|
||||
class="dhome-hero-price__odometer o-text"
|
||||
style="font-family: iran-sans"
|
||||
/>
|
||||
<span class="dhome-hero-price__unit">ریال</span>
|
||||
</div>
|
||||
|
||||
@@ -632,7 +632,7 @@ import BasicButton from "@/components/BasicPacks/BasicButton.vue";
|
||||
const bannerSwiperModules = [Autoplay, Pagination]
|
||||
const nameProject = useConfigStore().config.name
|
||||
const settingsStore = useSettingsStore()
|
||||
const bannerEnabled = computed(() => settingsStore.getSettingByKey('banner_enabled') === 'true')
|
||||
const bannerEnabled = computed(() => settingsStore.isSettingTruthy('banner_enabled'))
|
||||
const userStore = useUserStore()
|
||||
const walletStore = useWalletStore()
|
||||
const wholeBalanceVisible = ref<boolean>(false)
|
||||
|
||||
@@ -8,7 +8,7 @@ const ctx = inject(HOME_PAGE_CONTEXT_KEY)!
|
||||
|
||||
<template>
|
||||
<BannerSlider
|
||||
v-if="ctx.isGaroosi.value && ctx.banners.value?.length"
|
||||
v-if="ctx.bannerEnabled.value && ctx.banners.value?.length"
|
||||
:banners="ctx.banners.value"
|
||||
@bannerClick="ctx.handleBannerClick"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user