-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathApp.tsx
More file actions
31 lines (27 loc) · 899 Bytes
/
App.tsx
File metadata and controls
31 lines (27 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { ErrorState } from "./components/ErrorState";
import { NotSupportedState } from "./components/NotSupportedState";
import { TasksPanel } from "./components/TasksPanel";
import { usePersistedState } from "./hooks/usePersistedState";
import { useTasksQuery } from "./hooks/useTasksQuery";
export default function App() {
const persisted = usePersistedState();
const { tasksSupported, tasks, templates, refreshing, error, refetch } =
useTasksQuery({
initialTasks: persisted.initialTasks,
initialTemplates: persisted.initialTemplates,
});
if (!tasksSupported) {
return <NotSupportedState />;
}
if (error && tasks.length === 0) {
return (
<ErrorState message={error.message} onRetry={() => void refetch()} />
);
}
return (
<>
{refreshing && <div className="refresh-bar" />}
<TasksPanel tasks={tasks} templates={templates} persisted={persisted} />
</>
);
}