fix: clean up top-level components
- connection-status: remove unused import, fix timeout type, use $derived.by, fix dynamic icon - ThemeSelector: add key to each block - Header: remove unused variables, fix Tailwind class syntax - Sidebar: remove unused imports Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,26 +7,14 @@
|
|||||||
import { toggleMode } from "mode-watcher";
|
import { toggleMode } from "mode-watcher";
|
||||||
import ThemeSelector from './ThemeSelector.svelte';
|
import ThemeSelector from './ThemeSelector.svelte';
|
||||||
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
import Sun from '@lucide/svelte/icons/sun';
|
import Sun from '@lucide/svelte/icons/sun';
|
||||||
import Moon from '@lucide/svelte/icons/moon';
|
import Moon from '@lucide/svelte/icons/moon';
|
||||||
import User from '@lucide/svelte/icons/user';
|
import User from '@lucide/svelte/icons/user';
|
||||||
import Settings from '@lucide/svelte/icons/settings';
|
import Settings from '@lucide/svelte/icons/settings';
|
||||||
import LogOut from '@lucide/svelte/icons/log-out';
|
import LogOut from '@lucide/svelte/icons/log-out';
|
||||||
import Monitor from '@lucide/svelte/icons/monitor';
|
|
||||||
|
|
||||||
let { user, class: className = '' }: { user?: any; class?: string } = $props();
|
let { user, class: className = '' }: { user?: any; class?: string } = $props();
|
||||||
|
|
||||||
// Dark mode state - you might want to use a proper theme store
|
|
||||||
let darkMode = $state(false);
|
|
||||||
|
|
||||||
// Theme options
|
|
||||||
const themes = [
|
|
||||||
{ label: 'Light', value: 'light', icon: Sun },
|
|
||||||
{ label: 'Dark', value: 'dark', icon: Moon },
|
|
||||||
{ label: 'System', value: 'system', icon: Monitor }
|
|
||||||
];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class={cn(
|
<header class={cn(
|
||||||
@@ -45,10 +33,10 @@
|
|||||||
<!-- Dark Mode Toggle -->
|
<!-- Dark Mode Toggle -->
|
||||||
<Button onclick={toggleMode} variant="ghost" size="icon">
|
<Button onclick={toggleMode} variant="ghost" size="icon">
|
||||||
<Sun
|
<Sun
|
||||||
class="h-[1.2rem] w-[1.2rem] scale-100 rotate-0 !transition-all dark:scale-0 dark:-rotate-90"
|
class="h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all! dark:scale-0 dark:-rotate-90"
|
||||||
/>
|
/>
|
||||||
<Moon
|
<Moon
|
||||||
class="absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 !transition-all dark:scale-100 dark:rotate-0"
|
class="absolute h-[1.2rem] w-[1.2rem] scale-0 rotate-90 transition-all! dark:scale-100 dark:rotate-0"
|
||||||
/>
|
/>
|
||||||
<span class="sr-only">Toggle theme</span>
|
<span class="sr-only">Toggle theme</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { House, Settings, Activity, Goal, NotebookPen } from "@lucide/svelte";
|
||||||
import { House, Settings, Activity, CheckSquare, Bell, LayoutDashboard, Goal, NotebookPen } from "@lucide/svelte";
|
|
||||||
import * as Sidebar from "$lib/components/ui/sidebar/index";
|
import * as Sidebar from "$lib/components/ui/sidebar/index";
|
||||||
|
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
@@ -44,7 +43,7 @@
|
|||||||
<Sidebar.Menu>
|
<Sidebar.Menu>
|
||||||
<Sidebar.MenuItem>
|
<Sidebar.MenuItem>
|
||||||
<div class="flex gap-3 pt-2 px-1 items-center">
|
<div class="flex gap-3 pt-2 px-1 items-center">
|
||||||
<Goal class="h-6 w-6" />
|
<Goal class="h-6 w-6" />
|
||||||
<h1 class="text-lg font-semibold">bullseye</h1>
|
<h1 class="text-lg font-semibold">bullseye</h1>
|
||||||
</div>
|
</div>
|
||||||
</Sidebar.MenuItem>
|
</Sidebar.MenuItem>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<p class="text-sm font-medium text-muted-foreground">Primary Color</p>
|
<p class="text-sm font-medium text-muted-foreground">Primary Color</p>
|
||||||
|
|
||||||
<div class="grid grid-cols-3 gap-2">
|
<div class="grid grid-cols-3 gap-2">
|
||||||
{#each primaryColors as color}
|
{#each primaryColors as color (color.value)}
|
||||||
<button
|
<button
|
||||||
onclick={() => selectColor(color.value)}
|
onclick={() => selectColor(color.value)}
|
||||||
class="relative h-8 w-full rounded-md border border-border transition-transform hover:scale-105"
|
class="relative h-8 w-full rounded-md border border-border transition-transform hover:scale-105"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { useConnectionStatus } from '@triplit/svelte';
|
import { useConnectionStatus } from '@triplit/svelte';
|
||||||
import { triplit } from '$lib/triplit/client';
|
import { triplit } from '$lib/triplit/client';
|
||||||
import { cn } from '$lib/utils';
|
import { cn } from '$lib/utils';
|
||||||
import { onMount } from 'svelte';
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
import Wifi from '@lucide/svelte/icons/wifi';
|
import Wifi from '@lucide/svelte/icons/wifi';
|
||||||
@@ -14,7 +13,7 @@
|
|||||||
// Track overall connection attempt duration (including retries)
|
// Track overall connection attempt duration (including retries)
|
||||||
let initialConnectionAttemptTime = $state<number | null>(null);
|
let initialConnectionAttemptTime = $state<number | null>(null);
|
||||||
let hasTimedOut = $state(false);
|
let hasTimedOut = $state(false);
|
||||||
let timeoutId = $state<number | null>(null);
|
let timeoutId = $state<ReturnType<typeof setTimeout> | null>(null);
|
||||||
const CONNECTION_TIMEOUT = 15000; // 15 seconds for entire connection attempt
|
const CONNECTION_TIMEOUT = 15000; // 15 seconds for entire connection attempt
|
||||||
|
|
||||||
// Monitor connection status changes
|
// Monitor connection status changes
|
||||||
@@ -42,7 +41,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Map connection status to display info
|
// Map connection status to display info
|
||||||
const statusInfo = $derived(() => {
|
const statusInfo = $derived.by(() => {
|
||||||
// If we've timed out after trying to connect, show connection failed
|
// If we've timed out after trying to connect, show connection failed
|
||||||
if (hasTimedOut) {
|
if (hasTimedOut) {
|
||||||
return {
|
return {
|
||||||
@@ -89,7 +88,7 @@
|
|||||||
<div class="relative flex items-center">
|
<div class="relative flex items-center">
|
||||||
<div class={cn(
|
<div class={cn(
|
||||||
"h-2 w-2 rounded-full",
|
"h-2 w-2 rounded-full",
|
||||||
statusInfo().indicatorClass
|
statusInfo.indicatorClass
|
||||||
)}>
|
)}>
|
||||||
</div>
|
</div>
|
||||||
<!-- Pulse animation for connecting state -->
|
<!-- Pulse animation for connecting state -->
|
||||||
@@ -103,17 +102,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Status Icon -->
|
<!-- Status Icon -->
|
||||||
{#snippet iconSnippet()}
|
{#if statusInfo.icon}
|
||||||
{@const IconComponent = statusInfo().icon}
|
{@const Icon = statusInfo.icon}
|
||||||
<IconComponent
|
<Icon class={cn("h-3 w-3", statusInfo.iconClass)} />
|
||||||
class={cn("h-3 w-3", statusInfo().iconClass)}
|
{/if}
|
||||||
/>
|
|
||||||
{/snippet}
|
|
||||||
{@render iconSnippet()}
|
|
||||||
|
|
||||||
<!-- Status Text -->
|
<!-- Status Text -->
|
||||||
<span class="font-medium">
|
<span class="font-medium">
|
||||||
{statusInfo().text}
|
{statusInfo.text}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user