This commit is contained in:
skidoodle 2024-03-13 00:30:45 +01:00
commit d761a10bf7
102 changed files with 4761 additions and 0 deletions

12
lib/models/mime.ts Normal file
View file

@ -0,0 +1,12 @@
enum Mime {
'image/webp',
'image/png',
'image/jpeg',
'image/gif',
}
export default Mime;
const Mimes = [...Object.keys(Mime)];
export const AllowedMimes = Mimes.slice(Mimes.length * -0.5);

113
lib/models/modal.ts Normal file
View file

@ -0,0 +1,113 @@
import Account from '$lib/components/dashboard/modal/types/Account.svelte';
import ChangePassword from '$lib/components/dashboard/modal/types/ChangePassword.svelte';
import Customization from '$lib/components/dashboard/modal/types/Customization.svelte';
import DeleteWidget from '$lib/components/dashboard/modal/types/DeleteWidget.svelte';
import DiscardChanges from '$lib/components/dashboard/modal/types/DiscardChanges.svelte';
import EditWidget from '$lib/components/dashboard/modal/types/EditWidget.svelte';
import Home from '$lib/components/dashboard/modal/types/Home.svelte';
import NewWidget from '$lib/components/dashboard/modal/types/NewWidget.svelte';
import NsfwWarning from '$lib/components/dashboard/modal/types/NsfwWarning.svelte';
import User from '$lib/components/dashboard/modal/types/User.svelte';
import UserPanel from '$lib/components/dashboard/modal/types/UserPanel.svelte';
enum Align {
left = 'LEFT',
center = 'CENTER',
right = 'RIGHT',
unknown = 'UNKNOWN',
}
enum Modal {
NsfwWarning,
User,
NewWidget,
EditWidget,
DeleteWidget,
DiscardChanges,
Account,
Home,
ChangePassword,
UserPanel,
Customization,
}
export interface ModalType {
component:
| typeof NsfwWarning
| typeof User
| typeof NewWidget
| typeof EditWidget
| typeof DeleteWidget
| typeof DiscardChanges
| typeof Account
| typeof Home
| typeof ChangePassword
| typeof UserPanel
| typeof Customization;
container?: {
invisible?: boolean;
verticalEnd?: boolean;
align?: Align;
};
transition?: {
x?: number;
y?: number;
};
path?: string;
navbarMount?: boolean;
}
export const type: ModalType[] = [
{ component: NsfwWarning },
{
component: User,
container: {
invisible: true,
verticalEnd: true,
align: Align.left,
},
transition: {
x: -25,
y: 0,
},
},
{
component: NewWidget,
path: '/dashboard/editor',
navbarMount: true,
},
{
component: EditWidget,
path: '/dashboard/editor',
navbarMount: true,
},
{ component: DeleteWidget, path: '/dashboard/editor' },
{ component: DiscardChanges, path: '/dashboard/editor' },
{
component: Account,
path: '/dashboard/editor',
navbarMount: true,
},
{
component: Home,
path: '/dashboard/editor',
navbarMount: true,
},
{
component: ChangePassword,
path: '/dashboard/editor',
navbarMount: true,
},
{
component: UserPanel,
path: '/dashboard/editor',
navbarMount: true,
},
{
component: Customization,
path: '/dashboard/editor',
navbarMount: true,
},
];
export default Modal;

239
lib/models/socials.ts Normal file
View file

