diff --git a/.env b/.env index c1e8cb4..57a9640 100644 --- a/.env +++ b/.env @@ -1,12 +1,3 @@ # Copy to .env.local and edit -PUBLIC_API_ENDPOINT= -PUBLIC_OPENGRAPH_ENDPOINT= -PUBLIC_DISCORD_INVITE= -PUBLIC_SUPPORT_MAIL= -PUBLIC_GTM_ID= -PUBLIC_GA_ID= - -PUBLIC_USE_ACCOUNT= - -PUBLIC_TELEMETRY_ENDPOINT= -PUBLIC_TELEMETRY_API_KEY= +PUBLIC_API_BASE= +PUBLIC_ACCOUNT_SERVICE_URL= diff --git a/package.json b/package.json index 064f3b9..6c55911 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "server.js" ], "devDependencies": { - "@adofai-gg/ui": "1.2.0-beta.31", + "@adofai-gg/ui": "1.2.0-beta.35", "@commitlint/cli": "^18.4.3", "@commitlint/config-conventional": "^18.4.3", "@fluent/bundle": "^0.18.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c612e25..3fa6539 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,8 +25,8 @@ importers: version: 0.33.1 devDependencies: '@adofai-gg/ui': - specifier: 1.2.0-beta.31 - version: 1.2.0-beta.31(@melt-ui/svelte@0.83.0(svelte@5.0.0-next.257))(svelte@5.0.0-next.257) + specifier: 1.2.0-beta.35 + version: 1.2.0-beta.35(@melt-ui/svelte@0.83.0(svelte@5.0.0-next.257))(svelte@5.0.0-next.257) '@commitlint/cli': specifier: ^18.4.3 version: 18.4.3(typescript@5.3.3) @@ -166,8 +166,8 @@ packages: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} engines: {node: '>=0.10.0'} - '@adofai-gg/ui@1.2.0-beta.31': - resolution: {integrity: sha512-NkBpTDI04D7dtZ7tYGJHgIPAeUEFwPjQOVO7EEYJJmJam2jfbU3nHYmy064fwzzsxeGGnUuVNDY5vx5xoxZwEA==, tarball: https://npm.pkg.github.com/download/@adofai-gg/ui/1.2.0-beta.31/406ba137307b2cf5141d76fbd85655057256c76f} + '@adofai-gg/ui@1.2.0-beta.35': + resolution: {integrity: sha512-nVrh02WipmoamQxzbiBhN5OCQJD9neFo7A9UguuBHh954u+3KnV+jTX/3FmrdocxPv0+sRxYT56o+ylhNHcmYw==, tarball: https://npm.pkg.github.com/download/@adofai-gg/ui/1.2.0-beta.35/9872a8b354aa061f1d7c57bd7e8e4d2c33005c9f} peerDependencies: '@melt-ui/svelte': '*' svelte: '5' @@ -3679,7 +3679,7 @@ snapshots: '@aashutoshrathi/word-wrap@1.2.6': {} - '@adofai-gg/ui@1.2.0-beta.31(@melt-ui/svelte@0.83.0(svelte@5.0.0-next.257))(svelte@5.0.0-next.257)': + '@adofai-gg/ui@1.2.0-beta.35(@melt-ui/svelte@0.83.0(svelte@5.0.0-next.257))(svelte@5.0.0-next.257)': dependencies: '@fontsource/ibm-plex-sans-kr': 5.1.0 '@melt-ui/svelte': 0.83.0(svelte@5.0.0-next.257) diff --git a/src/lib/assets/defaultAvatars/dark.png b/src/lib/assets/defaultAvatars/dark.png new file mode 100644 index 0000000..ed79c9b Binary files /dev/null and b/src/lib/assets/defaultAvatars/dark.png differ diff --git a/src/lib/assets/defaultAvatars/light.png b/src/lib/assets/defaultAvatars/light.png new file mode 100644 index 0000000..54ccbbc Binary files /dev/null and b/src/lib/assets/defaultAvatars/light.png differ diff --git a/src/lib/components/UserListPanel.svelte b/src/lib/components/UserListPanel.svelte new file mode 100644 index 0000000..78014ad --- /dev/null +++ b/src/lib/components/UserListPanel.svelte @@ -0,0 +1,27 @@ + + + + + + + +
+ +
+
+ + diff --git a/src/lib/components/levelDetail/LevelDetailHeader.svelte b/src/lib/components/levelDetail/LevelDetailHeader.svelte index 8ff3562..a6e49a4 100644 --- a/src/lib/components/levelDetail/LevelDetailHeader.svelte +++ b/src/lib/components/levelDetail/LevelDetailHeader.svelte @@ -18,10 +18,15 @@ >
- legendary - recommended - unlisted - hidden + {#if level.quality === 'LEGENDARY'} + legendary + {:else if level.quality === 'FEATURED'} + recommended + {:else if level.quality === 'HIDDEN'} + hidden + {:else if level.quality === 'UNLISTED'} + unlisted + {/if}
{level.title} diff --git a/src/lib/localization/ko/level.ftl b/src/lib/localization/ko/level.ftl index 86f7f1a..6579bd5 100644 --- a/src/lib/localization/ko/level.ftl +++ b/src/lib/localization/ko/level.ftl @@ -1,3 +1,6 @@ song-length = 노래 길이 bpm = BPM -tiles = 타일 수 \ No newline at end of file +tiles = 타일 수 + +artists = 아티스트 +creators = 레벨 제작자 \ No newline at end of file diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index b14db58..1646259 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -3,6 +3,20 @@ export interface APITag { name: string } +export interface APIMember { + id: number + displayName: string + username: string | null + totalPp: number + avatar: string | null +} + +export interface APIMusic { + id: number + name: string + artists: APIMember[] +} + export interface APILevel { id: number appendingTitle: string | null @@ -21,7 +35,8 @@ export interface APILevel { title: string // file // thumbnail - // creators + creators: APIMember[] tags: APITag[] epilepsyWarning: boolean + music: APIMusic } diff --git a/src/lib/utils/avatar.ts b/src/lib/utils/avatar.ts new file mode 100644 index 0000000..70f1b5e --- /dev/null +++ b/src/lib/utils/avatar.ts @@ -0,0 +1,15 @@ +import type { APIMember } from '../types' +import { env } from '$env/dynamic/public' +import defaultDark from '$lib/assets/defaultAvatars/dark.png' +import defaultLight from '$lib/assets/defaultAvatars/light.png' + +export const getAvatarUrl = ( + user: APIMember, + usage: 'artist' | 'creator' | null = null +): string => { + if (!user.username) { + return usage === 'artist' ? defaultDark : defaultLight + } + + return `${env.PUBLIC_ACCOUNT_SERVICE_URL}/content/avatars/${user}/${user.avatar ?? 'default'}` +} diff --git a/src/lib/utils/converter.ts b/src/lib/utils/converter.ts new file mode 100644 index 0000000..65f74c2 --- /dev/null +++ b/src/lib/utils/converter.ts @@ -0,0 +1,11 @@ +import type { User } from '@adofai-gg/ui' +import type { APIMember } from '../types' +import { getAvatarUrl } from './avatar' + +export const convertUser = (from: APIMember, usage: 'artist' | 'creator' | null = null): User => { + return { + avatarURL: getAvatarUrl(from, usage), + displayName: from.displayName, + isAdmin: false + } +} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 4e30e76..cf244c3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,4 +1,5 @@
@@ -20,6 +45,8 @@
+ +
@@ -38,7 +65,10 @@ } .meta-area { + display: flex; + flex-direction: column; grid-column: span 12; + gap: 20px; } @include breakpoint('md') { diff --git a/src/routes/levels/[levelId]/+page.ts b/src/routes/levels/[levelId]/+page.ts index 2ea034a..57bfc0c 100644 --- a/src/routes/levels/[levelId]/+page.ts +++ b/src/routes/levels/[levelId]/+page.ts @@ -14,6 +14,8 @@ export const load: PageLoad = async ({ params, fetch }) => { const data: APILevel = await res.json() + console.log(data) + return { level: data, pageTitle: data.title