refactor: move View Stats and Sign In/Out buttons into DevButtons

Consolidates the dev-only stats and auth buttons into the DevButtons
component, passing user and onSignIn as props. Also comments out the
Twitter link in SocialLinks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
George Powell
2026-03-13 11:47:03 -04:00
parent 884bbe65c7
commit ae4482a551
3 changed files with 46 additions and 40 deletions

View File

@@ -1,8 +1,21 @@
<script lang="ts">
import { browser } from "$app/environment";
import { enhance } from "$app/forms";
import Button from "$lib/components/Button.svelte";
let { anonymousId }: { anonymousId: string | null } = $props();
type User = {
id: string;
email?: string | null;
firstName?: string | null;
lastName?: string | null;
appleId?: string | null;
} | null;
let {
anonymousId,
user,
onSignIn,
}: { anonymousId: string | null; user: User; onSignIn: () => void } = $props();
let seeding = $state(false);
@@ -46,6 +59,35 @@
<div class="border-t-2 border-gray-400"></div>
</div>
<div class="flex flex-col gap-3">
<a
href="/stats?{user
? `userId=${user.id}`
: `anonymousId=${anonymousId}`}&tz={encodeURIComponent(
Intl.DateTimeFormat().resolvedOptions().timeZone,
)}"
class="inline-flex items-center justify-center w-full px-4 py-4 md:py-2 bg-amber-600 text-white rounded-lg hover:bg-amber-700 transition-colors text-sm font-medium shadow-md"
>
📊 View Stats
</a>
{#if user}
<form method="POST" action="/auth/logout" use:enhance class="w-full">
<button
type="submit"
class="inline-flex items-center justify-center w-full px-4 py-4 md:py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors text-sm font-medium shadow-md"
>
🚪 Sign Out
</button>
</form>
{:else}
<button
onclick={onSignIn}
class="inline-flex items-center justify-center w-full px-4 py-4 md:py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors text-sm font-medium shadow-md"
>
🔐 Sign In
</button>
{/if}
<div class="flex flex-col md:flex-row gap-3 md:gap-2">
<Button
variant="secondary"