Infrastructure Sync: Initial migration to custom self-hosted Gitea
This commit is contained in:
@@ -28,12 +28,30 @@ interface AppShellProps {
|
||||
}
|
||||
|
||||
export function AppShell({ user, isDemo = false }: AppShellProps) {
|
||||
const [lists, setLists] = useState<List[]>([]);
|
||||
const [selectedListId, setSelectedListId] = useState<string | null>(null);
|
||||
const [lists, setLists] = useState<List[]>(() => {
|
||||
if (isDemo && typeof window !== "undefined") {
|
||||
return getDemoStore().lists as List[];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
const [selectedListId, setSelectedListId] = useState<string | null>(() => {
|
||||
if (isDemo && typeof window !== "undefined") {
|
||||
const storeLists = getDemoStore().lists;
|
||||
return storeLists.length > 0 ? storeLists[0].id : null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
const [selectedTag, setSelectedTag] = useState<string | null>(null);
|
||||
const [isTrashActive, setIsTrashActive] = useState(false);
|
||||
const [selectedTask, setSelectedTask] = useState<Task | null>(null);
|
||||
const [tasks, setTasks] = useState<Task[]>([]);
|
||||
const [tasks, setTasks] = useState<Task[]>(() => {
|
||||
if (isDemo && typeof window !== "undefined") {
|
||||
const store = getDemoStore();
|
||||
const firstListId = store.lists[0]?.id;
|
||||
return (store.tasks as Task[]).filter((t) => !t.isDeleted && t.listId === firstListId && !t.completed);
|
||||
}
|
||||
return [];
|
||||
});
|
||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||
const [showCompleted, setShowCompleted] = useState(false);
|
||||
const [cmdPaletteOpen, setCmdPaletteOpen] = useState(false);
|
||||
@@ -98,21 +116,11 @@ export function AppShell({ user, isDemo = false }: AppShellProps) {
|
||||
return () => document.removeEventListener("checkflow:openCommandPalette", handler);
|
||||
}, []);
|
||||
|
||||
// Demo store loading
|
||||
useEffect(() => {
|
||||
if (isDemo) {
|
||||
const store = getDemoStore();
|
||||
setLists(store.lists);
|
||||
if (store.lists.length > 0 && !selectedListId && !isTrashActive && !selectedTag) {
|
||||
setSelectedListId(store.lists[0].id);
|
||||
}
|
||||
}
|
||||
}, [isDemo, isTrashActive, selectedTag]);
|
||||
|
||||
// Demo tasks filter & reconstruct hierarchical structure
|
||||
useEffect(() => {
|
||||
if (isDemo) {
|
||||
const store = getDemoStore();
|
||||
setLists(store.lists);
|
||||
if (isTrashActive) {
|
||||
setTasks(getAllTrashTasks(store.tasks) as Task[]);
|
||||
} else if (selectedTag) {
|
||||
|
||||
Reference in New Issue
Block a user