Expanded and improved campaigns.
This commit is contained in:
parent
41d6324c28
commit
22e0a331a3
|
@ -451,7 +451,7 @@ function toggleFilters(state) {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&.close {
|
&.close {
|
||||||
background: var(--grey-light-40);
|
background: var(--background-base-20);
|
||||||
position: relative;
|
position: relative;
|
||||||
right: 0;
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ const scrollable = computed(() => children.value?.scrollWidth > children.value?.
|
||||||
.page {
|
.page {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
|
|
@ -45,7 +45,7 @@ export async function onBeforeRender(pageContext) {
|
||||||
parentEntityId: entity.parent?.id,
|
parentEntityId: entity.parent?.id,
|
||||||
minRatio: 1.5,
|
minRatio: 1.5,
|
||||||
},
|
},
|
||||||
]);
|
], { tagFilter: pageContext.tagFilter });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
scenes,
|
scenes,
|
||||||
|
|
|
@ -23,7 +23,7 @@ export async function onBeforeRender(pageContext) {
|
||||||
{ minRatio: 1.5 },
|
{ minRatio: 1.5 },
|
||||||
{ minRatio: 0.75, maxRatio: 1.25 },
|
{ minRatio: 0.75, maxRatio: 1.25 },
|
||||||
{ minRatio: 1.5 },
|
{ minRatio: 1.5 },
|
||||||
]),
|
], { tagFilter: pageContext.tagFilter }),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
|
@ -23,11 +23,7 @@ function curateCampaign(campaign) {
|
||||||
height: campaign.banner.height,
|
height: campaign.banner.height,
|
||||||
ratio: campaign.banner.ratio,
|
ratio: campaign.banner.ratio,
|
||||||
entity: campaign.banner_entity && curateEntity({ ...campaign.banner_entity, parent: campaign.banner_parent_entity }),
|
entity: campaign.banner_entity && curateEntity({ ...campaign.banner_entity, parent: campaign.banner_parent_entity }),
|
||||||
tags: campaign.banner_tags?.map((tag) => ({
|
tags: campaign.banner_tags || [],
|
||||||
id: tag.id,
|
|
||||||
slug: tag.slug,
|
|
||||||
name: tag.name,
|
|
||||||
})) || [],
|
|
||||||
},
|
},
|
||||||
affiliate: campaign.affiliate && {
|
affiliate: campaign.affiliate && {
|
||||||
id: campaign.affiliate.id,
|
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
|
const campaigns = options.campaigns
|
||||||
|| await redis.hGetAll('traxxx:campaigns').then((rawCampaigns) => Object.values(rawCampaigns).map((rawCampaign) => JSON.parse(rawCampaign)));
|
|| 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context.tagFilter && campaign.banner && campaign.banner.tags.some((tag) => context.tagFilter.includes(tag))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -70,14 +70,14 @@ export async function getRandomCampaign(options = {}) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getRandomCampaigns(allOptions = []) {
|
export async function getRandomCampaigns(allOptions = [], context = {}) {
|
||||||
const rawCampaigns = await redis.hGetAll('traxxx:campaigns');
|
const rawCampaigns = await redis.hGetAll('traxxx:campaigns');
|
||||||
const campaigns = Object.values(rawCampaigns).map((rawCampaign) => JSON.parse(rawCampaign));
|
const campaigns = Object.values(rawCampaigns).map((rawCampaign) => JSON.parse(rawCampaign));
|
||||||
|
|
||||||
return Promise.all(allOptions.map(async (options) => getRandomCampaign({
|
return Promise.all(allOptions.map(async (options) => getRandomCampaign({
|
||||||
...options,
|
...options,
|
||||||
campaigns,
|
campaigns,
|
||||||
})));
|
}, context)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cacheCampaigns() {
|
export async function cacheCampaigns() {
|
||||||
|
|
2
static
2
static
|
@ -1 +1 @@
|
||||||
Subproject commit 24d11363ef7632591ec6f49240079259f777ab9e
|
Subproject commit 6289c5ff5707aac96d306f29805c322393164d3a
|
Loading…
Reference in New Issue