Skip to content

Commit

Permalink
🐛 fix: Fix panel expand
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed May 8, 2024
1 parent f37f42b commit 5e78089
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const TopicPanel = memo(({ children }: PropsWithChildren) => {
]);
const [expand, setExpand] = useState(showAgentSettings);

const handleExpand = (e: boolean) => {
toggleConfig(e);
setExpand(e);
};

useLayoutEffect(() => {
if (!isPreferenceInit) return;
setExpand(showAgentSettings);
Expand All @@ -52,7 +57,7 @@ const TopicPanel = memo(({ children }: PropsWithChildren) => {
expand={expand}
minWidth={CHAT_SIDEBAR_WIDTH}
mode={md ? 'fixed' : 'float'}
onExpandChange={toggleConfig}
onExpandChange={handleExpand}
placement={'right'}
showHandlerWideArea={false}
>
Expand Down
7 changes: 4 additions & 3 deletions src/app/(main)/chat/_layout/Desktop/SessionPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ const SessionPanel = memo<PropsWithChildren>(({ children }) => {
const [tmpWidth, setWidth] = useState(sessionsWidth);
if (tmpWidth !== sessionsWidth) setWidth(sessionsWidth);

const handleExpand: DraggablePanelProps['onExpandChange'] = (expand) => {
const handleExpand: DraggablePanelProps['onExpandChange'] = (e) => {
updatePreference({
sessionsWidth: expand ? 320 : 0,
showSessionPanel: expand,
sessionsWidth: e ? 320 : 0,
showSessionPanel: e,
});
setExpand(e);
};

const handleSizeChange: DraggablePanelProps['onSizeChange'] = (_, size) => {
Expand Down

0 comments on commit 5e78089

Please sign in to comment.