feat: rebuild app using vike

This commit is contained in:
2024-02-22 12:15:04 +00:00
parent 87ef4ca1e3
commit 9777ae1676
104 changed files with 2214 additions and 2976 deletions
+21
View File
@@ -0,0 +1,21 @@
import type { FileSchema } from "~/server/db/schema/file";
import { createContext, useContext } from "react";
type TEditorContext = {
onOpenFile: (fileId: number) => void;
onFileChanged: (file: Omit<FileSchema, "content">) => void;
onDeleteFile: (fileId: number) => void;
};
const EditorContext = createContext<TEditorContext | null>(null);
export const useEditorContext = () => {
const ctx = useContext(EditorContext);
if (!ctx) {
throw new Error("Component not in EditorContext!");
}
return ctx;
};
export default EditorContext;
+19
View File
@@ -0,0 +1,19 @@
import { createContext, useContext } from "react";
type TProjectContext = {
slug: string;
isCompact?: boolean;
};
const ProjectContext = createContext<TProjectContext | null>(null);
export const useProjectContext = () => {
const ctx = useContext(ProjectContext);
if (!ctx) {
throw new Error("Component not in ProjectContext!");
}
return ctx;
};
export default ProjectContext;