your personal website on atproto - mirror blento.app

add livestream embed

Florian c96a01b5 0e180adb

+35 -3
+1 -1
src/lib/cards/EmbedCard/EmbedCard.svelte
··· 6 6 7 7 <iframe 8 8 src={item.cardData.href} 9 - sandbox="allow-scripts" 9 + sandbox="allow-scripts allow-same-origin" 10 10 referrerpolicy="no-referrer" 11 11 class="absolute inset-0 h-full w-full" 12 12 title=""
+12
src/lib/cards/LivestreamCard/SidebarItemEmbedLivestreamCard.svelte
··· 1 + <script lang="ts"> 2 + import { Button } from '@foxui/core'; 3 + import Icon from './Icon.svelte'; 4 + 5 + let { onclick }: { onclick: () => void } = $props(); 6 + </script> 7 + 8 + <Button {onclick} variant="ghost" class="w-full" size="lg"> 9 + <Icon class="size-4" /> 10 + 11 + Embed stream.place 12 + </Button>
+1 -1
src/lib/cards/LivestreamCard/SidebarItemLivestreamCard.svelte
··· 8 8 <Button {onclick} variant="ghost" class="w-full" size="lg"> 9 9 <Icon class="size-4" /> 10 10 11 - Latest Livestream 11 + Latest stream.place 12 12 </Button>
+19
src/lib/cards/LivestreamCard/index.ts
··· 1 + import { client } from '$lib/oauth'; 2 + import EmbedCard from '../EmbedCard/EmbedCard.svelte'; 1 3 import type { CardDefinition } from '../types'; 2 4 import LivestreamCard from './LivestreamCard.svelte'; 5 + import SidebarItemEmbedLivestreamCard from './SidebarItemEmbedLivestreamCard.svelte'; 3 6 import SidebarItemLivestreamCard from './SidebarItemLivestreamCard.svelte'; 4 7 5 8 export const LivestreamCardDefitition = { ··· 13 16 card.mobileW = 4; 14 17 } 15 18 } as CardDefinition & { type: 'latestLivestream' }; 19 + 20 + export const LivestreamEmbedCardDefitition = { 21 + type: 'livestreamEmbed', 22 + contentComponent: EmbedCard, 23 + sidebarComponent: SidebarItemEmbedLivestreamCard, 24 + createNew: (card) => { 25 + card.w = 2; 26 + card.h = 1; 27 + card.mobileH = 2; 28 + card.mobileW = 4; 29 + 30 + card.cardData = { 31 + href: 'https://stream.place/embed/' + client.profile?.handle 32 + }; 33 + } 34 + } as CardDefinition & { type: 'livestreamEmbed' };
+2 -1
src/lib/cards/index.ts
··· 2 2 import { EmbedCardDefinition } from './EmbedCard'; 3 3 import { ImageCardDefinition } from './ImageCard'; 4 4 import { LinkCardDefinition } from './LinkCard'; 5 - import { LivestreamCardDefitition } from './LivestreamCard'; 5 + import { LivestreamCardDefitition, LivestreamEmbedCardDefitition } from './LivestreamCard'; 6 6 import { UpdatedBlentosCardDefitition } from './SpecialCards/UpdatedBlentos'; 7 7 import { TextCardDefinition } from './TextCard'; 8 8 import type { CardDefinition } from './types'; ··· 16 16 YoutubeCardDefinition, 17 17 BlueskyPostCardDefinition, 18 18 LivestreamCardDefitition, 19 + LivestreamEmbedCardDefitition, 19 20 EmbedCardDefinition 20 21 ] as const; 21 22