diff --git a/frontend/src/lib/assets/app.css b/frontend/src/lib/assets/app.css
index e562e9027f..b833582069 100644
--- a/frontend/src/lib/assets/app.css
+++ b/frontend/src/lib/assets/app.css
@@ -443,3 +443,65 @@ input[type='time']::-webkit-calendar-picker-indicator {
:root[data-home-sessions-transition='fade'] * {
view-transition-name: none !important;
}
+
+/* Home's Workspace ⇄ AI Sessions switch (swapHomeSide in homeSessionsTransition.svelte.ts).
+ Home is the same page beside either list, so only the sidebar's list moves. The page shows
+ its new state at once, live, which lets the composer's own opening or folding play; named,
+ the composer would be held to the size it had when the switch began. The list's name exists
+ only while the switch runs: carried at all times, a send's move to the session page would
+ animate it too. */
+:root[data-home-side-transition] .wm-vt-sidebar-list {
+ view-transition-name: home-sidebar-list;
+}
+:root[data-home-side-transition] [data-session-composer] {
+ view-transition-name: none !important;
+}
+:root[data-home-side-transition]::view-transition-old(root) {
+ display: none;
+}
+:root[data-home-side-transition]::view-transition-new(root) {
+ animation: none;
+}
+/* The list comes in from the side of the button pressed: AI Sessions is the right one. */
+:root[data-home-side-transition]::view-transition-old(home-sidebar-list),
+:root[data-home-side-transition]::view-transition-new(home-sidebar-list) {
+ animation-duration: 260ms;
+ animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
+ animation-fill-mode: both;
+}
+:root[data-home-side-transition='sessions']::view-transition-old(home-sidebar-list) {
+ animation-name: wm-side-out-left;
+}
+:root[data-home-side-transition='sessions']::view-transition-new(home-sidebar-list) {
+ animation-name: wm-side-in-right;
+}
+:root[data-home-side-transition='workspace']::view-transition-old(home-sidebar-list) {
+ animation-name: wm-side-out-right;
+}
+:root[data-home-side-transition='workspace']::view-transition-new(home-sidebar-list) {
+ animation-name: wm-side-in-left;
+}
+@keyframes wm-side-out-left {
+ to {
+ opacity: 0;
+ transform: translateX(-28px);
+ }
+}
+@keyframes wm-side-in-right {
+ from {
+ opacity: 0;
+ transform: translateX(28px);
+ }
+}
+@keyframes wm-side-out-right {
+ to {
+ opacity: 0;
+ transform: translateX(28px);
+ }
+}
+@keyframes wm-side-in-left {
+ from {
+ opacity: 0;
+ transform: translateX(-28px);
+ }
+}
diff --git a/frontend/src/lib/components/copilot/chat/AIChat.svelte b/frontend/src/lib/components/copilot/chat/AIChat.svelte
index 8d9f24df63..4852efa179 100644
--- a/frontend/src/lib/components/copilot/chat/AIChat.svelte
+++ b/frontend/src/lib/components/copilot/chat/AIChat.svelte
@@ -130,6 +130,10 @@
await aiChatDisplay?.attachContext(element)
}
+ export function foldComposer() {
+ aiChatDisplay?.foldComposer()
+ }
+
const historyManager = aiChatManager.historyManager
let aiChatDisplay: AIChatDisplay | undefined = $state(undefined)
diff --git a/frontend/src/lib/components/copilot/chat/AIChatDisplay.svelte b/frontend/src/lib/components/copilot/chat/AIChatDisplay.svelte
index cb17cc4388..7a5e1ac0b4 100644
--- a/frontend/src/lib/components/copilot/chat/AIChatDisplay.svelte
+++ b/frontend/src/lib/components/copilot/chat/AIChatDisplay.svelte
@@ -314,6 +314,14 @@
aiChatInput?.focusInput(selection)
}
+ /** A starter composer back on one line, as a press outside it does: not while it holds a
+ * draft, which is never hidden. Takes the caret out, or the next keypress reopens it. */
+ export function foldComposer() {
+ closeComposer()
+ if (!composerOpened && composerEl?.contains(document.activeElement))
+ (document.activeElement as HTMLElement).blur()
+ }
+
/** Mention a workspace item in the draft, as "+" → Mention file does, and hand the user
* the caret after it. Focusing is what opens Home's one-line composer. */
export async function attachContext(element: ContextElement) {
diff --git a/frontend/src/lib/components/copilot/chat/starter/composerCollapse.ts b/frontend/src/lib/components/copilot/chat/starter/composerCollapse.ts
index d21f04f1ba..5c082154fc 100644
--- a/frontend/src/lib/components/copilot/chat/starter/composerCollapse.ts
+++ b/frontend/src/lib/components/copilot/chat/starter/composerCollapse.ts
@@ -1,7 +1,10 @@
// The layers the composer's controls open render in portals under
, outside the
// composer's own element: DropdownV2 menus, melt popovers, and the settings modals. Not
// `[data-menu]`: DropdownV2 puts it on its trigger too, and Home has triggers everywhere.
-const OVERLAY = '[data-melt-dropdown-menu], [data-melt-popover-content], [role="dialog"]'
+// `.wm-modal-form-popup` is Modal2's box, which carries no dialog role: without it a press
+// inside Assistant settings folds the composer, and the modal goes with it.
+const OVERLAY =
+ '[data-melt-dropdown-menu], [data-melt-popover-content], [role="dialog"], .wm-modal-form-popup'
/** Whether a pointer-down outside the composer still leaves it open: it landed in a menu or
* dialog, or one is open, and the press is closing it rather than leaving the composer. */
diff --git a/frontend/src/lib/components/home/HomeAIChat.svelte b/frontend/src/lib/components/home/HomeAIChat.svelte
index bafbad135c..d0fe016745 100644
--- a/frontend/src/lib/components/home/HomeAIChat.svelte
+++ b/frontend/src/lib/components/home/HomeAIChat.svelte
@@ -17,7 +17,6 @@
import { logFeatureUsage } from '$lib/utils/featureUsage'
import { hubBaseUrlStore, roleCapabilities, workspaceStore } from '$lib/stores'
import { homeDraft, sessionState } from '../sessions/sessionState.svelte'
- import { homeListsSessions, homeSidebarList } from '../sessions/sidebarList.svelte'
import { currentWorkspaceRootId } from '../sessions/sessionScope.svelte'
import { HOME_SHOW_HUB } from '$lib/consts'
import { homeComposerPin, setHomeComposerRemoved } from './homeComposerPin.svelte'
@@ -93,10 +92,6 @@
)
let hero = $derived(showComposer && !removed)
-
- // Beside the session list Home is the AI side's page: the composer rests open there. Beside
- // the workspace nav it rests on one line.
- const sessionsListed = $derived(homeListsSessions())
@@ -118,19 +113,14 @@
fork shares its parent's, and remounting for it only flashes the block. Also keyed
on the asks for another draft (New session, a draft picked in the session list). -->
{#if HomeSessionStarter && sessionState.hydrated}
-
-
-
- No preview open
-
- Click a script, flow or app on Home to preview it here.
-
-
- {/if}
-
-
-
-{/if}
diff --git a/frontend/src/lib/components/home/HomeQuickAccess.svelte b/frontend/src/lib/components/home/HomeQuickAccess.svelte
index 2971d8e42b..493b6a0e8f 100644
--- a/frontend/src/lib/components/home/HomeQuickAccess.svelte
+++ b/frontend/src/lib/components/home/HomeQuickAccess.svelte
@@ -40,7 +40,7 @@
import HomeSectionLabel from './HomeSectionLabel.svelte'
import HomeSectionCount from './HomeSectionCount.svelte'
import { QUICK_ACCESS_ROWS, homeQuickAccessSettings } from './homeQuickAccessSettings.svelte'
- import { homeListsSessions } from '$lib/components/sessions/sidebarList.svelte'
+ import { sessionsSwitchShown } from '$lib/components/sessions/sidebarList.svelte'
import {
getEffectiveWorkspaceId,
homeDraft,
@@ -78,6 +78,24 @@
const RECENT_COUNT = 6
+ // The workspace's last sessions, one row of them: sent ones and drafts with text, not Home's
+ // own draft, which is the composer above. The session list holds the rest.
+ const CONTINUE_COUNT = 3
+ let continueSessions = $derived(
+ sessionsSwitchShown()
+ ? sessionState.sessions
+ .filter(
+ (s) =>
+ !s.archived &&
+ s.id !== homeDraft.id &&
+ (!!s.workspace_id || !!s.draftPrompt?.trim()) &&
+ getEffectiveWorkspaceId(s) === workspace
+ )
+ .sort((a, b) => sessionLastActivityAt(b) - sessionLastActivityAt(a))
+ .slice(0, CONTINUE_COUNT)
+ : []
+ )
+
// The way back from Hide from Home is in the header menu HomeAIChat adds, which Home mounts
// only with the AI sessions beta on. Without it the section can't be hidden, and one hidden
// earlier shows again.
@@ -198,25 +216,6 @@
]
}
- // Beside the session list the workspace's last sessions take the favorites' place: sent ones
- // and drafts with text, not Home's own draft, which is the composer above.
- const sessionsSide = $derived(homeListsSessions())
- const showFavorites = $derived(homeQuickAccessSettings.showFavorites && !sessionsSide)
- let recentSessions = $derived(
- sessionsSide
- ? sessionState.sessions
- .filter(
- (s) =>
- !s.archived &&
- s.id !== homeDraft.id &&
- (!!s.workspace_id || !!s.draftPrompt?.trim()) &&
- getEffectiveWorkspaceId(s) === workspace
- )
- .sort((a, b) => sessionLastActivityAt(b) - sessionLastActivityAt(a))
- .slice(0, RECENT_COUNT)
- : []
- )
-
// Assets are favorites too, but they open in the database manager rather than at a page,
// so they stay in the sidebar's menu.
let favorites: Entry[] = $derived(
@@ -227,7 +226,7 @@
// Favorites first, then what was opened lately; a starred item is listed once, as a favorite.
// With the favorites turned off, a starred item opened lately shows among the recent ones.
let recentAll: Entry[] = $derived.by(() => {
- const { showRecent } = homeQuickAccessSettings
+ const { showFavorites, showRecent } = homeQuickAccessSettings
const starred = new Set(
showFavorites ? favorites.map((f) => `${asStarKind(f.kind)}/${f.path}`) : []
)
@@ -246,7 +245,7 @@
let recentLimit = $state(RECENT_COUNT)
let recentMore = $derived(Math.max(0, recentAll.length - recentLimit))
let entries: { item: Entry; favorite: boolean }[] = $derived([
- ...(showFavorites ? favorites : []).map((item) => ({
+ ...(homeQuickAccessSettings.showFavorites ? favorites : []).map((item) => ({
item,
favorite: true
})),
@@ -257,10 +256,12 @@
// (the only way to turn the list back on) would leave with it.
let emptiedBySettings = $derived(
entries.length === 0 &&
- recentSessions.length === 0 &&
- ((!showFavorites && favorites.length > 0) ||
+ ((!homeQuickAccessSettings.showFavorites && favorites.length > 0) ||
(!homeQuickAccessSettings.showRecent && recentItems.list(workspace).length > 0))
)
+ let favoritesShown = $derived(
+ favoriteManager.loadedFor === workspace && (entries.length > 0 || emptiedBySettings) && !hidden
+ )
// Read when the pointer reaches the time, so the tooltip is current however long the
// page has been open.
@@ -281,7 +282,7 @@
}
// Everything the lists hold, the recent ones not loaded yet included.
- let favoriteCount = $derived(showFavorites ? favorites.length : 0)
+ let favoriteCount = $derived(homeQuickAccessSettings.showFavorites ? favorites.length : 0)
let recentCount = $derived(recentAll.length)
// The cards fill one screen at a time, row by row, and the next screen scrolls in from the
@@ -289,7 +290,7 @@
// whole columns. The column counts follow the `auto-cols` breakpoints below.
let innerWidth = $state(1280)
let cols = $derived(innerWidth >= 1024 ? 3 : innerWidth >= 640 ? 2 : 1)
- let cellCount = $derived(recentSessions.length + entries.length + (recentMore > 0 ? 1 : 0))
+ let cellCount = $derived(entries.length + (recentMore > 0 ? 1 : 0))
// Fewer rows when there aren't enough cards to fill a screen.
let rows = $derived(Math.min(homeQuickAccessSettings.rows, Math.ceil(cellCount / cols)))
@@ -431,19 +432,46 @@
{/snippet}
+{#if continueSessions.length > 0}
+
+ Continue last session
+
- {showFavorites
+ {homeQuickAccessSettings.showFavorites
? 'No favorites yet. Star a script, flow or app to keep it here.'
: 'Nothing opened lately in this browser.'}
@@ -477,43 +505,15 @@
class="grid gap-2 overflow-x-auto no-scrollbar px-px -mx-px auto-cols-[85%] sm:auto-cols-[calc((100%_-_0.5rem)/2)] lg:auto-cols-[calc((100%_-_1rem)/3)]"
style:grid-template-rows="repeat({rows}, auto)"
>
- {#each recentSessions as session, i (session.id)}
- {@const at = cellPosition(i)}
-