Skip to content

Commit 1cd94f0

Browse files
committed
Fix three bugs found in self-review
- openDockedChat: set location to "right" when in center mode so the dock button actually does something visible - onChatGxyClick: only toggle the left sidebar in center mode to avoid showing two chat surfaces simultaneously in docked mode - dockToSide/dockToBottomPanel: only navigate to "/" when currently on /chatgxy, preserving the user's current route otherwise
1 parent 5afeef8 commit 1cd94f0

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

client/src/components/ActivityBar/ActivityBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ function toggleSidebar(toggle: string = "", to: string | null = null) {
221221
}
222222
223223
function onChatGxyClick() {
224-
toggleSidebar("chatgxy");
225224
if (chatStore.isCenterMode) {
225+
toggleSidebar("chatgxy");
226226
if (route.path.startsWith("/chatgxy")) {
227227
router.push("/");
228228
} else {

client/src/components/ChatGXY.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
1616
import { BSkeleton } from "bootstrap-vue";
1717
import { computed, nextTick, onMounted, ref, watch } from "vue";
18-
import { useRouter } from "vue-router/composables";
18+
import { useRoute, useRouter } from "vue-router/composables";
1919
2020
import { GalaxyApi } from "@/api";
2121
import { getGalaxyInstance } from "@/app";
@@ -53,6 +53,7 @@ const emit = defineEmits<{
5353
(e: "undock"): void;
5454
}>();
5555
56+
const route = useRoute();
5657
const router = useRouter();
5758
const chatStore = useChatStore();
5859
@@ -386,14 +387,18 @@ function dockToSide() {
386387
chatStore.setActiveChatId(currentChatId.value);
387388
chatStore.setLocation("right");
388389
chatStore.showChat();
389-
router.push("/");
390+
if (route.path.startsWith("/chatgxy")) {
391+
router.push("/");
392+
}
390393
}
391394
392395
function dockToBottomPanel() {
393396
chatStore.setActiveChatId(currentChatId.value);
394397
chatStore.setLocation("bottom");
395398
chatStore.showChat();
396-
router.push("/");
399+
if (route.path.startsWith("/chatgxy")) {
400+
router.push("/");
401+
}
397402
}
398403
399404
watch(currentChatId, (newId) => {

client/src/components/ChatGXY/ChatHistoryPanel.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ function startNewChat() {
7474
}
7575
7676
function openDockedChat() {
77+
if (chatStore.isCenterMode) {
78+
chatStore.setLocation("right");
79+
}
7780
const latestId = chatHistory.value.length > 0 ? chatHistory.value[0]!.id : null;
7881
chatStore.showChat(latestId);
7982
}

0 commit comments

Comments
 (0)