From 4d8af8bc0e57e7c404f6488a608deb24cb1e1214 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 28 May 2025 17:59:39 +0800 Subject: [PATCH] add ad --- src/components/ad/AdBanner.vue | 16 ++++++- src/components/ad/ad.ts | 56 ------------------------ src/layouts/components/DefaultLayout.vue | 10 ++++- src/modules/[chain]/index.vue | 2 - src/pages/index.vue | 2 - 5 files changed, 24 insertions(+), 62 deletions(-) delete mode 100644 src/components/ad/ad.ts diff --git a/src/components/ad/AdBanner.vue b/src/components/ad/AdBanner.vue index 7b8b46cb..278079ff 100644 --- a/src/components/ad/AdBanner.vue +++ b/src/components/ad/AdBanner.vue @@ -1,3 +1,17 @@ + diff --git a/src/components/ad/ad.ts b/src/components/ad/ad.ts deleted file mode 100644 index 5ede5d9b..00000000 --- a/src/components/ad/ad.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { PersonaAdSDK } from '@personaxyz/ad-sdk'; - -interface ADConfig { - apiKey: string; - environment: string; -} - -export const confs: Record = { - "localhost": { - apiKey: 'XXXX_api_key_staging_XXXX', // An actual API key is generated once you register an app with us. - environment: 'staging', // use value 'production' when going live - }, - "ping.pub": { - apiKey: 'persona-pub-0x6ca028de83d9bc438bb3fd7f9620f36b', - environment: 'production', - }, - "testnet.ping.pub": { - apiKey: 'persona-pub-0x14e9ba8ca5a658ba409fc0059ebc3711', - environment: 'production', - } -} - - -export const UNITS: Record> = { - "localhost": { - "banner": "3a094192-4c7b-4761-a50c-bd9b6a67e987", - "banner_mobile": "e6b82a11-6a94-46c0-a9d2-cf730159a5e6", - "popup": "e6b82a11-6a94-46c0-a9d2-cf730159a5e6" - }, - "ping.pub": { - "banner": "6883877a-ccae-4a08-b457-7e30b3465a8c", - "banner_mobile": "a95c6b55-5e2a-49eb-8993-a488513b2d10", - }, - "testnet.ping.pub": { - "banner": "1644951b-5022-4544-8a85-11aef8a8f645", - "banner_mobile": "81e0527f-475a-42a4-bb9a-ed9967c5d06f", - "popup": "bd77a47c-30fc-4592-9d37-616d4f66964d", - "popup_mobile": "bd77a47c-30fc-4592-9d37-616d4f66964d" - }, - -} - -export function getClient() { - const conf = confs[location.hostname] - if(conf) { - const sdk = new PersonaAdSDK(conf) - return sdk.getClient() - } -} - -export function getUnit(ad: string): string | undefined { - const ads = UNITS[location.hostname] - if(ads) { - return window.innerWidth > 600 ? ads[ad] : ads[`${ad}_mobile`] - } -} diff --git a/src/layouts/components/DefaultLayout.vue b/src/layouts/components/DefaultLayout.vue index 845a8c45..2c166491 100644 --- a/src/layouts/components/DefaultLayout.vue +++ b/src/layouts/components/DefaultLayout.vue @@ -16,6 +16,7 @@ import NavBarI18n from './NavBarI18n.vue'; import NavBarWallet from './NavBarWallet.vue'; import type { NavGroup, NavLink, NavSectionTitle, VerticalNavItems } from '../types'; import dayjs from 'dayjs'; +import AdBanner from '@/components/ad/AdBanner.vue'; const dashboard = useDashboard(); dashboard.initial(); @@ -70,6 +71,10 @@ const behind = computed(() => { dayjs() +const show_ad = computed(() => { + return location.hostname.indexOf('ping.pub') > 0 +}) +