diff --git a/src/@types/translations/en.json b/src/@types/translations/en.json index b653fae7..9b71b6e6 100644 --- a/src/@types/translations/en.json +++ b/src/@types/translations/en.json @@ -2970,7 +2970,7 @@ "subscribe": { "upgradePlanTitle": "Compare & select plan", "yearly": "Yearly", - "save": "Save {discount}%", + "save": "Save {{discount}}%", "monthly": "Monthly", "priceIn": "Price in ", "free": "Free", diff --git a/src/components/app/outline/ViewItem.tsx b/src/components/app/outline/ViewItem.tsx index fbf215a9..a6e58b58 100644 --- a/src/components/app/outline/ViewItem.tsx +++ b/src/components/app/outline/ViewItem.tsx @@ -71,7 +71,6 @@ function ViewItem ({ view, width, level = 0, renderExtra, expandIds, toggleExpan onMouseEnter={() => setHovered(true)} onMouseLeave={() => setHovered(false)} onClick={() => { - console.log('view.layout', view.layout); if (layout === ViewLayout.AIChat) return; onClickView?.(viewId); }} diff --git a/src/components/app/workspaces/DeleteWorkspace.tsx b/src/components/app/workspaces/DeleteWorkspace.tsx index 51c170af..ea3e0699 100644 --- a/src/components/app/workspaces/DeleteWorkspace.tsx +++ b/src/components/app/workspaces/DeleteWorkspace.tsx @@ -5,41 +5,45 @@ import { ReactComponent as DeleteSvg } from '@/assets/trash.svg'; import { NormalModal } from '@/components/_shared/modal'; import { notify } from '@/components/_shared/notify'; import { useService } from '@/components/main/app.hooks'; -import { useCurrentWorkspaceId } from '@/components/app/app.hooks'; -function DeleteWorkspace({workspaceId, name}: { +function DeleteWorkspace ({ workspaceId, name, onDeleted }: { name: string; workspaceId: string; + onDeleted?: () => void; }) { - const {t} = useTranslation(); + const { t } = useTranslation(); const [confirmOpen, setConfirmOpen] = React.useState(false); const [loading, setLoading] = React.useState(false); const service = useService(); - const currentWorkspaceId = useCurrentWorkspaceId(); - const handleOk = async() => { + const handleOk = async () => { if (!service) return; try { setLoading(true); await service.deleteWorkspace(workspaceId); setConfirmOpen(false); - if (currentWorkspaceId === workspaceId) { - window.location.href = `/app` - } + onDeleted?.(); + // eslint-disable-next-line } catch (e: any) { notify.error(e.message); } finally { setLoading(false); } - } + }; return ( <> - void; + onDeleted?: () => void; }) { const ref = React.useRef(null); const [open, setOpen] = React.useState(false); @@ -56,6 +57,10 @@ function MoreActions ({ workspace, onUpdated }: { { + setOpen(false); + onDeleted?.(); + }} /> diff --git a/src/components/app/workspaces/WorkspaceList.tsx b/src/components/app/workspaces/WorkspaceList.tsx index 140399b1..63c37bdf 100644 --- a/src/components/app/workspaces/WorkspaceList.tsx +++ b/src/components/app/workspaces/WorkspaceList.tsx @@ -61,6 +61,13 @@ function WorkspaceList ({ onUpdateCurrentWorkspace?.(name); } }} + onDeleted={() => { + if (workspace.id === currentWorkspaceId) { + window.location.href = `/app`; + } else { + void fetchWorkspaces(); + } + }} />; }