From 24d2da5382722a97763c0e9315cd419acccbfbf8 Mon Sep 17 00:00:00 2001 From: "Michael Ludvig (CyberCX)" Date: Tue, 30 Sep 2025 15:25:31 +1300 Subject: [PATCH 1/2] Display pinned bots in Drawer --- frontend/src/@types/bot.d.ts | 2 +- frontend/src/components/Drawer.tsx | 22 ++++++++++++++++++- .../features/discover/hooks/useBotStore.ts | 4 ++-- frontend/src/hooks/useBot.ts | 7 ++++++ frontend/src/i18n/de/index.ts | 1 + frontend/src/i18n/en/index.ts | 1 + frontend/src/i18n/es/index.ts | 1 + frontend/src/i18n/fr/index.ts | 1 + frontend/src/i18n/id/index.ts | 1 + frontend/src/i18n/it/index.ts | 1 + frontend/src/i18n/ja/index.ts | 1 + frontend/src/i18n/ko/index.ts | 1 + frontend/src/i18n/ms/index.ts | 1 + frontend/src/i18n/nb/index.ts | 2 ++ frontend/src/i18n/pl/index.ts | 1 + frontend/src/i18n/pt-br/index.ts | 1 + frontend/src/i18n/th/index.ts | 1 + frontend/src/i18n/vi/index.ts | 1 + frontend/src/i18n/zh-hans/index.ts | 1 + frontend/src/i18n/zh-hant/index.ts | 1 + frontend/src/layouts/AppContent.tsx | 3 ++- 21 files changed, 50 insertions(+), 5 deletions(-) diff --git a/frontend/src/@types/bot.d.ts b/frontend/src/@types/bot.d.ts index 13d83abb8..4d5b68aca 100644 --- a/frontend/src/@types/bot.d.ts +++ b/frontend/src/@types/bot.d.ts @@ -206,7 +206,7 @@ export type GetBotsResponse = BotListItem[]; export type GetMyBotResponse = BotDetails; -export type GetPinnedBotResponse = BotMeta[]; +export type GetPinnedBotResponse = BotListItem[]; export type GetBotSummaryResponse = BotSummary; diff --git a/frontend/src/components/Drawer.tsx b/frontend/src/components/Drawer.tsx index a0f6c76ad..98dfb7124 100644 --- a/frontend/src/components/Drawer.tsx +++ b/frontend/src/components/Drawer.tsx @@ -45,6 +45,7 @@ import IconPinnedBot from './IconPinnedBot'; type Props = BaseProps & { isAdmin: boolean; conversations?: ConversationMeta[]; + pinnedBots?: BotListItem[]; starredBots?: BotListItem[]; recentlyUsedUnstarredBots?: BotListItem[]; updateConversationTitle: ( @@ -202,7 +203,7 @@ const Drawer: React.FC = (props) => { const navigate = useNavigate(); const { getPageLabel } = usePageLabel(); const { opened, switchOpen, drawerOptions } = useDrawer(); - const { conversations, starredBots, recentlyUsedUnstarredBots } = props; + const { conversations, pinnedBots, starredBots, recentlyUsedUnstarredBots } = props; const location = useLocation(); @@ -310,6 +311,25 @@ const Drawer: React.FC = (props) => { onClick={closeSmallDrawer} /> + {pinnedBots?.filter((bot) => bot.available).length ? ( + + {pinnedBots + .filter((bot) => bot.available) + .map((bot) => ( + } + labelComponent={bot.title} + onClick={onClickNewBotChat} + /> + ))} + + ) : null} + diff --git a/frontend/src/features/discover/hooks/useBotStore.ts b/frontend/src/features/discover/hooks/useBotStore.ts index 38847a952..185658c20 100644 --- a/frontend/src/features/discover/hooks/useBotStore.ts +++ b/frontend/src/features/discover/hooks/useBotStore.ts @@ -1,6 +1,6 @@ import useBotApi from '../../../hooks/useBotApi'; import useBotStoreApi from './useBotStoreApi'; -import { BotMeta } from '../../../@types/bot'; +import { BotListItem, BotMeta } from '../../../@types/bot'; import { useCallback } from 'react'; const useBotStore = () => { @@ -31,7 +31,7 @@ const useBotStore = () => { // Update pinnedBots if (pinnedBots) { mutatePinnedBots( - pinnedBots.map((bot: BotMeta) => + pinnedBots.map((bot: BotListItem) => bot.id === botId ? { ...bot, isStarred } : bot ), false diff --git a/frontend/src/hooks/useBot.ts b/frontend/src/hooks/useBot.ts index 5d37d3f47..2724914dc 100644 --- a/frontend/src/hooks/useBot.ts +++ b/frontend/src/hooks/useBot.ts @@ -31,6 +31,11 @@ const useBot = (shouldAutoRefreshMyBots?: boolean) => { starred: true, }); + const { + data: pinnedBots, + mutate: mutatePinnedBots, + } = api.getPinnedBots(); + const { data: recentlyUsedBots, mutate: mutateRecentlyUsedBots, @@ -44,6 +49,8 @@ const useBot = (shouldAutoRefreshMyBots?: boolean) => { myBots, mutateMyBots, isLoadingMyBots, + pinnedBots: pinnedBots?.filter((bot) => bot.available), + mutatePinnedBots, starredBots: starredBots?.filter((bot) => bot.available), mutateStarredBots, recentlyUsedBots, diff --git a/frontend/src/i18n/de/index.ts b/frontend/src/i18n/de/index.ts index 86c683df5..3bbe64b15 100644 --- a/frontend/src/i18n/de/index.ts +++ b/frontend/src/i18n/de/index.ts @@ -3,6 +3,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Nachricht senden', + pinnedBots: 'Angeheftete Bots', starredBots: 'Favorisierte Bots', recentlyUsedBots: 'Zuletzt genutzte Bots', conversationHistory: 'Verlauf', diff --git a/frontend/src/i18n/en/index.ts b/frontend/src/i18n/en/index.ts index 443fbc682..15817c970 100644 --- a/frontend/src/i18n/en/index.ts +++ b/frontend/src/i18n/en/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'How can I Help You?', + pinnedBots: 'Pinned Bots', starredBots: 'Starred Bots', recentlyUsedBots: 'Recently Used Bots', conversationHistory: 'Recent Chats', diff --git a/frontend/src/i18n/es/index.ts b/frontend/src/i18n/es/index.ts index 7f1a83c9f..087e4d721 100644 --- a/frontend/src/i18n/es/index.ts +++ b/frontend/src/i18n/es/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Chat Bedrock', inputMessage: 'Enviar un mensaje', + pinnedBots: 'Bots Fijados', starredBots: 'Bots Favoritos', recentlyUsedBots: 'Bots Usados Recientemente', conversationHistory: 'Historial', diff --git a/frontend/src/i18n/fr/index.ts b/frontend/src/i18n/fr/index.ts index 7a03a5803..bfe302a70 100644 --- a/frontend/src/i18n/fr/index.ts +++ b/frontend/src/i18n/fr/index.ts @@ -3,6 +3,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Envoyer un message', + pinnedBots: 'Bots épinglés', starredBots: 'Epingler un bot', recentlyUsedBots: 'Bot utilisé récemment', conversationHistory: 'Historique', diff --git a/frontend/src/i18n/id/index.ts b/frontend/src/i18n/id/index.ts index b6167d279..3e75df8b2 100644 --- a/frontend/src/i18n/id/index.ts +++ b/frontend/src/i18n/id/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Bisakah Saya Membantu Anda?', + pinnedBots: 'Bot yang Dipin', starredBots: 'Bot Favorit', recentlyUsedBots: 'Bot yang Baru Digunakan', conversationHistory: 'Riwayat', diff --git a/frontend/src/i18n/it/index.ts b/frontend/src/i18n/it/index.ts index 3941c736b..18908937d 100644 --- a/frontend/src/i18n/it/index.ts +++ b/frontend/src/i18n/it/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Inviare un messaggio', + pinnedBots: 'Bot fissati', starredBots: 'Bot preferiti', recentlyUsedBots: 'Bot utilizzati di recente', conversationHistory: 'Cronologia', diff --git a/frontend/src/i18n/ja/index.ts b/frontend/src/i18n/ja/index.ts index 55aa03ba9..99aa07d76 100644 --- a/frontend/src/i18n/ja/index.ts +++ b/frontend/src/i18n/ja/index.ts @@ -11,6 +11,7 @@ const translation: typeof en = { app: { name: 'Bedrock Chat', inputMessage: 'お手伝いできることはありますか?', + pinnedBots: 'ピン留めボット', starredBots: 'スター付きのボット', recentlyUsedBots: '最近使用したボット', conversationHistory: '最近のチャット', diff --git a/frontend/src/i18n/ko/index.ts b/frontend/src/i18n/ko/index.ts index 2869bc306..36bb0a769 100644 --- a/frontend/src/i18n/ko/index.ts +++ b/frontend/src/i18n/ko/index.ts @@ -6,6 +6,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: '입력해 주십시오', + pinnedBots: '고정된 봇', }, deleteDialog: { title: '삭제 확인', diff --git a/frontend/src/i18n/ms/index.ts b/frontend/src/i18n/ms/index.ts index 7bec3da3e..519ca7fc6 100644 --- a/frontend/src/i18n/ms/index.ts +++ b/frontend/src/i18n/ms/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Bolehkah Saya Membantu Anda?', + pinnedBots: 'Bot yang Disemat', starredBots: 'Bot Berbintang', recentlyUsedBots: 'Bot Yang Baru Digunakan', conversationHistory: 'Sejarah', diff --git a/frontend/src/i18n/nb/index.ts b/frontend/src/i18n/nb/index.ts index 8b77f38c1..13a608852 100644 --- a/frontend/src/i18n/nb/index.ts +++ b/frontend/src/i18n/nb/index.ts @@ -9,6 +9,7 @@ const translation = { name: 'ACO-gpt', nameWithoutClaude: 'ACO-gpt', inputMessage: 'Send en melding', + pinnedBots: 'Faste boter', starredBots: 'Favorittbot', recentlyUsedBots: 'Nylig brukte boter', conversationHistory: 'Historikk', @@ -36,6 +37,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Send en melding', + pinnedBots: 'Faste boter', starredBots: 'Favorittbot', recentlyUsedBots: 'Nylig brukte boter', conversationHistory: 'Historikk', diff --git a/frontend/src/i18n/pl/index.ts b/frontend/src/i18n/pl/index.ts index f699405a1..022e8a9d4 100644 --- a/frontend/src/i18n/pl/index.ts +++ b/frontend/src/i18n/pl/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Jak mogę pomóc?', + pinnedBots: 'Przypięte boty', starredBots: 'Ulubione Boty', recentlyUsedBots: 'Ostatnio używane Boty', conversationHistory: 'Historia', diff --git a/frontend/src/i18n/pt-br/index.ts b/frontend/src/i18n/pt-br/index.ts index 364f9db5a..224c2d318 100644 --- a/frontend/src/i18n/pt-br/index.ts +++ b/frontend/src/i18n/pt-br/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Como posso te ajudar?', + pinnedBots: 'Bots Fixados', starredBots: 'Bots Favoritos', recentlyUsedBots: 'Bots Usados Recentemente', conversationHistory: 'Conversas Recentes', diff --git a/frontend/src/i18n/th/index.ts b/frontend/src/i18n/th/index.ts index 8cf1b1b27..6f554dde3 100644 --- a/frontend/src/i18n/th/index.ts +++ b/frontend/src/i18n/th/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'ฉันช่วยอะไรคุณได้บ้าง?', + pinnedBots: 'บ็อตที่ปักหมุด', starredBots: 'บ็อตที่ถูกใจ', recentlyUsedBots: 'บ็อตที่ใช้งานล่าสุด', conversationHistory: 'ประวัติ', diff --git a/frontend/src/i18n/vi/index.ts b/frontend/src/i18n/vi/index.ts index 228e66425..bbc469414 100644 --- a/frontend/src/i18n/vi/index.ts +++ b/frontend/src/i18n/vi/index.ts @@ -8,6 +8,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'Tôi có thể giúp gì cho bạn?', + pinnedBots: 'Bot Ghim', starredBots: 'Bot Yêu Thích', recentlyUsedBots: 'Bot Đã Dùng Gần Đây', conversationHistory: 'Lịch sử', diff --git a/frontend/src/i18n/zh-hans/index.ts b/frontend/src/i18n/zh-hans/index.ts index 6cb0e0aef..65bbd65e5 100644 --- a/frontend/src/i18n/zh-hans/index.ts +++ b/frontend/src/i18n/zh-hans/index.ts @@ -6,6 +6,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: '请输入', + pinnedBots: '置顶 Bots', starredBots: '我的 Bots 收藏', recentlyUsedBots: '最近使用过的 Bots', conversationHistory: '交谈纪录', diff --git a/frontend/src/i18n/zh-hant/index.ts b/frontend/src/i18n/zh-hant/index.ts index c9231c093..8646ff5d0 100644 --- a/frontend/src/i18n/zh-hant/index.ts +++ b/frontend/src/i18n/zh-hant/index.ts @@ -6,6 +6,7 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: '請輸入訊息', + pinnedBots: '置頂 Bots', starredBots: '我的最愛 Bots', recentlyUsedBots: '最近用過的 Bots', conversationHistory: '交談紀錄', diff --git a/frontend/src/layouts/AppContent.tsx b/frontend/src/layouts/AppContent.tsx index 674614726..8d7700656 100644 --- a/frontend/src/layouts/AppContent.tsx +++ b/frontend/src/layouts/AppContent.tsx @@ -38,7 +38,7 @@ const AppContent: React.FC = (props) => { deleteConversation, clearConversations: clear, } = useConversation(); - const { starredBots, recentlyUsedUnstarredBots } = useBot(); + const { pinnedBots, starredBots, recentlyUsedUnstarredBots } = useBot(); const { newChat, isGeneratedTitle } = useChat(); const { isConversationOrNewChat, pathPattern } = usePageTitlePathPattern(); const { isAdmin } = useLoginUser(); @@ -92,6 +92,7 @@ const AppContent: React.FC = (props) => {
Date: Fri, 10 Oct 2025 09:53:23 +1300 Subject: [PATCH 2/2] Toggle drawer sections --- frontend/src/@types/common.d.ts | 9 + .../src/components/DialogDrawerOptions.tsx | 71 ++++ frontend/src/components/Drawer.tsx | 335 +++++++++--------- frontend/src/hooks/useDrawer.ts | 22 +- frontend/src/i18n/en/index.ts | 3 + frontend/src/i18n/ja/index.ts | 3 + 6 files changed, 281 insertions(+), 162 deletions(-) diff --git a/frontend/src/@types/common.d.ts b/frontend/src/@types/common.d.ts index efec001ff..79a7376f7 100644 --- a/frontend/src/@types/common.d.ts +++ b/frontend/src/@types/common.d.ts @@ -8,4 +8,13 @@ export type DrawerOptions = { recentlyUsedBots: number; conversationHistory: number; }; + show: { + newChat: boolean; + myBots: boolean; + discoverBots: boolean; + pinnedBots: boolean; + starredBots: boolean; + recentlyUsedBots: boolean; + conversationHistory: boolean; + }; }; diff --git a/frontend/src/components/DialogDrawerOptions.tsx b/frontend/src/components/DialogDrawerOptions.tsx index 8b722d86c..0e9423d0e 100644 --- a/frontend/src/components/DialogDrawerOptions.tsx +++ b/frontend/src/components/DialogDrawerOptions.tsx @@ -4,6 +4,7 @@ import Button from './Button'; import ModalDialog from './ModalDialog'; import { useTranslation } from 'react-i18next'; import InputText from './InputText'; +import Toggle from './Toggle'; type Props = BaseProps & { isOpen: boolean; @@ -23,6 +24,14 @@ const DialogDrawerOptions: React.FC = (props) => { number | null >(0); + const [showNewChat, setShowNewChat] = useState(true); + const [showMyBots, setShowMyBots] = useState(true); + const [showDiscoverBots, setShowDiscoverBots] = useState(true); + const [showPinnedBots, setShowPinnedBots] = useState(true); + const [showStarredBots, setShowStarredBots] = useState(true); + const [showRecentlyUsedBots, setShowRecentlyUsedBots] = useState(true); + const [showConversationHistory, setShowConversationHistory] = useState(true); + useEffect(() => { if (props.isOpen) { setStarredBotsCount(props.drawerOptions.displayCount.starredBots); @@ -32,6 +41,13 @@ const DialogDrawerOptions: React.FC = (props) => { setConversationHistoryCount( props.drawerOptions.displayCount.conversationHistory ); + setShowNewChat(props.drawerOptions.show.newChat); + setShowMyBots(props.drawerOptions.show.myBots); + setShowDiscoverBots(props.drawerOptions.show.discoverBots); + setShowPinnedBots(props.drawerOptions.show.pinnedBots); + setShowStarredBots(props.drawerOptions.show.starredBots); + setShowRecentlyUsedBots(props.drawerOptions.show.recentlyUsedBots); + setShowConversationHistory(props.drawerOptions.show.conversationHistory); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.isOpen]); @@ -80,6 +96,49 @@ const DialogDrawerOptions: React.FC = (props) => { return (
+
+
+ {t('drawerOptionsDialog.label.visibility')} +
+
+ + + + + + + +
+
+
{t('drawerOptionsDialog.label.displayCount')} @@ -90,6 +149,7 @@ const DialogDrawerOptions: React.FC = (props) => { type="number" value={starredBotsCount?.toString() ?? ''} errorMessage={errorMessages['starredBots']} + disabled={!showStarredBots} onChange={(s) => { setStarredBotsCount(s === '' ? null : parseInt(s)); }} @@ -99,6 +159,7 @@ const DialogDrawerOptions: React.FC = (props) => { type="number" value={recentlyUsedBotsCount?.toString() ?? ''} errorMessage={errorMessages['recentlyUsedBots']} + disabled={!showRecentlyUsedBots} onChange={(s) => { setRecentlyUsedBotsCount(s === '' ? null : parseInt(s)); }} @@ -108,6 +169,7 @@ const DialogDrawerOptions: React.FC = (props) => { type="number" value={conversationHistoryCount?.toString() ?? ''} errorMessage={errorMessages['conversationHistory']} + disabled={!showConversationHistory} onChange={(s) => { setConversationHistoryCount(s === '' ? null : parseInt(s)); }} @@ -129,6 +191,15 @@ const DialogDrawerOptions: React.FC = (props) => { recentlyUsedBots: recentlyUsedBotsCount!, conversationHistory: conversationHistoryCount!, }, + show: { + newChat: showNewChat, + myBots: showMyBots, + discoverBots: showDiscoverBots, + pinnedBots: showPinnedBots, + starredBots: showStarredBots, + recentlyUsedBots: showRecentlyUsedBots, + conversationHistory: showConversationHistory, + }, }); }} className="p-2"> diff --git a/frontend/src/components/Drawer.tsx b/frontend/src/components/Drawer.tsx index 98dfb7124..3464430f9 100644 --- a/frontend/src/components/Drawer.tsx +++ b/frontend/src/components/Drawer.tsx @@ -289,180 +289,193 @@ const Drawer: React.FC = (props) => { } text-sm text-white transition-width`}> {!isAdminPanel && ( <> - } - to="/" - onClick={onClickNewChat} - labelComponent={t('button.newChat')} - /> - } - to="/bot/my" - labelComponent={getPageLabel('/bot/my')} - onClick={closeSmallDrawer} - /> - } - to="/bot/discover" - labelComponent={getPageLabel('/bot/discover')} - onClick={closeSmallDrawer} - /> + {drawerOptions.show.newChat && ( + } + to="/" + onClick={onClickNewChat} + labelComponent={t('button.newChat')} + /> + )} + {drawerOptions.show.myBots && ( + } + to="/bot/my" + labelComponent={getPageLabel('/bot/my')} + onClick={closeSmallDrawer} + /> + )} + {drawerOptions.show.discoverBots && ( + } + to="/bot/discover" + labelComponent={getPageLabel('/bot/discover')} + onClick={closeSmallDrawer} + /> + )} - {pinnedBots?.filter((bot) => bot.available).length ? ( + {drawerOptions.show.pinnedBots && + pinnedBots?.filter((bot) => bot.available).length ? ( + + {pinnedBots + .filter((bot) => bot.available) + .map((bot) => ( + } + labelComponent={bot.title} + onClick={onClickNewBotChat} + /> + ))} + + ) : null} + + {drawerOptions.show.starredBots && ( - {pinnedBots - .filter((bot) => bot.available) + {starredBots === undefined && ( +
+ + + + + +
+ )} + {starredBots + ?.slice(0, drawerOptions.displayCount.starredBots) .map((bot) => ( } + icon={ + isPinnedBot(bot.sharedStatus) ? ( + + ) : ( + + ) + } labelComponent={bot.title} onClick={onClickNewBotChat} /> ))} + + {starredBots && starredBots.length > 15 && ( + + )}
- ) : null} - - - {starredBots === undefined && ( -
- - - - - -
- )} - {starredBots - ?.slice(0, drawerOptions.displayCount.starredBots) - .map((bot) => ( - - ) : ( - - ) - } - labelComponent={bot.title} - onClick={onClickNewBotChat} - /> - ))} - - {starredBots && starredBots.length > 15 && ( - - )} -
- - - {recentlyUsedUnstarredBots === undefined && ( -
- - - - - -
- )} - {recentlyUsedUnstarredBots - ?.slice(0, drawerOptions.displayCount.recentlyUsedBots) - .map((bot) => ( - - ) : ( - - ) - } - labelComponent={bot.title} - onClick={onClickNewBotChat} - /> - ))} - - {recentlyUsedUnstarredBots && ( - - )} -
- - - {conversations === undefined && ( -
- - - - - -
- )} - {conversations - ?.slice(0, drawerOptions.displayCount.conversationHistory) - .map((conversation, idx) => ( - props.onDeleteConversation(conversation)} - /> - ))} - - {conversations && ( - - )} -
+ )} + + {drawerOptions.show.recentlyUsedBots && ( + + {recentlyUsedUnstarredBots === undefined && ( +
+ + + + + +
+ )} + {recentlyUsedUnstarredBots + ?.slice(0, drawerOptions.displayCount.recentlyUsedBots) + .map((bot) => ( + + ) : ( + + ) + } + labelComponent={bot.title} + onClick={onClickNewBotChat} + /> + ))} + + {recentlyUsedUnstarredBots && ( + + )} +
+ )} + + {drawerOptions.show.conversationHistory && ( + + {conversations === undefined && ( +
+ + + + + +
+ )} + {conversations + ?.slice(0, drawerOptions.displayCount.conversationHistory) + .map((conversation, idx) => ( + props.onDeleteConversation(conversation)} + /> + ))} + + {conversations && ( + + )} +
+ )} )} diff --git a/frontend/src/hooks/useDrawer.ts b/frontend/src/hooks/useDrawer.ts index 2087a9337..5c55d9cd5 100644 --- a/frontend/src/hooks/useDrawer.ts +++ b/frontend/src/hooks/useDrawer.ts @@ -7,6 +7,15 @@ const DEFAULT_OPTIONS: DrawerOptions = { recentlyUsedBots: 15, conversationHistory: 5, }, + show: { + newChat: true, + myBots: true, + discoverBots: true, + pinnedBots: true, + starredBots: true, + recentlyUsedBots: true, + conversationHistory: true, + }, }; const useDrawerStore = create<{ @@ -20,7 +29,18 @@ const useDrawerStore = create<{ try { const savedOptions = localStorage.getItem('DrawerOptions'); if (savedOptions) { - initialOptions = JSON.parse(savedOptions); + const parsed = JSON.parse(savedOptions); + // Merge with defaults to handle migration from old structure + initialOptions = { + displayCount: { + ...DEFAULT_OPTIONS.displayCount, + ...(parsed.displayCount || {}), + }, + show: { + ...DEFAULT_OPTIONS.show, + ...(parsed.show || {}), + }, + }; } } catch (e) { console.error('Failed to parse DrawerOptions from localStorage', e); diff --git a/frontend/src/i18n/en/index.ts b/frontend/src/i18n/en/index.ts index 15817c970..29ef18546 100644 --- a/frontend/src/i18n/en/index.ts +++ b/frontend/src/i18n/en/index.ts @@ -8,6 +8,8 @@ const translation = { app: { name: 'Bedrock Chat', inputMessage: 'How can I Help You?', + myBots: 'My Bots', + discoverBots: 'Discover Bots', pinnedBots: 'Pinned Bots', starredBots: 'Starred Bots', recentlyUsedBots: 'Recently Used Bots', @@ -646,6 +648,7 @@ How would you categorize this email?`, drawerOptionsDialog: { title: 'Side Menu Options', label: { + visibility: 'Visibility', displayCount: 'Display Count', }, }, diff --git a/frontend/src/i18n/ja/index.ts b/frontend/src/i18n/ja/index.ts index 99aa07d76..c7f87676f 100644 --- a/frontend/src/i18n/ja/index.ts +++ b/frontend/src/i18n/ja/index.ts @@ -11,6 +11,8 @@ const translation: typeof en = { app: { name: 'Bedrock Chat', inputMessage: 'お手伝いできることはありますか?', + myBots: 'マイボット', + discoverBots: 'ボットを探す', pinnedBots: 'ピン留めボット', starredBots: 'スター付きのボット', recentlyUsedBots: '最近使用したボット', @@ -652,6 +654,7 @@ const translation: typeof en = { drawerOptionsDialog: { title: 'サイドメニューオプション', label: { + visibility: '表示設定', displayCount: '表示数', }, },