diff --git a/src/lib/components/MyProfile/UserSettings.svelte b/src/lib/components/MyProfile/UserSettings.svelte index d3b9f20..ee27d21 100644 --- a/src/lib/components/MyProfile/UserSettings.svelte +++ b/src/lib/components/MyProfile/UserSettings.svelte @@ -2,7 +2,6 @@ import { Button } from '$lib/components/ui/button'; import { copyToClipboard } from '$lib/utils/copyToClipboard'; import { confirmDelete } from '$lib/utils/confirmDelete'; - import { AudioLines } from 'lucide-svelte'; import { enhance } from '$app/forms'; import type { PageData } from '../../../routes/profile/$types'; import { IconBrandGithub, IconTrash, IconCopy } from '@tabler/icons-svelte'; @@ -20,24 +19,6 @@
-
-
Spotify Integration
-
- {#if data.spotifyToken} -
- -
- {:else} - - {/if} -
-
Collaboration Status
diff --git a/src/routes/profile/integrations/+page.server.ts b/src/routes/profile/integrations/+page.server.ts index 61055eb..83fd82f 100644 --- a/src/routes/profile/integrations/+page.server.ts +++ b/src/routes/profile/integrations/+page.server.ts @@ -7,6 +7,7 @@ import { redirect } from '@sveltejs/kit'; import type { User } from '@prisma/client'; import { getGitHubUserIdFromImageUrl } from '$lib/utils/getGithubIDFromImage'; import { createRecentActivity } from '$lib/utils/createRecentActivity'; +import { unlinkSpotify } from '$lib/utils/spotify/unlinkSpotify'; // Define the user variable with a possible null let user: User | null = null; @@ -89,5 +90,16 @@ export const actions: Actions = { console.error(err); return fail(500, { message: 'Something went wrong.' }); } + }, + unlinkSpotify: async () => { + if (user) { + try { + // delete + unlinkSpotify(user.githubId); + } catch (error) { + console.error(error); + throw Error('Failed to delete user'); + } + } } }; diff --git a/src/routes/profile/integrations/+page.svelte b/src/routes/profile/integrations/+page.svelte index 43be502..498033a 100644 --- a/src/routes/profile/integrations/+page.svelte +++ b/src/routes/profile/integrations/+page.svelte @@ -1,10 +1,14 @@ @@ -15,17 +19,50 @@ Integrations - - -
- - -
-
- - - -
+
+ +
+ + + Spotify + + Connect your Spotify account to display your currently playing song + + + + {#if data.spotifyToken} +
+
+ +
+ + +
+ {:else} + + {/if} +
+
+
+
diff --git a/src/routes/profile/settings/+page.server.ts b/src/routes/profile/settings/+page.server.ts index e27c9e5..24e560f 100644 --- a/src/routes/profile/settings/+page.server.ts +++ b/src/routes/profile/settings/+page.server.ts @@ -1,6 +1,5 @@ import type { Actions, PageServerLoad } from './$types'; import { deleteUser } from '$lib/utils/deleteUser'; -import { unlinkSpotify } from '$lib/utils/spotify/unlinkSpotify'; import { updateOpenToCollaborating } from '$lib/utils/updateOpenToCollaborating'; import { fail } from 'sveltekit-superforms'; import { getGitHubUserIdFromImageUrl } from '$lib/utils/getGithubIDFromImage'; @@ -58,16 +57,5 @@ export const actions: Actions = { throw Error('Failed to delete user'); } } - }, - unlinkSpotify: async () => { - if (user) { - try { - // delete - unlinkSpotify(user.githubId); - } catch (error) { - console.error(error); - throw Error('Failed to delete user'); - } - } } };