diff --git a/components/filters/filters.vue b/components/filters/filters.vue index dd6180d..c82ce72 100644 --- a/components/filters/filters.vue +++ b/components/filters/filters.vue @@ -451,7 +451,7 @@ function toggleFilters(state) { display: flex; &.close { - background: var(--grey-light-40); + background: var(--background-base-20); position: relative; right: 0; } diff --git a/pages/entities/@entitySlug/+Page.vue b/pages/entities/@entitySlug/+Page.vue index 381cbcf..bb8731f 100644 --- a/pages/entities/@entitySlug/+Page.vue +++ b/pages/entities/@entitySlug/+Page.vue @@ -119,6 +119,7 @@ const scrollable = computed(() => children.value?.scrollWidth > children.value?. .page { display: flex; flex-direction: column; + flex-grow: 1; } .content { diff --git a/pages/entities/@entitySlug/+onBeforeRender.js b/pages/entities/@entitySlug/+onBeforeRender.js index 044e58c..47f57d4 100644 --- a/pages/entities/@entitySlug/+onBeforeRender.js +++ b/pages/entities/@entitySlug/+onBeforeRender.js @@ -45,7 +45,7 @@ export async function onBeforeRender(pageContext) { parentEntityId: entity.parent?.id, minRatio: 1.5, }, - ]); + ], { tagFilter: pageContext.tagFilter }); const { scenes, diff --git a/pages/updates/+onBeforeRender.js b/pages/updates/+onBeforeRender.js index 6717c02..ddf1dca 100644 --- a/pages/updates/+onBeforeRender.js +++ b/pages/updates/+onBeforeRender.js @@ -23,7 +23,7 @@ export async function onBeforeRender(pageContext) { { minRatio: 1.5 }, { minRatio: 0.75, maxRatio: 1.25 }, { minRatio: 1.5 }, - ]), + ], { tagFilter: pageContext.tagFilter }), ]); const { diff --git a/src/campaigns.js b/src/campaigns.js index 6eb5745..7cbd061 100644 --- a/src/campaigns.js +++ b/src/campaigns.js @@ -23,11 +23,7 @@ function curateCampaign(campaign) { height: campaign.banner.height, ratio: campaign.banner.ratio, entity: campaign.banner_entity && curateEntity({ ...campaign.banner_entity, parent: campaign.banner_parent_entity }), - tags: campaign.banner_tags?.map((tag) => ({ - id: tag.id, - slug: tag.slug, - name: tag.name, - })) || [], + tags: campaign.banner_tags || [], }, affiliate: campaign.affiliate && { id: campaign.affiliate.id, @@ -37,7 +33,7 @@ function curateCampaign(campaign) { }; } -export async function getRandomCampaign(options = {}) { +export async function getRandomCampaign(options = {}, context = {}) { const campaigns = options.campaigns || await redis.hGetAll('traxxx:campaigns').then((rawCampaigns) => Object.values(rawCampaigns).map((rawCampaign) => JSON.parse(rawCampaign))); @@ -54,6 +50,10 @@ export async function getRandomCampaign(options = {}) { return false; } + if (context.tagFilter && campaign.banner && campaign.banner.tags.some((tag) => context.tagFilter.includes(tag))) { + return false; + } + return true; }); @@ -70,14 +70,14 @@ export async function getRandomCampaign(options = {}) { return null; } -export async function getRandomCampaigns(allOptions = []) { +export async function getRandomCampaigns(allOptions = [], context = {}) { const rawCampaigns = await redis.hGetAll('traxxx:campaigns'); const campaigns = Object.values(rawCampaigns).map((rawCampaign) => JSON.parse(rawCampaign)); return Promise.all(allOptions.map(async (options) => getRandomCampaign({ ...options, campaigns, - }))); + }, context))); } export async function cacheCampaigns() { diff --git a/static b/static index 24d1136..6289c5f 160000 --- a/static +++ b/static @@ -1 +1 @@ -Subproject commit 24d11363ef7632591ec6f49240079259f777ab9e +Subproject commit 6289c5ff5707aac96d306f29805c322393164d3a