diff --git a/src/workspaces/officerdev/src/apps/Dashboards/DashboardListApp.tsx b/src/workspaces/officerdev/src/apps/Dashboards/DashboardListApp.tsx index ebd98cae..cbf3452d 100644 --- a/src/workspaces/officerdev/src/apps/Dashboards/DashboardListApp.tsx +++ b/src/workspaces/officerdev/src/apps/Dashboards/DashboardListApp.tsx @@ -1,10 +1,9 @@ import { useState } from 'react'; -import { Link, useLocation, useNavigate, useSearchParams } from 'react-router'; +import { Link, useLocation, useSearchParams } from 'react-router'; import { LayoutGrid, Plus, Pencil, Trash2, Search } from 'lucide-react'; import { useQueryClient } from '@tanstack/react-query'; import { useGlobal } from 'hooks/useGlobal'; import { useClient } from 'hooks/useClient'; -import { generateSlug } from 'helpers/slug'; import { useUserState } from 'state/useUserState'; import { useDashboardState, persistDashboardState } from 'state/useDashboardState'; import type { DashboardDefinition } from '../../components/Workspace'; @@ -25,10 +24,10 @@ import { NEW_DASH_DESC_KEY, NEW_DASH_TEMPLATE_KEY, } from './constants'; +import { useNewDashboardDraft } from './useNewDashboardDraft'; export const DashboardListApp = () => { const location = useLocation(); - const navigate = useNavigate(); const client = useClient(); const queryClient = useQueryClient(); const { value: dashboards, setValue: setDashboards } = useDashboardState('workspaces', []); @@ -49,6 +48,9 @@ export const DashboardListApp = () => { const [, setDescription] = useGlobal(NEW_DASH_DESC_KEY, ''); const [, setTemplateIdx] = useGlobal(NEW_DASH_TEMPLATE_KEY, 0); const [, setFilePath] = useUserState('files/currentPath', '/'); + // Shared with the file browser's "Create Dashboard here", which needs the same five writes seeded from + // a folder rather than from nothing. + const openNewDashboard = useNewDashboardDraft(); const [search, setSearch] = useState(''); const [deleting, setDeleting] = useState(null); @@ -106,16 +108,7 @@ export const DashboardListApp = () => {