Task fully working except collaborative to handoff switching handling
This commit is contained in:
@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { NOTES_COLLECTION } from "@/lib/constants";
|
import { NOTES_COLLECTION } from "@/lib/constants";
|
||||||
import { FilterBar } from "./FilterBar";
|
import { FilterBar } from "./FilterBar";
|
||||||
|
import { normalizeNoteKey } from "@/lib/tags";
|
||||||
|
|
||||||
export const NotesSidebar: Component<{
|
export const NotesSidebar: Component<{
|
||||||
selectedNoteId: string | null;
|
selectedNoteId: string | null;
|
||||||
@@ -170,12 +171,15 @@ export const NotesSidebar: Component<{
|
|||||||
const handleCreateNote = async () => {
|
const handleCreateNote = async () => {
|
||||||
if (!currentUserId) return;
|
if (!currentUserId) return;
|
||||||
try {
|
try {
|
||||||
|
const keyBase = normalizeNoteKey("new-note");
|
||||||
const result = await pb.collection(NOTES_COLLECTION).create({
|
const result = await pb.collection(NOTES_COLLECTION).create({
|
||||||
title: "New Note",
|
title: "New Note",
|
||||||
|
key: `${keyBase}-${Date.now()}`,
|
||||||
content: "",
|
content: "",
|
||||||
tags: [],
|
tags: [],
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
user: currentUserId,
|
user: currentUserId,
|
||||||
|
tasks: []
|
||||||
});
|
});
|
||||||
props.setSelectedNoteId(result.id);
|
props.setSelectedNoteId(result.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -964,6 +964,7 @@ export const cleanupNoteAttachments = async (noteId: string) => {
|
|||||||
console.log(`[CLEANUP] Deleted ${filesToDelete.length} orphaned attachment(s) for note ${noteId}`);
|
console.log(`[CLEANUP] Deleted ${filesToDelete.length} orphaned attachment(s) for note ${noteId}`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
if ((err as any)?.status === 404) return;
|
||||||
console.error("[CLEANUP] Failed to clean up orphaned note attachments:", err);
|
console.error("[CLEANUP] Failed to clean up orphaned note attachments:", err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { NotesSidebar } from "@/components/NotesSidebar";
|
|||||||
import { toast } from "solid-sonner";
|
import { toast } from "solid-sonner";
|
||||||
import { TextBubbleMenu } from "@/components/TextBubbleMenu";
|
import { TextBubbleMenu } from "@/components/TextBubbleMenu";
|
||||||
import { TableBubbleMenu } from "@/components/TableBubbleMenu";
|
import { TableBubbleMenu } from "@/components/TableBubbleMenu";
|
||||||
|
import { normalizeNoteKey } from "@/lib/tags";
|
||||||
|
|
||||||
export const NotepadView: Component<{
|
export const NotepadView: Component<{
|
||||||
selectedNoteId: string | null;
|
selectedNoteId: string | null;
|
||||||
@@ -229,12 +230,15 @@ export const NotepadView: Component<{
|
|||||||
if (!root || !userId) return;
|
if (!root || !userId) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const keyBase = normalizeNoteKey(`${root.key || root.title}-tab`);
|
||||||
const result = await pb.collection(NOTES_COLLECTION).create({
|
const result = await pb.collection(NOTES_COLLECTION).create({
|
||||||
title: "New Tab",
|
title: "New Tab",
|
||||||
|
key: `${keyBase}-${Date.now()}`,
|
||||||
content: "",
|
content: "",
|
||||||
tags: [`child-of-${root.id}`],
|
tags: [`child-of-${root.id}`],
|
||||||
isPrivate: root.isPrivate, // inherit privacy
|
isPrivate: root.isPrivate, // inherit privacy
|
||||||
user: userId,
|
user: userId,
|
||||||
|
tasks: []
|
||||||
});
|
});
|
||||||
props.setSelectedNoteId(result.id);
|
props.setSelectedNoteId(result.id);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user