aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/APITypes.d.ts30
-rw-r--r--src/lib/LoginButton.svelte32
-rw-r--r--src/lib/api.ts2
3 files changed, 62 insertions, 2 deletions
diff --git a/src/lib/APITypes.d.ts b/src/lib/APITypes.d.ts
index 3a54cea..b0deee0 100644
--- a/src/lib/APITypes.d.ts
+++ b/src/lib/APITypes.d.ts
@@ -162,4 +162,32 @@ export interface ElectionData {
year: number
candidates: Candidate[]
} | null
-} \ No newline at end of file
+}
+
+interface SessionSchema {
+ _id?: string
+ refresh_token: string
+ discord_user: {
+ id: string
+ name: string
+ }
+ lastUpdated: Date
+}
+
+export interface AccountCustomization {
+ backgroundUrl?: string
+ pack?: string
+ emoji?: string
+}
+
+export interface AccountSchema {
+ _id?: string
+ discordId: string
+ minecraftUuid?: string
+ customization?: AccountCustomization
+}
+
+export interface CleanSocialMedia {
+ discord: string | null
+ forums: string | null
+}
diff --git a/src/lib/LoginButton.svelte b/src/lib/LoginButton.svelte
new file mode 100644
index 0000000..bba078e
--- /dev/null
+++ b/src/lib/LoginButton.svelte
@@ -0,0 +1,32 @@
+<script lang="ts">
+ export let loggedIn: boolean
+</script>
+
+<div class="login-button-container">
+ {#if loggedIn}
+ <a href="/profile"><button class="login-button">Edit profile</button></a>
+ {:else}
+ <a href="/login">
+ <button class="login-button"
+ ><img src="/discord-mark-light.svg" alt="Discord logo" />Log in with Discord</button
+ >
+ </a>
+ {/if}
+</div>
+
+<style>
+ .login-button-container {
+ position: absolute;
+ top: 0.5em;
+ right: 0.5em;
+ }
+ .login-button {
+ color: var(--theme-main-text);
+ }
+ img {
+ height: 1em;
+ vertical-align: middle;
+ margin-right: 0.3em;
+ opacity: 0.9;
+ }
+</style>
diff --git a/src/lib/api.ts b/src/lib/api.ts
index db6bf81..243cf2b 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -1 +1 @@
-export const API_URL = 'https://skyblock-api.matdoes.dev/' \ No newline at end of file
+export const API_URL = 'https://skyblock-api.matdoes.dev/'