@ -0,0 +1,239 @@
export enum SocialLink {
REDDIT,
GITHUB,
STEAM,
SOUND_CLOUD,
NAME_MC,
ELEMENT,
FACEBOOK,
INSTAGRAM,
KO_FI,
LINKED_IN,
PATREON,
PAYPAL,
SNAPCHAT,
SPOTIFY_USER,
SPOTIFY_ARTIST,
TIKTOK,
TWITCH,
KICK,
YOUTUBE,
TWITTER,
DISCORD_USER,
DISCORD_GUILD,
EMAIL,
TELEGRAM,
ROCKSTAR,
STEAM_PROFILE,
STEAM_USER,
OSU,
THREADS,
PINTEREST,
BLUESKY,
ROBLOX,
TUMBLR,
}
export enum SocialText {
EMAIL,
DISCORD,
}
export interface Site {
type: string;
name: string;
color: string;
baseUrl?: string;
icon: string;
}
export const linkType: Site[] = [
{
type: 'REDDIT',
name: 'Reddit',
baseUrl: 'https://reddit.com/u/',
// https://reddit.lingoapp.com/s/orqY1E/?v=16
color: '#FF4500',
icon: '/assets/socials/reddit.svg',
},
{
type: 'GITHUB',
name: 'GitHub',
baseUrl: 'https://github.com/',
// https://github.com/logos
color: '#24292F',
icon: '/assets/socials/github.svg',
},
{
type: 'STEAM',
name: 'Steam',
baseUrl: 'https://steamcommunity.com/id/',
// https://partner.steamgames.com/doc/marketing/branding
color: '#000',
icon: '/assets/socials/steam.svg',
},
{
type: 'SOUND_CLOUD',
name: 'SoundCloud',
baseUrl: 'https://soundcloud.com/',
// no official brand guidelines
color: '#FF661A',
icon: '/assets/socials/soundcloud.svg',
},
{
type: 'NAME_MC',
name: 'NameMC',
baseUrl: 'https://namemc.com/profile/',
// no official brand guidelines
color: '#000',
icon: '/assets/socials/namemc.svg',
},
{
type: 'ELEMENT',
name: 'Matrix',
baseUrl: 'https://matrix.to/#/',
// no official brand guidelines
color: '#0dbd8b',
icon: '/assets/socials/element.svg',
},
{
type: 'FACEBOOK',
name: 'Facebook',
baseUrl: 'https://www.facebook.com/',
// https://about.meta.com/brand/resources/facebookapp/logo/
color: '#1778f2',
icon: '/assets/socials/facebook.svg',
},
{
type: 'INSTAGRAM',
name: 'Instagram',
baseUrl: 'https://www.instagram.com/',
// https://about.meta.com/brand/resources/instagram/instagram-brand/
color: 'linear-gradient(45deg, #f09433 0%,#e6683c 25%,#dc2743 50%,#cc2366 75%,#bc1888 100%)',
icon: '/assets/socials/instagram.svg',
},
{
type: 'KO_FI',
name: 'Ko-fi',
baseUrl: 'https://ko-fi.com/',
// https://more.ko-fi.com/brand-assets
color: '#FF5E5B',
icon: '/assets/socials/ko-fi.svg',
},
{
type: 'LINKED_IN',
name: 'LinkedIn',
baseUrl: 'https://linkedin.com/in/',
// https://brand.linkedin.com/en-us
color: '#0073B1',
icon: '/assets/socials/linkedin.svg',
},
{
type: 'PATREON',
name: 'Patreon',
baseUrl: 'https://patreon.com/',
// https://www.patreon.com/brand
color: '#FF424D',
icon: '/assets/socials/patreon.svg',
},
{
type: 'PAYPAL',
name: 'PayPal',
baseUrl: 'https://paypal.me/',
// https://newsroom.paypal-corp.com/media-resources
color: '#0070E0',
icon: '/assets/socials/paypal.svg',
},
{
type: 'SNAPCHAT',
name: 'Snapchat',
baseUrl: 'https://www.snapchat.com/add/',
// https://snap.com/en-US/brand-guidelines
color: '#FFFC00',
icon: '/assets/socials/snapchat.svg',
},
{
type: 'SPOTIFY_USER',
name: 'Spotify',
baseUrl: 'https://open.spotify.com/user/',
// https://developer.spotify.com/documentation/design
color: '#1db954',
icon: '/assets/socials/spotify.svg',
},
{
type: 'SPOTIFY_ARTIST',
name: 'Spotify Artist',
baseUrl: 'https://open.spotify.com/artist/',
// https://developer.spotify.com/documentation/design
color: '#1db954',
icon: '/assets/socials/spotify.svg',
},
{
type: 'TIKTOK',
name: 'TikTok',
baseUrl: 'https://www.tiktok.com/@',
// https://developers.tiktok.com/doc/getting-started-design-guidelines
color: '#000',
icon: '/assets/socials/tiktok.svg', // stolen from their homepage, since no official vector-based icon in their branding guidelines
},
{
type: 'TWITCH',
name: 'Twitch',
baseUrl: 'https://twitch.tv/',
// https://brand.twitch.tv
color: '#9146FF',
icon: '/assets/socials/twitch.svg',
},
{
type: 'KICK',
name: 'Kick',
baseUrl: 'https://kick.com/',
// https://drive.google.com/drive/folders/1k_eggskCbj20tGMyXmCdnXna78p5SAfR
color: '#000',
icon: '/assets/socials/kick.svg',
},
{
type: 'YOUTUBE',
name: 'YouTube',
baseUrl: 'https://www.youtube.com/@',
// https://www.youtube.com/howyoutubeworks/resources/brand-resources/
color: '#f00',
icon: '/assets/socials/youtube.svg',
},
{
type: 'TWITTER',
name: 'Twitter',
baseUrl: 'https://twitter.com/',
// https://web.archive.org/web/20230101101250/https://about.twitter.com/en/who-we-are/brand-toolkit
color: '#1D9BF0',
icon: '/assets/socials/twitter.svg',
},
{
type: 'DISCORD_USER',
name: 'Discord',
baseUrl: 'https://discord.com/users/',
// https://discord.com/branding
color: '#5865F2',
icon: '/assets/socials/discord.svg',
},
{
type: 'DISCORD_GUILD',
name: 'Discord Server',
baseUrl: 'https://discord.gg/',
// https://discord.com/branding
color: '#5865F2',
icon: '/assets/socials/discord.svg',
},
{
type: 'EMAIL',
name: 'Email',
baseUrl: '',
color: '#121212',
icon: '/assets/socials/email.svg',
},
];
export const getLinkType = (type: string) => {
return linkType.find((link) => link.type === type);
};

229
lib/models/widget.ts Normal file
View file

@ -0,0 +1,229 @@
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;