diff --git a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx index b9ab1d86..93f4f3a7 100644 --- a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx +++ b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx @@ -16,10 +16,12 @@ import { Loader, Plus, X } from "lucide-react"; import { StoredContent } from "@/server/db/schema"; import { cleanUrl } from "@/lib/utils"; import { motion } from "framer-motion" +import { getMetaData } from "@/server/helpers"; -export function AddMemoryPage() { +export function AddMemoryPage({ closeDialog }: { closeDialog: () => void }) { const { addMemory } = useMemory(); + const [loading, setLoading] = useState(false); const [url, setUrl] = useState(""); const [selectedSpacesId, setSelectedSpacesId] = useState([]); @@ -37,38 +39,59 @@ export function AddMemoryPage() { placeholder="Enter the URL of the page" type="url" data-modal-autofocus - className="bg-rgray-4 mt-2 w-full" + className="disabled:opacity-70 disabled:cursor-not-allowed bg-rgray-4 mt-2 w-full" value={url} onChange={(e) => setUrl(e.target.value)} + disabled={loading} /> - + Cancel diff --git a/apps/web/src/components/Sidebar/MemoriesBar.tsx b/apps/web/src/components/Sidebar/MemoriesBar.tsx index eb26827c..9b0376e3 100644 --- a/apps/web/src/components/Sidebar/MemoriesBar.tsx +++ b/apps/web/src/components/Sidebar/MemoriesBar.tsx @@ -215,6 +215,9 @@ export function MemoryItem({ className="h-16 w-16" id={id.toString()} src={image!} + onError={(e) => { + (e.target as HTMLImageElement).src = "/icons/white_without_bg.png" + }} /> ): type === "note" ? (
@@ -414,7 +417,7 @@ export function SpaceMoreButton({ className="focus:bg-red-100 focus:text-red-400 dark:focus:bg-red-100/10" > - Move to Trash + Delete @@ -479,7 +482,7 @@ export function AddMemoryModal({ className="w-max max-w-[auto]" > {type === "page" ? ( - + setIsDialogOpen(false)} /> ) : type === "note" ? ( setIsDialogOpen(false)} /> ) : type === "space" ? ( diff --git a/apps/web/src/server/helpers.ts b/apps/web/src/server/helpers.ts index c7455a60..f1ac078c 100644 --- a/apps/web/src/server/helpers.ts +++ b/apps/web/src/server/helpers.ts @@ -1,3 +1,4 @@ +'use server'; import * as cheerio from "cheerio" export async function getMetaData(url: string) {