Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 2x 2x 2x 4x 4x 1x 4x 2x | import logo from './images/logo.svg'
import favicon from './images/favicon.svg'
import backgroundDonor from './images/background-donor.svg'
import backgroundLive from './images/background-live.svg'
import backgroundLanding from './images/background-landing.svg'
import { getGlobalConfig, getEventConfig } from '../store'
import { deepMerge } from '../utils/merge'
const defaultAssets = {
logo: logo,
favicon: favicon,
backgroundDonor: backgroundDonor,
backgroundLive: backgroundLive,
backgroundLanding: backgroundLanding,
}
export type AssetRegistry = typeof defaultAssets
/**
* Loads the final assets map by merging defaults with database overrides.
*/
export const loadAssets = (): AssetRegistry => {
const globalAssets = getGlobalConfig()?.theme?.assets || {}
const eventAssets = getEventConfig()?.theme?.assets || {}
// Filter out empty strings/nulls to avoid overriding defaults with empty values
const cleanAssets = (assets: Partial<AssetRegistry>) => {
const cleaned = { ...assets }
;(Object.keys(cleaned) as Array<keyof AssetRegistry>).forEach((key) => {
Iif (!cleaned[key]) {
delete cleaned[key]
}
})
return cleaned
}
// Merge: Default < Global < Event
return deepMerge(
defaultAssets,
cleanAssets(globalAssets),
cleanAssets(eventAssets),
) as AssetRegistry
}
|