diff --git a/.gitignore b/.gitignore index 84010ba..c798467 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ client/dev-dist/ # Test results e2e/test-results/ + +# Ideas/notes +ideas.md diff --git a/README.md b/README.md index 28eaf07..ad083aa 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Spiceflow +The ~~spice~~ *tokens* must flow. + A mobile-friendly web app for controlling AI coding assistants (Claude Code, OpenCode) remotely. ``` diff --git a/client/src/lib/components/SessionSettings.svelte b/client/src/lib/components/SessionSettings.svelte index 8e9cf58..2410f0f 100644 --- a/client/src/lib/components/SessionSettings.svelte +++ b/client/src/lib/components/SessionSettings.svelte @@ -5,6 +5,7 @@ export let autoScroll: boolean = true; export let provider: 'claude' | 'opencode' | 'tmux' = 'claude'; export let showBigMode: boolean = false; + export let lastSessionId: string | null = null; const dispatch = createEventDispatcher<{ toggleAutoAccept: boolean; @@ -13,6 +14,7 @@ refresh: void; eject: void; bigMode: void; + goToLastSession: void; }>(); function handleToggleAutoScroll() { @@ -54,6 +56,11 @@ open = false; } + function handleGoToLastSession() { + dispatch('goToLastSession'); + open = false; + } + function handleClickOutside(event: MouseEvent) { const target = event.target as HTMLElement; if (!target.closest('.settings-dropdown')) { @@ -140,6 +147,19 @@ Refresh + + {#if lastSessionId} + + {/if} + {#if provider !== 'tmux'} + {#if lastSessionId} + + + {/if} diff --git a/client/src/routes/session/[id]/+page.svelte b/client/src/routes/session/[id]/+page.svelte index 8a63ae1..15ba498 100644 --- a/client/src/routes/session/[id]/+page.svelte +++ b/client/src/routes/session/[id]/+page.svelte @@ -24,6 +24,7 @@ let autoScroll = true; let tmuxAlive = false; let isMobile = false; + let lastSessionId: string | null = null; // Load auto-scroll preference from localStorage and detect mobile onMount(() => { @@ -32,6 +33,8 @@ if (stored !== null) { autoScroll = stored === 'true'; } + // Load last session from localStorage + lastSessionId = localStorage.getItem('spiceflow-last-session'); // Detect mobile (screen width < 640px or height < 450px) const checkMobile = () => { isMobile = window.innerWidth < 640 || window.innerHeight < 450; @@ -42,11 +45,28 @@ } }); + // Track session history when navigating to a new session + let previousSessionId: string | null = null; + $: if (browser && sessionId && sessionId !== previousSessionId) { + // Save the previous session as "last session" before switching + if (previousSessionId) { + localStorage.setItem('spiceflow-last-session', previousSessionId); + lastSessionId = previousSessionId; + } + previousSessionId = sessionId; + } + // Load session when sessionId changes (handles client-side navigation) $: if (sessionId) { activeSession.load(sessionId); } + function goToLastSession() { + if (lastSessionId) { + goto(`/session/${lastSessionId}`); + } + } + function handleToggleAutoScroll(event: CustomEvent) { autoScroll = event.detail; if (browser) { @@ -236,6 +256,7 @@ @@ -326,6 +348,17 @@ Refresh + {#if lastSessionId} + + {/if} {#if !isTmuxSession}