teoldalad/lib/models/widget.ts
2024-03-13 00:30:45 +01:00

229 lines
8.2 KiB
TypeScript

import DiscordUser from '$lib/components/bio/widgets/DiscordUser.svelte';
import ExternalSite from '$lib/components/bio/widgets/ExternalSite.svelte';
import InstagramPost from '$lib/components/bio/widgets/InstagramPost.svelte';
import Markdown from '$lib/components/bio/widgets/Markdown.svelte';
import PinterestPin from '$lib/components/bio/widgets/PinterestPin.svelte';
import SoundCloudTrack from '$lib/components/bio/widgets/SoundCloudTrack.svelte';
import SpotifyNowPlaying from '$lib/components/bio/widgets/SpotifyNowPlaying.svelte';
import Title from '$lib/components/bio/widgets/Title.svelte';
import TwitchLive from '$lib/components/bio/widgets/TwitchLive.svelte';
import TwitterPost from '$lib/components/bio/widgets/TwitterPost.svelte';
import YouTubeVideo from '$lib/components/bio/widgets/YouTubeVideo.svelte';
import DiscordUserEditor from '$lib/components/dashboard/editor/types/DiscordUser.svelte';
import ExternalSiteEditor from '$lib/components/dashboard/editor/types/ExternalSite.svelte';
import InstagramPostEditor from '$lib/components/dashboard/editor/types/InstagramPost.svelte';
import MarkdownEditor from '$lib/components/dashboard/editor/types/Markdown.svelte';
import PinterestPinEditor from '$lib/components/dashboard/editor/types/PinterestPin.svelte';
import SoundCloudTrackEditor from '$lib/components/dashboard/editor/types/SoundCloudTrack.svelte';
import SpotifyNowPlayingEditor from '$lib/components/dashboard/editor/types/SpotifyNowPlaying.svelte';
import TitleEditor from '$lib/components/dashboard/editor/types/Title.svelte';
import TwitchLiveEditor from '$lib/components/dashboard/editor/types/TwitchLive.svelte';
import TwitterPostEditor from '$lib/components/dashboard/editor/types/TwitterPost.svelte';
import YouTubeVideoEditor from '$lib/components/dashboard/editor/types/YouTubeVideo.svelte';
import type { ComponentType } from 'svelte';
export enum Widget {
DISCORD,
EXTERNAL_SITE,
MARKDOWN,
SPOTIFY_NOW_PLAYING,
YOUTUBE_VIDEO,
TWITTER_POST,
SOUNDCLOUD_TRACK,
TWITCH_LIVE,
INSTAGRAM_POST,
PINTEREST_PIN,
TITLE,
}
export interface WidgetType {
type: string;
component: ComponentType;
name: string;
data:
| WidgetMarkdown
| WidgetExternalSite
| WidgetSpotifyNowPlaying
| WidgetYouTubeVideo
| WidgetTwitterPost
| WidgetSoundCloudTrack
| WidgetTwitchLive
| WidgetInstagramPost
| WidgetPinterestPin
| WidgetTitle;
preview?:
| WidgetRenderedMarkdown
| WidgetPreviewYouTubeVideo
| WidgetPreviewTwitterPost
| WidgetPreviewSoundCloudTrack
| WidgetPreviewTwitchLive
| WidgetPreviewInstagramPost
| WidgetPreviewPinterestPin;
priority?: number | null;
count?: number | null;
editor: ComponentType;
disabled?: boolean | null;
excludeFromCarousel?: boolean | null;
nonPreviewable?: boolean | null;
}
export const type: WidgetType[] = [
{
type: 'DISCORD',
component: DiscordUser,
name: 'Discord',
data: {},
editor: DiscordUserEditor,
disabled: true,
},
{
type: 'EXTERNAL_SITE',
component: ExternalSite,
name: 'Link',
data: {
title: 'YourSitee Homepage',
url: 'https://yoursit.ee',
} as WidgetExternalSite,
priority: 2,
editor: ExternalSiteEditor,
nonPreviewable: true,
},
{
type: 'MARKDOWN',
component: Markdown,
name: 'Text',
data: {
content: `## Welcome to YourSitee\nCreate the coolest bio page 🌍\n\nBe unique, stylish, special ✨`,
} as WidgetMarkdown,
preview: {
html: `<h2>Welcome to YourSitee</h2><p>Create the coolest bio page 🌍</p><p>Be unique, stylish, special ✨</p>`,
} as WidgetRenderedMarkdown,
priority: 0,
editor: MarkdownEditor,
},
{
type: 'SPOTIFY_NOW_PLAYING',
component: SpotifyNowPlaying,
name: 'Spotify - Now Playing',
data: {} as WidgetSpotifyNowPlaying,
editor: SpotifyNowPlayingEditor,
disabled: true,
},
{
type: 'YOUTUBE_VIDEO',
component: YouTubeVideo,
name: 'YouTube - Video',
data: {
url: 'https://www.youtube.com/watch?v=BHACKCNDMW8',
} as WidgetYouTubeVideo,
preview: {
title: '3 Hours of Amazing Nature Scenery & Relaxing Music for Stress Relief.',
description:
'Enjoy 3 hours of amazing nature scenery. This video features relaxing music that is ideal for sleep, study, meditation and yoga. ✿ Follow on Spotify https://...',
thumbnail: 'https://cdn.yoursit.ee/previews/youtube_video0.jpg',
channel: 'Cat Trumpet',
link: 'https://www.youtube.com/watch?v=BHACKCNDMW8',
} as WidgetPreviewYouTubeVideo,
editor: YouTubeVideoEditor,
},
{
type: 'TWITTER_POST',
component: TwitterPost,
name: 'Twitter - Tweet',
data: {
url: 'https://twitter.com/mifuyu_916/status/1734562899828552087',
} as WidgetTwitterPost,
preview: {
title: 'みふゆ(三冬) (@mifuyu_916)',
tag: '@mifuyu_916',
url: 'https://twitter.com/mifuyu_916/status/1734562899828552087',
description: '猫の枕',
thumbnail: 'https://cdn.yoursit.ee/previews/twitter_post0.jpg',
comments: 2,
retweets: 104,
likes: 1368,
} as WidgetPreviewTwitterPost,
editor: TwitterPostEditor,
},
{
type: 'SOUNDCLOUD_TRACK',
component: SoundCloudTrack,
name: 'SoundCloud - Track',
data: {
url: 'https://soundcloud.com/theneighbourhood/sweater-weather-1',
} as WidgetSoundCloudTrack,
preview: {
title: '"Sweater Weather"',
description: 'Listen to "Sweater Weather" by theneighbourhood #np on #SoundCloud',
thumbnail: 'https://cdn.yoursit.ee/previews/soundcloud_track0.jpg',
link: 'https://soundcloud.com/theneighbourhood/sweater-weather-1',
authorName: 'theneighbourhood',
authorUrl: 'https://soundcloud.com/theneighbourhood',
} as WidgetPreviewSoundCloudTrack,
editor: SoundCloudTrackEditor,
},
{
type: 'TWITCH_LIVE',
component: TwitchLive,
name: 'Twitch - Live',
data: {
url: 'https://www.twitch.tv/eslcs',
} as WidgetTwitchLive,
preview: {
channel: 'ESLCS - Twitch',
url: 'https://www.twitch.tv/eslcs',
description: 'ESL CLASSICS - NAVI IGS RUN: Natus Vincere vs. Astralis [Dust2] Map 2 - IEM Cologne 2021',
thumbnail: 'https://cdn.yoursit.ee/previews/twitch_live0.jpeg',
} as WidgetPreviewTwitchLive,
editor: TwitchLiveEditor,
},
{
type: 'INSTAGRAM_POST',
component: InstagramPost,
name: 'Instagram - Post',
data: {
url: 'https://www.instagram.com/p/C0oWjsurFfa/',
} as WidgetInstagramPost,
preview: {
title:
'Luluchannel on Instagram: "トリミングで綺麗に✨クリスマス🎄誰と🐶💕#ミニチュアシュナウザー #ミニシュナ #愛犬 #lulu #ルル#しゅなすたぐらむ #髭犬 #犬のいる暮らし #miniatureschnauzer #dog #フォロー歓迎 #いぬすた #dogstagram #schnauzer #dogsofinsta #dogsofinstagram"',
description:
'1,732 likes, 17 comments - schnauzer.luluchannel on December 9, 2023: "トリミングで綺麗に✨クリスマス🎄誰と🐶💕#ミニチュアシュナウザ..."',
thumbnail: 'https://cdn.yoursit.ee/previews/instagram_post0.jpg',
author: 'Luluchannel (@schnauzer.luluchannel) • Instagram reel',
link: 'https://www.instagram.com/reel/C0oWjsurFfa/',
} as WidgetPreviewInstagramPost,
editor: InstagramPostEditor,
},
{
type: 'PINTEREST_PIN',
component: PinterestPin,
name: 'Pinterest - Pin',
data: {
url: 'https://www.pinterest.com/pin/1087619378734380279/',
} as WidgetPinterestPin,
preview: {
title: 'Pin on Vegan Tofu and Tempeh Recipes',
description:
'Jan 16, 2021 - Sweet and Spicy Tempeh cooked with a kecap manis based sauce & Garlic Curry Noodles for a protein-packed vegan meal.',
thumbnail: 'https://cdn.yoursit.ee/previews/pinterest_pin0.jpg',
authorUrl: 'https://www.pinterest.com/corinaamira/',
link: 'https://www.pinterest.com/pin/1087619378734380279/',
} as WidgetPreviewPinterestPin,
editor: PinterestPinEditor,
},
{
type: 'TITLE',
component: Title,
name: 'Title',
data: {
content: `A title to organize YourSitee`,
} as WidgetTitle,
priority: 1,
editor: TitleEditor,
excludeFromCarousel: true,
nonPreviewable: true,
},
];
export default Widget;