Very awful code
This commit is contained in:
+37
-5
@@ -1,17 +1,42 @@
|
||||
import { Entity } from "@/components/sidebar/Entity";
|
||||
import { SetState } from "@/lib/types";
|
||||
import { useState } from "react";
|
||||
import { SidebarEntity } from "@/components/sidebar/Entity";
|
||||
import { SetState, Task } from "@/lib/types";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export interface Entity {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export type Workspace = {
|
||||
name: string;
|
||||
entities: Entity[];
|
||||
entities: SidebarEntity[];
|
||||
entityData: Record<string, any>;
|
||||
|
||||
route: string;
|
||||
setRoute: SetState<string>;
|
||||
};
|
||||
|
||||
function useTasks() {
|
||||
return useState<Task[]>([]);
|
||||
}
|
||||
|
||||
export default function useWorkspace(): Workspace {
|
||||
const [route, setRoute] = useState("");
|
||||
const [route, setRoute] = useState("alpha_tasks");
|
||||
const [tasks, setTasks] = useTasks();
|
||||
|
||||
useEffect(() => {
|
||||
setTasks([
|
||||
{ id: "1", title: "Buy groceries", status: "todo" },
|
||||
{ id: "2", title: "Plan sprint", status: "todo" },
|
||||
{
|
||||
id: "3",
|
||||
title: "Build App",
|
||||
description: "A simple description",
|
||||
tags: ["website", "api", "app"],
|
||||
status: "inprogress",
|
||||
},
|
||||
]);
|
||||
}, []);
|
||||
|
||||
return {
|
||||
name: "Personal Workspace",
|
||||
@@ -24,6 +49,13 @@ export default function useWorkspace(): Workspace {
|
||||
},
|
||||
],
|
||||
|
||||
entityData: {
|
||||
alpha_tasks: {
|
||||
tasks,
|
||||
setTasks,
|
||||
},
|
||||
},
|
||||
|
||||
route,
|
||||
setRoute,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user