diff --git a/src/hooks.server.ts b/src/hooks.server.ts index e2b0e7f..5fd7e48 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -33,6 +33,10 @@ if (!building) { .then(({ startTournamentScheduler }) => startTournamentScheduler()) .catch((err) => log.tournament.warn({ err: err.message }, 'Tournament scheduler init skipped')); + import('$lib/server/discord/client') + .then(({ initDiscordClient }) => initDiscordClient()) + .catch((err) => log.discord.warn({ err: err.message }, 'Discord client init skipped')); + process.on('unhandledRejection', (reason) => { log.http.error({ err: reason }, 'Unhandled rejection'); }); diff --git a/src/lib/components/DataTable.svelte b/src/lib/components/DataTable.svelte new file mode 100644 index 0000000..1c961af --- /dev/null +++ b/src/lib/components/DataTable.svelte @@ -0,0 +1,222 @@ + + + +
+
+ + + + +
+ {meta.total} result{meta.total !== 1 ? 's' : ''} +
+ + +
+ + + + {#each columns as col} + + {/each} + + + + {#each data as item, i} + {@render row(item, i)} + {:else} + + + + {/each} + +
+ {#if col.sortable} + + {:else} + {col.label} + {/if} +
+ {meta.search ? `No results for "${meta.search}"` : 'No data'} +
+
+ + +{#if meta.totalPages > 1} +
+ + Showing {showingStart}–{showingEnd} of {meta.total} + +
+ + {#each pageButtons as p} + {#if p === '...'} + ... + {:else} + + {/if} + {/each} + +
+
+{/if} diff --git a/src/lib/components/ProfileComments.svelte b/src/lib/components/ProfileComments.svelte new file mode 100644 index 0000000..1af1201 --- /dev/null +++ b/src/lib/components/ProfileComments.svelte @@ -0,0 +1,114 @@ + + +
+

Comments

+ + {#if user} +
{ + posting = true; + return async ({ result, update }) => { + posting = false; + if (result.type === 'success') { + content = ''; + await update(); + } + }; + }} + class="mt-3" + > +
+ {#if user.image} + + {:else} +
+ {/if} +
+ +
+ +
+
+
+
+ {:else} +

Sign in to leave a comment.

+ {/if} + + {#if comments.length > 0} +
+ {#each comments as comment} +
+ {#if comment.author.image} + + + + {:else} + +
+ {comment.author.name.charAt(0).toUpperCase()} +
+
+ {/if} +
+
+ {comment.author.name} + {timeAgo(comment.createdAt)} +
+

+ {comment.content} +

+
+
+ {/each} +
+ {:else if !user} +

No comments yet.

+ {/if} +
diff --git a/src/lib/components/SearchModal.svelte b/src/lib/components/SearchModal.svelte new file mode 100644 index 0000000..8f09d49 --- /dev/null +++ b/src/lib/components/SearchModal.svelte @@ -0,0 +1,253 @@ + + + + +{#if open} + + + + + +{/if} diff --git a/src/lib/components/Sidebar.svelte b/src/lib/components/Sidebar.svelte index 7f94db5..b6916b6 100644 --- a/src/lib/components/Sidebar.svelte +++ b/src/lib/components/Sidebar.svelte @@ -6,7 +6,7 @@ const activeMatch = $derived(page.data?.activeMatch); const unreadCount = $derived((page.data as any)?.unreadNotificationCount ?? 0); - let { open = $bindable(false) } = $props(); + let { open = $bindable(false), guest = false } = $props(); let notifOpen = $state(false); let notifications = $state([]); let loadingNotifs = $state(false); @@ -232,7 +232,7 @@ Vash Esports - {#if user} + {#if user && !guest}
+ {:else if !activeMatch} - - {:else if !activeMatch} - - {/if} - + {/if} + + {/if}