might work, basic writing page with linking. no saving.

This commit is contained in:
2026-06-28 10:43:47 -05:00
parent 914c9fbac8
commit c04738f9c4
12 changed files with 745 additions and 3 deletions
+9
View File
@@ -127,4 +127,13 @@
html {
@apply font-sans;
}
h1 {
@apply text-4xl font-bold;
}
h2 {
@apply text-3xl font-bold;
}
h3 {
@apply text-2xl font-bold;
}
}
+68
View File
@@ -0,0 +1,68 @@
"use client";
import { useEffect, useState } from "react";
import { useSearchParams } from "next/navigation";
import { invoke } from "@tauri-apps/api/core";
import TextEditor from "@/components/text-editor";
import { HomelabApp } from "@/types"; // Adjust path if needed
export default function WritePage() {
const searchParams = useSearchParams();
const appQuery = searchParams.get("app");
const [initialAppIds, setInitialAppIds] = useState<string[]>([]);
const [loading, setLoading] = useState(true);
useEffect(() => {
const checkQueryParam = async () => {
if (!appQuery) {
setLoading(false);
return;
}
try {
// Fetch apps to find the one matching the query parameter string
const apps = (await invoke("get_app")) as HomelabApp[];
const matchedApp = apps.find(
(app) =>
app.id === appQuery ||
app.name.toLowerCase() === appQuery.toLowerCase(),
);
if (matchedApp) {
setInitialAppIds([matchedApp.id]);
}
} catch (error) {
console.error(
"Failed to fetch apps for query parameter auto-link:",
error,
);
} finally {
setLoading(false);
}
};
checkQueryParam();
}, [appQuery]);
const onSave = (content: string, linkedAppIds: string[]) => {
console.log("Document Rich Text: ", content);
console.log("Document Bound App IDs: ", linkedAppIds);
};
if (loading) {
return (
<div className="p-4 text-sm text-zinc-400">Loading workspace...</div>
);
}
return (
<div className="flex flex-col p-2">
<TextEditor
content=""
onSave={onSave}
initialLinkedAppIds={initialAppIds}
/>
</div>
);
}
+6 -2
View File
@@ -1,3 +1,7 @@
export default function WritePage() {
return <h1>Write Page</h1>;
export default function ViewBlogPage() {
return (
<div className="flex flex-col p-2">
<h1>You can view blogs here...</h1>
</div>
);
}