From baaada72057bb0a4972aa4c9785b64a181f083ac Mon Sep 17 00:00:00 2001 From: jZonG Date: Tue, 17 Jun 2025 16:31:19 +0800 Subject: [PATCH] app info in full screen mode --- web/app/components/app-sidebar/app-info.tsx | 83 ++++++------ .../app-sidebar/app-sidebar-dropdown.tsx | 118 ++++++++++++------ web/app/components/app-sidebar/index.tsx | 9 +- 3 files changed, 134 insertions(+), 76 deletions(-) diff --git a/web/app/components/app-sidebar/app-info.tsx b/web/app/components/app-sidebar/app-info.tsx index 7b6e66f7e7..00e9658a2d 100644 --- a/web/app/components/app-sidebar/app-info.tsx +++ b/web/app/components/app-sidebar/app-info.tsx @@ -39,16 +39,19 @@ import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigge export type IAppInfoProps = { expand: boolean + onlyShowDetail?: boolean + openState?: boolean + onDetailExpand?: (expand: boolean) => void } -const AppInfo = ({ expand }: IAppInfoProps) => { +const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailExpand }: IAppInfoProps) => { const { t } = useTranslation() const { notify } = useContext(ToastContext) const { replace } = useRouter() const { onPlanInfoChanged } = useProviderContext() const appDetail = useAppStore(state => state.appDetail) const setAppDetail = useAppStore(state => state.setAppDetail) - const [open, setOpen] = useState(false) + const [open, setOpen] = useState(openState) const [showEditModal, setShowEditModal] = useState(false) const [showDuplicateModal, setShowDuplicateModal] = useState(false) const [showConfirmDelete, setShowConfirmDelete] = useState(false) @@ -193,43 +196,48 @@ const AppInfo = ({ expand }: IAppInfoProps) => { return (
- + ) + } +
+ + )} setOpen(false)} + show={onlyShowDetail ? openState : open} + onClose={() => { + setOpen(false) + onDetailExpand?.(false) + }} className='absolute bottom-2 left-2 top-2 flex w-[420px] flex-col rounded-2xl !p-0' >
@@ -258,6 +266,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { className='gap-[1px]' onClick={() => { setOpen(false) + onDetailExpand?.(false) setShowEditModal(true) }} > @@ -270,6 +279,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { className='gap-[1px]' onClick={() => { setOpen(false) + onDetailExpand?.(false) setShowDuplicateModal(true) }}> @@ -308,6 +318,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { &&
{ setOpen(false) + onDetailExpand?.(false) setShowImportDSLModal(true) }}> @@ -319,6 +330,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { &&
{ setOpen(false) + onDetailExpand?.(false) setShowSwitchModal(true) }}> @@ -345,6 +357,7 @@ const AppInfo = ({ expand }: IAppInfoProps) => { className='gap-0.5' onClick={() => { setOpen(false) + onDetailExpand?.(false) setShowConfirmDelete(true) }} > diff --git a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx index d9fe0250a7..b1da43ae14 100644 --- a/web/app/components/app-sidebar/app-sidebar-dropdown.tsx +++ b/web/app/components/app-sidebar/app-sidebar-dropdown.tsx @@ -1,5 +1,10 @@ import React, { useCallback, useRef, useState } from 'react' -import { RiMenuLine } from '@remixicon/react' +import { useTranslation } from 'react-i18next' +import { useAppContext } from '@/context/app-context' +import { + RiEqualizer2Line, + RiMenuLine, +} from '@remixicon/react' import { PortalToFollowElem, PortalToFollowElemContent, @@ -23,7 +28,10 @@ type Props = { } const AppSidebarDropdown = ({ navigation }: Props) => { + const { t } = useTranslation() + const { isCurrentWorkspaceEditor } = useAppContext() const appDetail = useAppStore(state => state.appDetail) + const [detailExpand, setDetailExpand] = useState(false) const [open, doSetOpen] = useState(false) const openRef = useRef(open) @@ -39,46 +47,78 @@ const AppSidebarDropdown = ({ navigation }: Props) => { return null return ( -
- - -
- - -
-
- -
-
- + <> +
+ + +
+ +
-
- + + +
+
+
{ + setDetailExpand(true) + setOpen(false) + }} + > +
+ +
+
+ +
+
+
+
+
+
{appDetail.name}
+
+
{appDetail.mode === 'advanced-chat' ? t('app.types.advanced') : appDetail.mode === 'agent-chat' ? t('app.types.agent') : appDetail.mode === 'chat' ? t('app.types.chatbot') : appDetail.mode === 'completion' ? t('app.types.completion') : t('app.types.workflow')}
+
+
+
+
+ +
+
- -
- -
-
+ + +
+
+ +
+ ) } diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index 1b56be4f1e..b6bfc0e9ac 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -61,8 +61,13 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati } }, [appSidebarExpand, setAppSiderbarExpand]) - if (inWorkflowCanvas && hideHeader) - return + if (inWorkflowCanvas && hideHeader) { + return ( +
+ +
+ ) +} return (