continue loading improve
This commit is contained in:
+4
-3
@@ -26,14 +26,15 @@ const App: Component = () => {
|
|||||||
|
|
||||||
onCleanup(() => removeListener());
|
onCleanup(() => removeListener());
|
||||||
|
|
||||||
// Background preload of other views
|
// Background preload of other views when idle
|
||||||
setTimeout(() => {
|
const idleCallback = (window as any).requestIdleCallback || ((cb: any) => setTimeout(cb, 1000));
|
||||||
|
idleCallback(() => {
|
||||||
// CriticalView is now static
|
// CriticalView is now static
|
||||||
import('./views/UrgencyView');
|
import('./views/UrgencyView');
|
||||||
import('./views/PriorityView');
|
import('./views/PriorityView');
|
||||||
import('./views/MatrixView');
|
import('./views/MatrixView');
|
||||||
import('./views/SettingsView');
|
import('./views/SettingsView');
|
||||||
}, 100);
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ export const Layout: Component<LayoutProps> = (props) => {
|
|||||||
const [isSidebarPeeking, setIsSidebarPeeking] = createSignal(false);
|
const [isSidebarPeeking, setIsSidebarPeeking] = createSignal(false);
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// Preload TaskDetail and QuickEntry in background
|
// Preload heavy components in background when idle
|
||||||
setTimeout(() => {
|
const idleCallback = (window as any).requestIdleCallback || ((cb: any) => setTimeout(cb, 2000));
|
||||||
|
idleCallback(() => {
|
||||||
import("./TaskDetail");
|
import("./TaskDetail");
|
||||||
import("./QuickEntry");
|
import("./QuickEntry");
|
||||||
}, 500);
|
import("./TaskEditor");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Derived active task for the detail view
|
// Derived active task for the detail view
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
import { type Component, createEffect, createSignal } from "solid-js";
|
import { type Component, createEffect, createSignal } from "solid-js";
|
||||||
import { Sheet, SheetContent } from "@/components/ui/sheet";
|
import { Sheet, SheetContent } from "@/components/ui/sheet";
|
||||||
import { type Task, removeTask, restoreTask, updateTask } from "@/store";
|
import { type Task, removeTask, restoreTask, updateTask } from "@/store";
|
||||||
import { TaskEditor } from "@/components/TaskEditor";
|
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
|
||||||
import { ArrowUpCircle, Clock, Calendar, Type, Trash2 } from "lucide-solid";
|
import { ArrowUpCircle, Clock, Calendar, Type, Trash2 } from "lucide-solid";
|
||||||
import { calculateDateFromUrgency, calculateUrgencyFromDate } from "@/store";
|
import { calculateDateFromUrgency, calculateUrgencyFromDate } from "@/store";
|
||||||
import { Button } from "./ui/button";
|
import { Button } from "./ui/button";
|
||||||
import { toast } from "solid-sonner";
|
import { toast } from "solid-sonner";
|
||||||
|
import { lazy, Suspense } from "solid-js";
|
||||||
|
|
||||||
|
const TaskEditor = lazy(() => import("./TaskEditor").then(m => ({ default: m.TaskEditor })));
|
||||||
|
|
||||||
interface TaskDetailProps {
|
interface TaskDetailProps {
|
||||||
task: Task;
|
task: Task;
|
||||||
@@ -101,10 +103,10 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
|||||||
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Priority</span>
|
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Priority</span>
|
||||||
<Select
|
<Select
|
||||||
value={props.task.priority.toString()}
|
value={props.task.priority.toString()}
|
||||||
onChange={(val) => val && updatePriority(val)}
|
onChange={(val: string | null) => val && updatePriority(val)}
|
||||||
options={["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]}
|
options={["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]}
|
||||||
placeholder="Priority"
|
placeholder="Priority"
|
||||||
itemComponent={(props) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
itemComponent={(props: any) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
||||||
>
|
>
|
||||||
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
||||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
||||||
@@ -121,10 +123,10 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
|||||||
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Time</span>
|
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Time</span>
|
||||||
<Select
|
<Select
|
||||||
value={currentUrgency()}
|
value={currentUrgency()}
|
||||||
onChange={(val) => val && updateUrgency(val)}
|
onChange={(val: string | null) => val && updateUrgency(val)}
|
||||||
options={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]}
|
options={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]}
|
||||||
placeholder="Urgency"
|
placeholder="Urgency"
|
||||||
itemComponent={(props) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
itemComponent={(props: any) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
||||||
>
|
>
|
||||||
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
||||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
||||||
@@ -201,11 +203,13 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
|||||||
|
|
||||||
{/* Editor Content */}
|
{/* Editor Content */}
|
||||||
<div class="flex-1 overflow-y-auto px-6 py-4 pb-20">
|
<div class="flex-1 overflow-y-auto px-6 py-4 pb-20">
|
||||||
<TaskEditor
|
<Suspense fallback={<div class="h-32 animate-pulse bg-muted/20 rounded-lg" />}>
|
||||||
content={props.task.content}
|
<TaskEditor
|
||||||
onUpdate={updateTaskContent}
|
content={props.task.content}
|
||||||
onEditorReady={setEditorInstance}
|
onUpdate={updateTaskContent}
|
||||||
/>
|
onEditorReady={setEditorInstance}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</SheetContent>
|
</SheetContent>
|
||||||
</Sheet>
|
</Sheet>
|
||||||
|
|||||||
Reference in New Issue
Block a user