diff --git a/packages/client/src/components/global/MkAd.vue b/packages/client/src/components/global/MkAd.vue index 0316a6bdf7..7fa0152663 100644 --- a/packages/client/src/components/global/MkAd.vue +++ b/packages/client/src/components/global/MkAd.vue @@ -56,10 +56,13 @@ const choseAd = (): Ad | null => { } const lowPriorityAds = ads.filter(ad => ad.ratio === 0); + const widgetAds = ads.filter(ad => ad.place === 'widget'); ads = ads.filter(ad => ad.ratio !== 0); - - if (ads.length === 0) { - if (lowPriorityAds.length !== 0) { + + if (widgetAds.length !== 0) { + return widgetAds; + } else if (ads.length === 0) { + if (lowPriorityAds.length !== 0) { return lowPriorityAds[Math.floor(Math.random() * lowPriorityAds.length)]; } else { return null; @@ -132,7 +135,7 @@ function reduceFrequency(): void { } } - &.square { + &.widget { > a , > a > img { max-width: min(300px, 100%); @@ -140,7 +143,7 @@ function reduceFrequency(): void { } } - &.horizontal { + &.inline { padding: 8px; > a , @@ -150,7 +153,7 @@ function reduceFrequency(): void { } } - &.horizontal-big { + &.inline-big { padding: 8px; > a , diff --git a/packages/client/src/pages/admin/promotions.vue b/packages/client/src/pages/admin/promotions.vue index 09b7bd5425..d2e57586e0 100644 --- a/packages/client/src/pages/admin/promotions.vue +++ b/packages/client/src/pages/admin/promotions.vue @@ -13,20 +13,12 @@ Form - square - horizontal - horizontal-big + widget + inline + inline-big - - + {{ i18n.ts.ratio }} @@ -56,23 +48,29 @@ import FormSplit from '@/components/form/split.vue'; import * as os from '@/os'; import { i18n } from '@/i18n'; import { definePageMetadata } from '@/scripts/page-metadata'; +import { formatDateTimeString } from '@/scripts/format-time-string'; let ads: any[] = $ref([]); os.api('admin/ad/list').then(adsResponse => { ads = adsResponse; + // The date format should be changed to yyyy-MM-dd in order to be properly displayed + for (let i in ads) { + ads[i].expiresAt = ads[i].expiresAt.substr(0, 10); + } }); function add() { + const tomorrow = formatDateTimeString(new Date(new Date().setDate(new Date().getDate() + 1)), 'yyyy-MM-dd'); ads.unshift({ id: null, memo: '', - place: 'square', + place: 'widget', priority: 'middle', ratio: 1, url: '', imageUrl: null, - expiresAt: null, + expiresAt: tomorrow, }); } diff --git a/packages/client/src/ui/classic.widgets.vue b/packages/client/src/ui/classic.widgets.vue index 04ca34b556..3ed838d9fe 100644 --- a/packages/client/src/ui/classic.widgets.vue +++ b/packages/client/src/ui/classic.widgets.vue @@ -1,11 +1,10 @@ - - - - - {{ i18n.ts.editWidgetsExit }} - {{ i18n.ts.editWidgets }} - + + + + {{ i18n.ts.editWidgetsExit }} + {{ i18n.ts.editWidgets }} +