From 332465b85c14c174956154dcdd501ad9fbb6e13c Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Fri, 18 Apr 2025 11:57:50 +0200 Subject: [PATCH] style: format with prettier --- .prettierrc | 6 +- .vscode/settings.json | 10 +- components.json | 30 +-- package.json | 69 ++--- postcss.config.js | 4 +- src/app.css | 6 +- src/app.d.ts | 14 +- src/app.html | 18 +- src/lib/components/app/bg-image.svelte | 15 +- src/lib/components/app/bottom-bar.svelte | 8 +- src/lib/components/app/daemon.svelte | 243 +++++++++--------- src/lib/components/app/now-playing.svelte | 16 +- src/lib/components/ui/button/button.svelte | 121 +++++---- src/lib/components/ui/button/index.ts | 26 +- .../dropdown-menu-checkbox-item.svelte | 66 ++--- .../dropdown-menu-content.svelte | 42 +-- .../dropdown-menu-group-heading.svelte | 26 +- .../dropdown-menu/dropdown-menu-item.svelte | 34 +-- .../dropdown-menu/dropdown-menu-label.svelte | 32 +-- .../dropdown-menu-radio-item.svelte | 46 ++-- .../dropdown-menu-separator.svelte | 20 +- .../dropdown-menu-shortcut.svelte | 26 +- .../dropdown-menu-sub-content.svelte | 26 +- .../dropdown-menu-sub-trigger.svelte | 42 +-- src/lib/components/ui/dropdown-menu/index.ts | 82 +++--- src/lib/state.svelte.ts | 42 +-- src/lib/types.ts | 101 ++++---- src/lib/utils.ts | 20 +- src/routes/+layout.svelte | 4 +- src/routes/+page.svelte | 17 +- svelte.config.js | 26 +- tailwind.config.ts | 182 ++++++------- tsconfig.json | 34 +-- vite.config.ts | 2 +- yarn.lock | 5 + 35 files changed, 733 insertions(+), 728 deletions(-) diff --git a/.prettierrc b/.prettierrc index 49d911d..a6c14c7 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,5 +4,7 @@ "tabWidth": 2, "singleQuote": true, "trailingComma": "es5", - "semi": true -} \ No newline at end of file + "semi": true, + "plugins": ["prettier-plugin-svelte"], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 592a4a7..f918991 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { - "editor.tabSize": 2, - "editor.detectIndentation": false, - "editor.insertSpaces": true, - "editor.rulers": [100] -} \ No newline at end of file + "editor.tabSize": 2, + "editor.detectIndentation": false, + "editor.insertSpaces": true, + "editor.rulers": [100] +} diff --git a/components.json b/components.json index 260ea62..22be117 100644 --- a/components.json +++ b/components.json @@ -1,17 +1,17 @@ { - "$schema": "https://next.shadcn-svelte.com/schema.json", - "style": "new-york", - "tailwind": { - "config": "tailwind.config.ts", - "css": "src/app.css", - "baseColor": "neutral" - }, - "aliases": { - "components": "$lib/components", - "utils": "$lib/utils", - "ui": "$lib/components/ui", - "hooks": "$lib/hooks" - }, - "typescript": true, - "registry": "https://next.shadcn-svelte.com/registry" + "$schema": "https://next.shadcn-svelte.com/schema.json", + "style": "new-york", + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/app.css", + "baseColor": "neutral" + }, + "aliases": { + "components": "$lib/components", + "utils": "$lib/utils", + "ui": "$lib/components/ui", + "hooks": "$lib/hooks" + }, + "typescript": true, + "registry": "https://next.shadcn-svelte.com/registry" } diff --git a/package.json b/package.json index 247512f..3a49974 100644 --- a/package.json +++ b/package.json @@ -1,37 +1,38 @@ { - "name": "chillhop", - "private": true, - "version": "0.0.1", - "type": "module", - "scripts": { - "dev": "vite dev", - "build": "vite build", - "preview": "vite preview", - "prepare": "svelte-kit sync || echo ''", - "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "ui:add": "npx shadcn-svelte@next add", + "name": "chillhop", + "private": true, + "version": "0.0.1", + "type": "module", + "scripts": { + "dev": "vite dev", + "build": "vite build", + "preview": "vite preview", + "prepare": "svelte-kit sync || echo ''", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", + "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", + "ui:add": "npx shadcn-svelte@next add", "format": "prettier --write ." - }, - "devDependencies": { - "@lucide/svelte": "^0.488.0", - "@sveltejs/adapter-auto": "^6.0.0", - "@sveltejs/adapter-cloudflare": "^5.0.1", - "@sveltejs/kit": "^2.16.0", - "@sveltejs/vite-plugin-svelte": "^5.0.0", - "autoprefixer": "^10.4.20", - "bits-ui": "^1.3.19", - "clsx": "^2.1.1", - "prettier": "^3.5.3", - "svelte": "^5.0.0", - "svelte-check": "^4.0.0", - "tailwind-merge": "^3.2.0", - "tailwind-variants": "^1.0.0", - "tailwindcss": "^3.4.17", - "tailwindcss-animate": "^1.0.7", - "typescript": "^5.0.0", - "vite": "^6.0.0", - "wrangler": "^4.12.0" - }, - "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" + }, + "devDependencies": { + "@lucide/svelte": "^0.488.0", + "@sveltejs/adapter-auto": "^6.0.0", + "@sveltejs/adapter-cloudflare": "^5.0.1", + "@sveltejs/kit": "^2.16.0", + "@sveltejs/vite-plugin-svelte": "^5.0.0", + "autoprefixer": "^10.4.20", + "bits-ui": "^1.3.19", + "clsx": "^2.1.1", + "prettier": "^3.5.3", + "prettier-plugin-svelte": "^3.3.3", + "svelte": "^5.0.0", + "svelte-check": "^4.0.0", + "tailwind-merge": "^3.2.0", + "tailwind-variants": "^1.0.0", + "tailwindcss": "^3.4.17", + "tailwindcss-animate": "^1.0.7", + "typescript": "^5.0.0", + "vite": "^6.0.0", + "wrangler": "^4.12.0" + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/postcss.config.js b/postcss.config.js index ba80730..2aa7205 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,6 +1,6 @@ export default { plugins: { tailwindcss: {}, - autoprefixer: {} - } + autoprefixer: {}, + }, }; diff --git a/src/app.css b/src/app.css index ef33889..72b0ea6 100644 --- a/src/app.css +++ b/src/app.css @@ -24,7 +24,7 @@ --destructive-foreground: 0 0% 98%; --ring: 0 0% 3.9%; --radius: 1rem; - --sidebar-background: 0 0% 98%; + --sidebar-background: 0 0% 98%; --sidebar-foreground: 240 5.3% 26.1%; --sidebar-primary: 240 5.9% 10%; --sidebar-primary-foreground: 0 0% 98%; @@ -54,7 +54,7 @@ --destructive: 0 62.8% 30.6%; --destructive-foreground: 0 0% 98%; --ring: 0 0% 83.1%; - --sidebar-background: 240 5.9% 10%; + --sidebar-background: 240 5.9% 10%; --sidebar-foreground: 240 4.8% 95.9%; --sidebar-primary: 224.3 76.3% 48%; --sidebar-primary-foreground: 0 0% 100%; @@ -72,4 +72,4 @@ body { @apply bg-background text-foreground m-0 p-0 overflow-hidden; } -} \ No newline at end of file +} diff --git a/src/app.d.ts b/src/app.d.ts index da08e6d..520c421 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -1,13 +1,13 @@ // See https://svelte.dev/docs/kit/types#app.d.ts // for information about these interfaces declare global { - namespace App { - // interface Error {} - // interface Locals {} - // interface PageData {} - // interface PageState {} - // interface Platform {} - } + namespace App { + // interface Error {} + // interface Locals {} + // interface PageData {} + // interface PageState {} + // interface Platform {} + } } export {}; diff --git a/src/app.html b/src/app.html index 77a5ff5..84ffad1 100644 --- a/src/app.html +++ b/src/app.html @@ -1,12 +1,12 @@ - - - - - %sveltekit.head% - - -
%sveltekit.body%
- + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ diff --git a/src/lib/components/app/bg-image.svelte b/src/lib/components/app/bg-image.svelte index 9bf5d54..1efce8a 100644 --- a/src/lib/components/app/bg-image.svelte +++ b/src/lib/components/app/bg-image.svelte @@ -1,7 +1,8 @@ - \ No newline at end of file + diff --git a/src/lib/components/app/bottom-bar.svelte b/src/lib/components/app/bottom-bar.svelte index c990a5d..916be73 100644 --- a/src/lib/components/app/bottom-bar.svelte +++ b/src/lib/components/app/bottom-bar.svelte @@ -1,7 +1,9 @@ -
+
-
\ No newline at end of file +
diff --git a/src/lib/components/app/daemon.svelte b/src/lib/components/app/daemon.svelte index 2704b0f..9ce7c80 100644 --- a/src/lib/components/app/daemon.svelte +++ b/src/lib/components/app/daemon.svelte @@ -1,138 +1,143 @@ {#if !state.hasInteracted} - {/if} {#if !state.isLoading} - +{/if} diff --git a/src/lib/components/app/now-playing.svelte b/src/lib/components/app/now-playing.svelte index 05850b5..f7af799 100644 --- a/src/lib/components/app/now-playing.svelte +++ b/src/lib/components/app/now-playing.svelte @@ -1,19 +1,15 @@ -Cover Art +Cover Art

{state.currentSong?.title}

@@ -26,4 +22,4 @@ {:else} {/if} - \ No newline at end of file + diff --git a/src/lib/components/ui/button/button.svelte b/src/lib/components/ui/button/button.svelte index 6fdcf53..ccad5cb 100644 --- a/src/lib/components/ui/button/button.svelte +++ b/src/lib/components/ui/button/button.svelte @@ -1,76 +1,71 @@ {#if href} - - {@render children?.()} - + + {@render children?.()} + {:else} - + {/if} diff --git a/src/lib/components/ui/button/index.ts b/src/lib/components/ui/button/index.ts index fb585d7..66c1087 100644 --- a/src/lib/components/ui/button/index.ts +++ b/src/lib/components/ui/button/index.ts @@ -1,17 +1,17 @@ import Root, { - type ButtonProps, - type ButtonSize, - type ButtonVariant, - buttonVariants, -} from "./button.svelte"; + type ButtonProps, + type ButtonSize, + type ButtonVariant, + buttonVariants, +} from './button.svelte'; export { - Root, - type ButtonProps as Props, - // - Root as Button, - buttonVariants, - type ButtonProps, - type ButtonSize, - type ButtonVariant, + Root, + type ButtonProps as Props, + // + Root as Button, + buttonVariants, + type ButtonProps, + type ButtonSize, + type ButtonVariant, }; diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte index 456741d..04a407d 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte @@ -1,40 +1,40 @@ - {#snippet children({ checked, indeterminate })} - - {#if indeterminate} - - {:else} - - {/if} - - {@render childrenProp?.()} - {/snippet} + {#snippet children({ checked, indeterminate })} + + {#if indeterminate} + + {:else} + + {/if} + + {@render childrenProp?.()} + {/snippet} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte index 00966ff..d81fc05 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte @@ -1,27 +1,27 @@ - + diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte index 84d5cca..c5e9549 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte @@ -1,19 +1,19 @@ diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte index bd7492d..c587fa1 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte @@ -1,23 +1,23 @@ svg]:size-4 [&>svg]:shrink-0", - inset && "pl-8", - className - )} - {...restProps} + bind:ref + class={cn( + 'data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0', + inset && 'pl-8', + className + )} + {...restProps} /> diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte index 9837d5a..f1ac565 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte @@ -1,23 +1,23 @@
- {@render children?.()} + {@render children?.()}
diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte index bcb960d..07839d0 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte @@ -1,30 +1,30 @@ - {#snippet children({ checked })} - - {#if checked} - - {/if} - - {@render childrenProp?.({ checked })} - {/snippet} + {#snippet children({ checked })} + + {#if checked} + + {/if} + + {@render childrenProp?.({ checked })} + {/snippet} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte index 32fac4b..73f21c2 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte @@ -1,16 +1,16 @@ diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte index 053e2a2..e09c776 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte @@ -1,20 +1,20 @@ - {@render children?.()} + {@render children?.()} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte index 0bb6eea..af840bb 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte @@ -1,19 +1,19 @@ diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte index f5e1e2a..0d704c9 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte @@ -1,28 +1,28 @@ - {@render children?.()} - + {@render children?.()} + diff --git a/src/lib/components/ui/dropdown-menu/index.ts b/src/lib/components/ui/dropdown-menu/index.ts index 40c4502..d3fe7c9 100644 --- a/src/lib/components/ui/dropdown-menu/index.ts +++ b/src/lib/components/ui/dropdown-menu/index.ts @@ -1,14 +1,14 @@ -import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui"; -import CheckboxItem from "./dropdown-menu-checkbox-item.svelte"; -import Content from "./dropdown-menu-content.svelte"; -import GroupHeading from "./dropdown-menu-group-heading.svelte"; -import Item from "./dropdown-menu-item.svelte"; -import Label from "./dropdown-menu-label.svelte"; -import RadioItem from "./dropdown-menu-radio-item.svelte"; -import Separator from "./dropdown-menu-separator.svelte"; -import Shortcut from "./dropdown-menu-shortcut.svelte"; -import SubContent from "./dropdown-menu-sub-content.svelte"; -import SubTrigger from "./dropdown-menu-sub-trigger.svelte"; +import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui'; +import CheckboxItem from './dropdown-menu-checkbox-item.svelte'; +import Content from './dropdown-menu-content.svelte'; +import GroupHeading from './dropdown-menu-group-heading.svelte'; +import Item from './dropdown-menu-item.svelte'; +import Label from './dropdown-menu-label.svelte'; +import RadioItem from './dropdown-menu-radio-item.svelte'; +import Separator from './dropdown-menu-separator.svelte'; +import Shortcut from './dropdown-menu-shortcut.svelte'; +import SubContent from './dropdown-menu-sub-content.svelte'; +import SubTrigger from './dropdown-menu-sub-trigger.svelte'; const Sub = DropdownMenuPrimitive.Sub; const Root = DropdownMenuPrimitive.Root; @@ -17,34 +17,34 @@ const Group = DropdownMenuPrimitive.Group; const RadioGroup = DropdownMenuPrimitive.RadioGroup; export { - CheckboxItem, - Content, - Root as DropdownMenu, - CheckboxItem as DropdownMenuCheckboxItem, - Content as DropdownMenuContent, - Group as DropdownMenuGroup, - GroupHeading as DropdownMenuGroupHeading, - Item as DropdownMenuItem, - Label as DropdownMenuLabel, - RadioGroup as DropdownMenuRadioGroup, - RadioItem as DropdownMenuRadioItem, - Separator as DropdownMenuSeparator, - Shortcut as DropdownMenuShortcut, - Sub as DropdownMenuSub, - SubContent as DropdownMenuSubContent, - SubTrigger as DropdownMenuSubTrigger, - Trigger as DropdownMenuTrigger, - Group, - GroupHeading, - Item, - Label, - RadioGroup, - RadioItem, - Root, - Separator, - Shortcut, - Sub, - SubContent, - SubTrigger, - Trigger, + CheckboxItem, + Content, + Root as DropdownMenu, + CheckboxItem as DropdownMenuCheckboxItem, + Content as DropdownMenuContent, + Group as DropdownMenuGroup, + GroupHeading as DropdownMenuGroupHeading, + Item as DropdownMenuItem, + Label as DropdownMenuLabel, + RadioGroup as DropdownMenuRadioGroup, + RadioItem as DropdownMenuRadioItem, + Separator as DropdownMenuSeparator, + Shortcut as DropdownMenuShortcut, + Sub as DropdownMenuSub, + SubContent as DropdownMenuSubContent, + SubTrigger as DropdownMenuSubTrigger, + Trigger as DropdownMenuTrigger, + Group, + GroupHeading, + Item, + Label, + RadioGroup, + RadioItem, + Root, + Separator, + Shortcut, + Sub, + SubContent, + SubTrigger, + Trigger, }; diff --git a/src/lib/state.svelte.ts b/src/lib/state.svelte.ts index fe3f7c4..bc9ca40 100644 --- a/src/lib/state.svelte.ts +++ b/src/lib/state.svelte.ts @@ -1,25 +1,25 @@ -import type { Song, Atmosphere, Preset, Station, Background } from "./types"; // Added Preset, Station, Background +import type { Song, Atmosphere, Preset, Station, Background } from './types'; // Added Preset, Station, Background export const state = $state({ - hasInteracted: false, - currentStation: null as number | null, - currentSong: null as Song | null, - songQueue: [] as Song[], - isPlaying: true, - volume: 0.5, - isMuted: false, - currentBackgroundId: null as string | null, - activeAtmospheres: {} as Record, // { atmosphereId: volume (0-100) } - isLoading: true, - error: null as string | null, - currentTime: 0, - duration: 0, + hasInteracted: false, + currentStation: null as number | null, + currentSong: null as Song | null, + songQueue: [] as Song[], + isPlaying: true, + volume: 0.5, + isMuted: false, + currentBackgroundId: null as string | null, + activeAtmospheres: {} as Record, // { atmosphereId: volume (0-100) } + isLoading: true, + error: null as string | null, + currentTime: 0, + duration: 0, - presets: [] as Preset[], - stations: [] as Station[], - backgrounds: [] as Background[], - atmospheres: [] as Atmosphere[], - - // in daemon.svelte - togglePlay: (() => {}) as () => void + presets: [] as Preset[], + stations: [] as Station[], + backgrounds: [] as Background[], + atmospheres: [] as Atmosphere[], + + // in daemon.svelte + togglePlay: (() => {}) as () => void, }); diff --git a/src/lib/types.ts b/src/lib/types.ts index 691082f..67a6be4 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,77 +1,76 @@ export interface Song { - id: number - fileId: number - artists: string - title: string - image: string - likes: number - featured?: string - releaseDate: string - releaseDateText: string - duration: number - isrc: string - label: string - spotifyId: string - startTime: string - endTime: string + id: number; + fileId: number; + artists: string; + title: string; + image: string; + likes: number; + featured?: string; + releaseDate: string; + releaseDateText: string; + duration: number; + isrc: string; + label: string; + spotifyId: string; + startTime: string; + endTime: string; } export interface Preset { - id: number; - userId: number; - name: string; - backgroundId: string; - stationId: string; // Represented as string in JSON - atmospheres: string; // JSON stringified object - sortOrder: number; - key: string; + id: number; + userId: number; + name: string; + backgroundId: string; + stationId: string; // Represented as string in JSON + atmospheres: string; // JSON stringified object + sortOrder: number; + key: string; } export interface StationMetaSocials { - spotify: string | null; - apple: string | null; + spotify: string | null; + apple: string | null; } export interface StationMetaIcon { - static: string; + static: string; } // Structure within the base64 decoded 'meta' string for stations export interface DecodedStationMeta { - shortDescription: string; - icon: StationMetaIcon; - socials: StationMetaSocials; + shortDescription: string; + icon: StationMetaIcon; + socials: StationMetaSocials; } - export interface Station { - name: string; - id: number; - meta: string; // Base64 encoded JSON string (DecodedStationMeta) + name: string; + id: number; + meta: string; // Base64 encoded JSON string (DecodedStationMeta) } export interface Background { - id: string; - name: string; - parentId: string | null; - landscapeUrl: string; - portraitUrl: string; - thumbnailUrl: string; - sortOrder: number; - isActive: number; // 0 or 1 + id: string; + name: string; + parentId: string | null; + landscapeUrl: string; + portraitUrl: string; + thumbnailUrl: string; + sortOrder: number; + isActive: number; // 0 or 1 } export interface Atmosphere { - id: string; - name: string; - url: string; - sortOrder: number; - urlMobile: string; + id: string; + name: string; + url: string; + sortOrder: number; + urlMobile: string; } export interface ChillhopData { - presets: Preset[]; - stations: Station[]; - backgrounds: Background[]; - atmospheres: Atmosphere[]; -} \ No newline at end of file + presets: Preset[]; + stations: Station[]; + backgrounds: Background[]; + atmospheres: Atmosphere[]; +} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index bd553d8..ef0b0d1 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,19 +1,19 @@ -import { type ClassValue, clsx } from "clsx"; -import { twMerge } from "tailwind-merge"; -import type { ChillhopData, Song } from "./types"; +import { type ClassValue, clsx } from 'clsx'; +import { twMerge } from 'tailwind-merge'; +import type { ChillhopData, Song } from './types'; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); + return twMerge(clsx(inputs)); } export async function getGeneralData() { - const res = await fetch('https://stream.chillhop.com/presets') - const data = await res.json() as ChillhopData; - return data; + const res = await fetch('https://stream.chillhop.com/presets'); + const data = (await res.json()) as ChillhopData; + return data; } export async function getStationSongs(stationId: number) { - const res = await fetch(`https://stream.chillhop.com/live/${stationId}`) - const data = await res.json() as Song[]; - return data; + const res = await fetch(`https://stream.chillhop.com/live/${stationId}`); + const data = (await res.json()) as Song[]; + return data; } diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9b776b7..34832d6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,6 +1,6 @@ {@render children()} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 670cc42..608aaff 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,10 +1,9 @@ @@ -21,9 +20,9 @@

Loading...

{:else if state.error} -
+

Error: {state.error}

-
+
{:else if state.hasInteracted} -{/if} \ No newline at end of file +{/if} diff --git a/svelte.config.js b/svelte.config.js index b025dd7..41c43c3 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,21 +1,21 @@ -import adapter from "@sveltejs/adapter-auto"; +import adapter from '@sveltejs/adapter-auto'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; /** @type {import('@sveltejs/kit').Config} */ const config = { - // Consult https://svelte.dev/docs/kit/integrations - // for more information about preprocessors - preprocess: vitePreprocess(), + // Consult https://svelte.dev/docs/kit/integrations + // for more information about preprocessors + preprocess: vitePreprocess(), - kit: { - // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. - // If your environment is not supported, or you settled on a specific environment, switch out the adapter. - // See https://svelte.dev/docs/kit/adapters for more information about adapters. - adapter: adapter(), - alias: { - "@/*": "./src/lib/*", - }, - } + kit: { + // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. + // If your environment is not supported, or you settled on a specific environment, switch out the adapter. + // See https://svelte.dev/docs/kit/adapters for more information about adapters. + adapter: adapter(), + alias: { + '@/*': './src/lib/*', + }, + }, }; export default config; diff --git a/tailwind.config.ts b/tailwind.config.ts index d91ff63..4e96cd4 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,96 +1,96 @@ -import { fontFamily } from "tailwindcss/defaultTheme"; -import type { Config } from "tailwindcss"; -import tailwindcssAnimate from "tailwindcss-animate"; +import { fontFamily } from 'tailwindcss/defaultTheme'; +import type { Config } from 'tailwindcss'; +import tailwindcssAnimate from 'tailwindcss-animate'; const config: Config = { - darkMode: ["class"], - content: ["./src/**/*.{html,js,svelte,ts}"], - safelist: ["dark"], - theme: { - container: { - center: true, - padding: "2rem", - screens: { - "2xl": "1400px" - } - }, - extend: { - colors: { - border: "hsl(var(--border) / )", - input: "hsl(var(--input) / )", - ring: "hsl(var(--ring) / )", - background: "hsl(var(--background) / )", - foreground: "hsl(var(--foreground) / )", - primary: { - DEFAULT: "hsl(var(--primary) / )", - foreground: "hsl(var(--primary-foreground) / )" - }, - secondary: { - DEFAULT: "hsl(var(--secondary) / )", - foreground: "hsl(var(--secondary-foreground) / )" - }, - destructive: { - DEFAULT: "hsl(var(--destructive) / )", - foreground: "hsl(var(--destructive-foreground) / )" - }, - muted: { - DEFAULT: "hsl(var(--muted) / )", - foreground: "hsl(var(--muted-foreground) / )" - }, - accent: { - DEFAULT: "hsl(var(--accent) / )", - foreground: "hsl(var(--accent-foreground) / )" - }, - popover: { - DEFAULT: "hsl(var(--popover) / )", - foreground: "hsl(var(--popover-foreground) / )" - }, - card: { - DEFAULT: "hsl(var(--card) / )", - foreground: "hsl(var(--card-foreground) / )" - }, - sidebar: { - DEFAULT: "hsl(var(--sidebar-background))", - foreground: "hsl(var(--sidebar-foreground))", - primary: "hsl(var(--sidebar-primary))", - "primary-foreground": "hsl(var(--sidebar-primary-foreground))", - accent: "hsl(var(--sidebar-accent))", - "accent-foreground": "hsl(var(--sidebar-accent-foreground))", - border: "hsl(var(--sidebar-border))", - ring: "hsl(var(--sidebar-ring))", - }, - }, - borderRadius: { - xl: "calc(var(--radius) + 4px)", - lg: "var(--radius)", - md: "calc(var(--radius) - 2px)", - sm: "calc(var(--radius) - 4px)" - }, - fontFamily: { - sans: [...fontFamily.sans] - }, - keyframes: { - "accordion-down": { - from: { height: "0" }, - to: { height: "var(--bits-accordion-content-height)" }, - }, - "accordion-up": { - from: { height: "var(--bits-accordion-content-height)" }, - to: { height: "0" }, - }, - "caret-blink": { - "0%,70%,100%": { opacity: "1" }, - "20%,50%": { opacity: "0" }, - }, - }, - animation: { - "accordion-down": "accordion-down 0.2s ease-out", - "accordion-up": "accordion-up 0.2s ease-out", - "caret-blink": "caret-blink 1.25s ease-out infinite", - }, - }, - }, - plugins: [tailwindcssAnimate], + darkMode: ['class'], + content: ['./src/**/*.{html,js,svelte,ts}'], + safelist: ['dark'], + theme: { + container: { + center: true, + padding: '2rem', + screens: { + '2xl': '1400px', + }, + }, + extend: { + colors: { + border: 'hsl(var(--border) / )', + input: 'hsl(var(--input) / )', + ring: 'hsl(var(--ring) / )', + background: 'hsl(var(--background) / )', + foreground: 'hsl(var(--foreground) / )', + primary: { + DEFAULT: 'hsl(var(--primary) / )', + foreground: 'hsl(var(--primary-foreground) / )', + }, + secondary: { + DEFAULT: 'hsl(var(--secondary) / )', + foreground: 'hsl(var(--secondary-foreground) / )', + }, + destructive: { + DEFAULT: 'hsl(var(--destructive) / )', + foreground: 'hsl(var(--destructive-foreground) / )', + }, + muted: { + DEFAULT: 'hsl(var(--muted) / )', + foreground: 'hsl(var(--muted-foreground) / )', + }, + accent: { + DEFAULT: 'hsl(var(--accent) / )', + foreground: 'hsl(var(--accent-foreground) / )', + }, + popover: { + DEFAULT: 'hsl(var(--popover) / )', + foreground: 'hsl(var(--popover-foreground) / )', + }, + card: { + DEFAULT: 'hsl(var(--card) / )', + foreground: 'hsl(var(--card-foreground) / )', + }, + sidebar: { + DEFAULT: 'hsl(var(--sidebar-background))', + foreground: 'hsl(var(--sidebar-foreground))', + primary: 'hsl(var(--sidebar-primary))', + 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))', + accent: 'hsl(var(--sidebar-accent))', + 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))', + border: 'hsl(var(--sidebar-border))', + ring: 'hsl(var(--sidebar-ring))', + }, + }, + borderRadius: { + xl: 'calc(var(--radius) + 4px)', + lg: 'var(--radius)', + md: 'calc(var(--radius) - 2px)', + sm: 'calc(var(--radius) - 4px)', + }, + fontFamily: { + sans: [...fontFamily.sans], + }, + keyframes: { + 'accordion-down': { + from: { height: '0' }, + to: { height: 'var(--bits-accordion-content-height)' }, + }, + 'accordion-up': { + from: { height: 'var(--bits-accordion-content-height)' }, + to: { height: '0' }, + }, + 'caret-blink': { + '0%,70%,100%': { opacity: '1' }, + '20%,50%': { opacity: '0' }, + }, + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + 'caret-blink': 'caret-blink 1.25s ease-out infinite', + }, + }, + }, + plugins: [tailwindcssAnimate], }; export default config; diff --git a/tsconfig.json b/tsconfig.json index 0b2d886..f4d0a0e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,19 @@ { - "extends": "./.svelte-kit/tsconfig.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "sourceMap": true, - "strict": true, - "moduleResolution": "bundler" - } - // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias - // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files - // - // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes - // from the referenced tsconfig.json - TypeScript does not merge them in + "extends": "./.svelte-kit/tsconfig.json", + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "moduleResolution": "bundler" + } + // Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias + // except $lib which is handled by https://svelte.dev/docs/kit/configuration#files + // + // If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes + // from the referenced tsconfig.json - TypeScript does not merge them in } diff --git a/vite.config.ts b/vite.config.ts index bbf8c7d..2e920e4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,5 +2,5 @@ import { sveltekit } from '@sveltejs/kit/vite'; import { defineConfig } from 'vite'; export default defineConfig({ - plugins: [sveltekit()] + plugins: [sveltekit()], }); diff --git a/yarn.lock b/yarn.lock index d5b25b1..e68344b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1539,6 +1539,11 @@ postcss@^8.4.47, postcss@^8.5.3: picocolors "^1.1.1" source-map-js "^1.2.1" +prettier-plugin-svelte@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-3.3.3.tgz#49d5c025a1516063ac7ef026806f880caa310424" + integrity sha512-yViK9zqQ+H2qZD1w/bH7W8i+bVfKrD8GIFjkFe4Thl6kCT9SlAsXVNmt3jCvQOCsnOhcvYgsoVlRV/Eu6x5nNw== + prettier@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5"