your personal website on atproto - mirror blento.app
at small-fixes 78 lines 3.0 kB view raw
1import type { Item } from '$lib/types'; 2import { ATProtoCollectionsCardDefinition } from './ATProtoCollectionsCard'; 3import { BigSocialCardDefinition } from './BigSocialCard'; 4import { BlueskyMediaCardDefinition } from './BlueskyMediaCard'; 5import { BlueskyPostCardDefinition } from './BlueskyPostCard'; 6import { DinoGameCardDefinition } from './GameCards/DinoGameCard'; 7import { EmbedCardDefinition } from './EmbedCard'; 8import { TetrisCardDefinition } from './GameCards/TetrisCard'; 9import { ImageCardDefinition } from './ImageCard'; 10import { LinkCardDefinition } from './LinkCard'; 11import { LivestreamCardDefitition, LivestreamEmbedCardDefitition } from './LivestreamCard'; 12import { MapCardDefinition } from './MapCard'; 13import { SectionCardDefinition } from './SectionCard'; 14import { UpdatedBlentosCardDefitition } from './SpecialCards/UpdatedBlentos'; 15import { TextCardDefinition } from './TextCard'; 16import type { CardDefinition } from './types'; 17import { VideoCardDefinition } from './VideoCard'; 18import { YoutubeCardDefinition } from './YoutubeVideoCard'; 19import { BlueskyProfileCardDefinition } from './BlueskyProfileCard'; 20import { GithubProfileCardDefitition } from './GitHubProfileCard'; 21import { FluidTextCardDefinition } from './FluidTextCard'; 22import { GifCardDefinition } from './GIFCard'; 23import { PopfeedReviewsCardDefinition } from './PopfeedReviews'; 24import { TealFMPlaysCardDefinition } from './TealFMPlaysCard'; 25import { PhotoGalleryCardDefinition } from './PhotoGalleryCard'; 26import { StandardSiteDocumentListCardDefinition } from './StandardSiteDocumentListCard'; 27import { StatusphereCardDefinition } from './StatusphereCard'; 28import { EventCardDefinition } from './EventCard'; 29import { VCardCardDefinition } from './VCardCard'; 30import { DrawCardDefinition } from './DrawCard'; 31 32export const AllCardDefinitions = [ 33 ImageCardDefinition, 34 VideoCardDefinition, 35 TextCardDefinition, 36 LinkCardDefinition, 37 BigSocialCardDefinition, 38 UpdatedBlentosCardDefitition, 39 YoutubeCardDefinition, 40 BlueskyPostCardDefinition, 41 LivestreamCardDefitition, 42 LivestreamEmbedCardDefitition, 43 EmbedCardDefinition, 44 MapCardDefinition, 45 ATProtoCollectionsCardDefinition, 46 SectionCardDefinition, 47 BlueskyMediaCardDefinition, 48 DinoGameCardDefinition, 49 BlueskyProfileCardDefinition, 50 GithubProfileCardDefitition, 51 TetrisCardDefinition, 52 FluidTextCardDefinition, 53 GifCardDefinition, 54 PopfeedReviewsCardDefinition, 55 TealFMPlaysCardDefinition, 56 PhotoGalleryCardDefinition, 57 StandardSiteDocumentListCardDefinition, 58 StatusphereCardDefinition, 59 EventCardDefinition, 60 VCardCardDefinition, 61 DrawCardDefinition 62] as const; 63 64export const CardDefinitionsByType = AllCardDefinitions.reduce( 65 (acc, item) => { 66 acc[item.type] = item; 67 return acc; 68 }, 69 {} as Record<string, CardDefinition> 70); 71 72export function getColor(item: Item): string { 73 if (item.color) return item.color; 74 75 const cardDefColor = CardDefinitionsByType[item.cardType]?.defaultColor; 76 77 return cardDefColor || 'base'; 78}