Skip to content

Commit 45431c5

Browse files
committed
fix(web): leave the settings route on new session and move the gear
New Session and Back to sessions both exit the route now — the sidebar shows one body at a time, so starting a draft while the settings pane held the content area left the new session invisible. The sessions-mode gear moves to the trailing edge of the footer; the settings-mode back arrow keeps the leading edge.
1 parent b60512b commit 45431c5

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

apps/pythinker-web/src/App.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,9 @@ function handleCloseAddWorkspace(): void {
880880
// right pane shows the onboarding composer. The session is only created when
881881
// the user sends the first message.
882882
function handleCreateSession(): void {
883+
// Starting a session leaves the settings route — the new draft has to be
884+
// visible, and the content area can only show one of the two.
885+
showSettings.value = false;
883886
const wsId = client.activeWorkspaceId.value;
884887
if (wsId) {
885888
client.openWorkspaceDraft(wsId);
@@ -892,6 +895,7 @@ function handleCreateSession(): void {
892895
// state in the chosen workspace. No backend session is created until the user
893896
// actually sends a message.
894897
function handleCreateSessionInWorkspace(workspaceId: string): void {
898+
showSettings.value = false;
895899
client.openWorkspaceDraft(workspaceId);
896900
}
897901

apps/pythinker-web/src/components/Sidebar.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ onBeforeUnmount(() => {
669669
</div>
670670

671671
<div class="side-foot">
672-
<button type="button" class="settings-row" @click.stop="emit('openSettings')">
672+
<button type="button" class="settings-row end" @click.stop="emit('openSettings')">
673673
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
674674
<circle cx="12" cy="12" r="3" />
675675
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l-.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09A1.65 1.65 0 0 0 15 4.6a1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09A1.65 1.65 0 0 0 19.4 15z" />
@@ -1198,6 +1198,12 @@ onBeforeUnmount(() => {
11981198
text-align: left;
11991199
cursor: pointer;
12001200
}
1201+
/* The sessions-mode gear sits on the trailing edge; the settings-mode back
1202+
arrow keeps the leading edge, where a back control belongs. */
1203+
.settings-row.end {
1204+
justify-content: flex-end;
1205+
text-align: right;
1206+
}
12011207
.settings-row:hover { color: var(--ink); background: var(--soft); }
12021208
.settings-row:focus-visible {
12031209
outline: 2px solid var(--blue);

apps/pythinker-web/test/settings-pane.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,4 +433,25 @@ describe('desktop settings route', () => {
433433
expect.soft(wrapper.find('.sessions').exists()).toBe(true);
434434
expect.soft(wrapper.findComponent(ConversationPane).exists()).toBe(true);
435435
});
436+
437+
it('leaves the settings route when a new session starts', async () => {
438+
const wrapper = shallowMount(App, {
439+
global: {
440+
plugins: [i18n],
441+
stubs: { Sidebar: false, SettingsNav: false, SettingsPane: false },
442+
},
443+
});
444+
445+
await wrapper.get('.side-foot .settings-row').trigger('click');
446+
await nextTick();
447+
expect(wrapper.findComponent(SettingsPane).exists()).toBe(true);
448+
449+
// New Session shares the sidebar with the settings nav, so it has to close
450+
// the route — the content area can only show one of the two.
451+
await wrapper.get('.btn-new-chat').trigger('click');
452+
await nextTick();
453+
454+
expect(wrapper.findComponent(SettingsPane).exists()).toBe(false);
455+
expect(wrapper.find('.sessions').exists()).toBe(true);
456+
});
436457
});

0 commit comments

Comments
 (0)