From bfd21d6413d969f5919de45e5afbd4e899fc2f2d Mon Sep 17 00:00:00 2001 From: David Date: Fri, 11 Aug 2023 15:50:35 -0500 Subject: [PATCH] feat: profile page --- apps/web/src/app.postcss | 8 +++ .../src/lib/components/PageTransition.svelte | 2 +- .../src/lib/components/layout/NavBar.svelte | 2 +- apps/web/src/routes/mod/[mod]/+page.svelte | 2 - apps/web/src/routes/profile/[id]/+page.svelte | 64 +++++++++++++++++ apps/web/src/routes/profile/[id]/+page.ts | 69 +++++++++++++++++++ packages/ui/icons/AtSymbol.svelte | 9 +++ packages/ui/icons/index.ts | 3 +- 8 files changed, 154 insertions(+), 5 deletions(-) create mode 100644 apps/web/src/routes/profile/[id]/+page.svelte create mode 100644 apps/web/src/routes/profile/[id]/+page.ts create mode 100644 packages/ui/icons/AtSymbol.svelte diff --git a/apps/web/src/app.postcss b/apps/web/src/app.postcss index 3a4b1f7..7ba6b10 100644 --- a/apps/web/src/app.postcss +++ b/apps/web/src/app.postcss @@ -33,3 +33,11 @@ select { img[alt] { text-indent: -9999px; } + +img { + -webkit-user-drag: none; + -khtml-user-drag: none; + -moz-user-drag: none; + -o-user-drag: none; + user-drag: none; +} \ No newline at end of file diff --git a/apps/web/src/lib/components/PageTransition.svelte b/apps/web/src/lib/components/PageTransition.svelte index 026a687..f25908a 100644 --- a/apps/web/src/lib/components/PageTransition.svelte +++ b/apps/web/src/lib/components/PageTransition.svelte @@ -5,7 +5,7 @@ {#key pathname} -
+
{/key} \ No newline at end of file diff --git a/apps/web/src/lib/components/layout/NavBar.svelte b/apps/web/src/lib/components/layout/NavBar.svelte index 7372028..e2196d2 100644 --- a/apps/web/src/lib/components/layout/NavBar.svelte +++ b/apps/web/src/lib/components/layout/NavBar.svelte @@ -25,7 +25,7 @@ Discover Mods {#if $isAuthenticated} - + {$user.user.username} user icon diff --git a/apps/web/src/routes/mod/[mod]/+page.svelte b/apps/web/src/routes/mod/[mod]/+page.svelte index c748b6d..cc4e9b9 100644 --- a/apps/web/src/routes/mod/[mod]/+page.svelte +++ b/apps/web/src/routes/mod/[mod]/+page.svelte @@ -13,8 +13,6 @@ import { CalendarIcon, PersonIcon, DownloadIcon, CopyIcon, GithubIcon, CheckmarkIcon, VerifiedIcon, CategoryIcon, NotVerifiedIcon } from 'ui/icons'; import Button from 'ui/button/Button.svelte'; - console.log(modData); - const handleCopy = () => { navigator.clipboard.writeText(modData.id) copiedState.set(true) diff --git a/apps/web/src/routes/profile/[id]/+page.svelte b/apps/web/src/routes/profile/[id]/+page.svelte new file mode 100644 index 0000000..450a15c --- /dev/null +++ b/apps/web/src/routes/profile/[id]/+page.svelte @@ -0,0 +1,64 @@ + + +
+
+
+
+
+
+ icon +
+
+
+
+
+

{userData.displayName ? userData.displayName : userData.username}

+
+

+ {userData.bio} +

+
+ + + + + + +
+
+
+ +
+

Mods by {userData.displayName ? userData.displayName : userData.username}

+
+
+
+
+ + \ No newline at end of file diff --git a/apps/web/src/routes/profile/[id]/+page.ts b/apps/web/src/routes/profile/[id]/+page.ts new file mode 100644 index 0000000..99a4fe0 --- /dev/null +++ b/apps/web/src/routes/profile/[id]/+page.ts @@ -0,0 +1,69 @@ +import type { PageLoad } from './$types'; +import { env } from '$env/dynamic/public'; + +export const load = (async ({ params }) => { + const id = params.id; + try { + const response = await fetch(`${env.PUBLIC_API_URL}/graphql`, { + method: 'POST', + headers: { + 'content-type': 'application/json' + }, + body: JSON.stringify({ + query: ` + query($user: Uuid!, $auth: String) { + userById(id: $user, auth: $auth) { + username + displayName + bio + avatar + banner + id + createdAt + updatedAt + mods { + id + slug + name + description + icon + cover + category { + name + } + stats { + downloads + } + updatedAt + createdAt + versions { + version + approved + supportedGameVersions + } + } + } + } + `, + variables: { + user: id, + auth: null + } + }) + }); + let data = await response.json() + return { + status: 200, + body: { + data: data.data.userById + } + }; + } catch (error) { + return { + status: 500, + body: { + error: error.message + } + }; + } +}) satisfies PageLoad; \ No newline at end of file diff --git a/packages/ui/icons/AtSymbol.svelte b/packages/ui/icons/AtSymbol.svelte new file mode 100644 index 0000000..c946d96 --- /dev/null +++ b/packages/ui/icons/AtSymbol.svelte @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/packages/ui/icons/index.ts b/packages/ui/icons/index.ts index 8e19a3b..4d68b68 100644 --- a/packages/ui/icons/index.ts +++ b/packages/ui/icons/index.ts @@ -12,4 +12,5 @@ export { default as LogoIcon } from './Logo.svelte'; export { default as NotVerifiedIcon } from './NotVerified.svelte'; export { default as PersonIcon } from './Person.svelte'; export { default as SearchIcon } from './Search.svelte'; -export { default as VerifiedIcon } from './Verified.svelte'; \ No newline at end of file +export { default as VerifiedIcon } from './Verified.svelte'; +export { default as AtSymbolIcon } from './AtSymbol.svelte' \ No newline at end of file