diff --git a/apps/web/public/note.svg b/apps/web/public/note.svg
new file mode 100644
index 00000000..ffb4c795
--- /dev/null
+++ b/apps/web/public/note.svg
@@ -0,0 +1,5 @@
+
diff --git a/apps/web/public/web.svg b/apps/web/public/web.svg
index dffbed97..c59f016d 100644
--- a/apps/web/public/web.svg
+++ b/apps/web/public/web.svg
@@ -1,3 +1,3 @@
\ No newline at end of file
+
diff --git a/apps/web/src/actions/db.ts b/apps/web/src/actions/db.ts
index a7b5bd47..66fbc830 100644
--- a/apps/web/src/actions/db.ts
+++ b/apps/web/src/actions/db.ts
@@ -31,7 +31,7 @@ export async function searchMemoriesAndSpaces(query: string, opts?: { filter?: {
}).from(storedContent).where(and(
eq(storedContent.user, user.id),
like(storedContent.title, `%${query}%`)
- ));
+ )).orderBy(asc(storedContent.savedAt));
const searchSpacesQuery = db.select({
type: sql`'space'`,
@@ -42,10 +42,12 @@ export async function searchMemoriesAndSpaces(query: string, opts?: { filter?: {
eq(space.user, user.id),
like(space.name, `%${query}%`)
)
- );
+ ).orderBy(asc(space.name));
let queries = [];
+ console.log('adding');
+
[undefined, true].includes(opts?.filter?.memories) && queries.push(searchMemoriesQuery);
[undefined, true].includes(opts?.filter?.spaces) && queries.push(searchSpacesQuery);
@@ -56,6 +58,8 @@ export async function searchMemoriesAndSpaces(query: string, opts?: { filter?: {
}
const data = await Promise.all(queries)
+
+ console.log('resp', data)
return data.reduce((acc, i) => [...acc, ...i]) as SearchResult[]
} catch {
@@ -231,12 +235,13 @@ export async function deleteSpace(id: number) {
return null
}
+ await db.delete(contentToSpace)
+ .where(eq(contentToSpace.spaceId, id));
+
const [deleted] = await db.delete(space)
.where(and(eq(space.user, user.id), eq(space.id, id)))
.returning();
- await db.delete(contentToSpace)
- .where(eq(contentToSpace.spaceId, id));
return deleted
@@ -252,13 +257,13 @@ export async function deleteMemory(id: number) {
return null
}
+ await db.delete(contentToSpace)
+ .where(eq(contentToSpace.contentId, id));
+
const [deleted] = await db.delete(storedContent)
.where(and(eq(storedContent.user, user.id), eq(storedContent.id, id)))
.returning();
- await db.delete(contentToSpace)
- .where(eq(contentToSpace.contentId, id));
-
return deleted
}
diff --git a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
index 93f4f3a7..90ac46fa 100644
--- a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
+++ b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
@@ -313,15 +313,15 @@ export function SpaceAddPage({ closeDialog }: { closeDialog: () => void }) {
);
}
-export function MemorySelectedItem({ id, title, url, image, onRemove }: StoredContent & { onRemove: () => void; }) {
+export function MemorySelectedItem({ id, title, url, type, image, onRemove }: StoredContent & { onRemove: () => void; }) {
return (
-

+
{title}
-
{cleanUrl(url)}
+
{type ==='note' ? 'Note' : cleanUrl(url)}
)
}
diff --git a/apps/web/src/components/Sidebar/FilterCombobox.tsx b/apps/web/src/components/Sidebar/FilterCombobox.tsx
index 30463672..88bb5a8c 100644
--- a/apps/web/src/components/Sidebar/FilterCombobox.tsx
+++ b/apps/web/src/components/Sidebar/FilterCombobox.tsx
@@ -180,7 +180,6 @@ export function FilterMemories({
const [isSearching, setIsSearching] = React.useState(false)
const results = React.useMemo(() => {
- console.log("use memo")
return searchResults.map(r => r.memory)
}, [searchResults])
@@ -258,7 +257,7 @@ export function FilterMemories({
-

+

{m.title}
i.id === m.id) !== undefined}
diff --git a/apps/web/src/components/Sidebar/MemoriesBar.tsx b/apps/web/src/components/Sidebar/MemoriesBar.tsx
index aaf40fd9..1c061451 100644
--- a/apps/web/src/components/Sidebar/MemoriesBar.tsx
+++ b/apps/web/src/components/Sidebar/MemoriesBar.tsx
@@ -354,19 +354,19 @@ export function SpaceItem({
c.image).reverse() as string[]}
+ images={spaceMemories.map((c) => c.type === 'note' ? '/note.svg' : c.image).reverse() as string[]}
/>
) : spaceMemories.length > 1 ? (
c.image).reverse() as string[]}
+ images={spaceMemories.map((c) => c.type === 'note' ? '/note.svg' : c.image).reverse() as string[]}
/>
) : spaceMemories.length === 1 ? (
) : (