Skip to content

Commit fa984e7

Browse files
Merge pull request #13 from cameroncuster/filtering
requested improvements
2 parents cd6ac7b + 2a97953 commit fa984e7

File tree

4 files changed

+431
-39
lines changed

4 files changed

+431
-39
lines changed

src/app.css

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
--color-link: oklch(0.65 0.26 296.88);
2626
--color-link-subtle: oklch(0.8 0.1 296.88);
2727
--color-link-nav: oklch(1 0 0 / 0.8);
28+
--color-username: oklch(0.65 0.26 296.88); /* Purple color for usernames */
29+
--color-solved-row: color-mix(
30+
in oklab,
31+
rgb(34 197 94) 15%,
32+
transparent
33+
); /* Light green for solved rows */
2834

2935
/* Codeforces rating colors */
3036
--color-legendary-grandmaster: oklch(0.65 0.27 29.23);
@@ -143,14 +149,16 @@ table a {
143149
/* User links in tables - keep them purple */
144150
.table a[href*='github.com'],
145151
table a[href*='github.com'],
146-
table td:nth-child(5) a {
147-
color: var(--color-accent);
152+
table td:nth-child(5) a,
153+
table td:nth-child(6) a {
154+
color: var(--color-username);
148155
}
149156

150157
.table a[href*='github.com']:hover,
151158
table a[href*='github.com']:hover,
152-
table td:nth-child(5) a:hover {
153-
color: color-mix(in oklab, var(--color-accent) 80%, white);
159+
table td:nth-child(5) a:hover,
160+
table td:nth-child(6) a:hover {
161+
color: color-mix(in oklab, var(--color-username) 80%, white);
154162
}
155163

156164
.table a:hover,

src/lib/components/Header.svelte

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { page } from '$app/stores';
2+
import { page } from '$app/stores'; // TODO: Update to newer API when refactoring
33
import { user } from '$lib/services/auth';
44
import { signInWithGithub, signOut, isAdmin } from '$lib/services/auth';
55
import { onMount } from 'svelte';
@@ -24,13 +24,20 @@ onMount(() => {
2424
// Mark component as mounted
2525
isMounted = true;
2626
27+
// Set a small timeout to ensure smooth loading and prevent flashing
28+
setTimeout(() => {
29+
if (isMounted) {
30+
// Only set authLoading to false if we have user data or after a timeout
31+
if ($user || !$user) {
32+
authLoading = false;
33+
}
34+
}
35+
}, 300);
36+
2737
// Set up a subscription to the user store
2838
const unsubscribe = user.subscribe(async (value) => {
29-
// Only set authLoading to false if we're mounted
39+
// Only update user data if we're mounted
3040
if (isMounted) {
31-
// Small delay to ensure DOM is ready
32-
authLoading = false;
33-
3441
// Check if the user is an admin
3542
if (value) {
3643
isUserAdmin = await isAdmin(value.id);
@@ -194,16 +201,17 @@ $: if ($page) {
194201
{/if}
195202
</ul>
196203
<div
197-
class="mr-4 flex min-w-[70px] items-center justify-end gap-3 opacity-100 transition-opacity duration-200 sm:mr-2 md:mr-0 {authLoading
204+
class="mr-4 flex min-w-[70px] items-center justify-end gap-3 transition-opacity duration-300 sm:mr-2 md:mr-0 {authLoading
198205
? 'invisible opacity-0'
199-
: ''}"
206+
: 'visible opacity-100'}"
207+
style="will-change: opacity;"
200208
>
201209
{#if $user}
202210
<a
203211
href={githubUrl}
204212
target="_blank"
205213
rel="noopener noreferrer"
206-
class="text-sm font-medium text-[var(--color-heading)] transition-colors duration-200 hover:text-[var(--color-accent)]"
214+
class="text-sm font-medium text-[var(--color-username)] transition-colors duration-200 hover:text-[color-mix(in_oklab,var(--color-username)_80%,white)]"
207215
>
208216
@{username}
209217
</a>
@@ -258,14 +266,15 @@ $: if ($page) {
258266
{/if}
259267
</ul>
260268
<div
261-
class="mt-2 flex items-center justify-start gap-3 px-1 {authLoading ? 'invisible opacity-0' : ''}"
269+
class="mt-2 flex items-center justify-start gap-3 px-1 transition-opacity duration-300 {authLoading ? 'invisible opacity-0' : 'visible opacity-100'}"
270+
style="will-change: opacity;"
262271
>
263272
{#if $user}
264273
<a
265274
href={githubUrl}
266275
target="_blank"
267276
rel="noopener noreferrer"
268-
class="text-sm font-medium text-[var(--color-heading)] transition-colors duration-200 hover:text-[var(--color-accent)]"
277+
class="text-sm font-medium text-[var(--color-username)] transition-colors duration-200 hover:text-[color-mix(in_oklab,var(--color-username)_80%,white)]"
269278
>
270279
@{username}
271280
</a>
@@ -312,4 +321,13 @@ header {
312321
left: 0;
313322
right: 0;
314323
}
324+
325+
/* Ensure username is always purple */
326+
a[href*='github.com'] {
327+
color: var(--color-username) !important;
328+
}
329+
330+
a[href*='github.com']:hover {
331+
color: color-mix(in oklab, var(--color-username) 80%, white) !important;
332+
}
315333
</style>

0 commit comments

Comments
 (0)