diff --git a/src/lib/components/AddBookmarkForm/AddBookmarkForm.svelte b/src/lib/components/AddBookmarkForm/AddBookmarkForm.svelte
index 8c14550..83df3a7 100644
--- a/src/lib/components/AddBookmarkForm/AddBookmarkForm.svelte
+++ b/src/lib/components/AddBookmarkForm/AddBookmarkForm.svelte
@@ -1,197 +1,198 @@
diff --git a/src/lib/components/BookmarkCard/BookmarkCard.svelte b/src/lib/components/BookmarkCard/BookmarkCard.svelte
index 0849610..b3f82c5 100644
--- a/src/lib/components/BookmarkCard/BookmarkCard.svelte
+++ b/src/lib/components/BookmarkCard/BookmarkCard.svelte
@@ -2,11 +2,12 @@
import type { Bookmark } from '$lib/types/Bookmark.type';
import { applyAction, enhance } from '$app/forms';
+ import { invalidate } from '$app/navigation';
+ import { page } from '$app/stores';
import { bookmarksStore } from '$lib/stores/bookmarks.store';
import { editBookmarkStore } from '$lib/stores/edit-bookmark.store';
import { searchEngine } from '$lib/stores/search.store';
import { showBookmarkStore } from '$lib/stores/show-bookmark.store';
- import { userSettingsStore } from '$lib/stores/user-settings.store';
import { removeBookmarkFromSearchIndex } from '$lib/utils/search';
import { showToast } from '$lib/utils/show-toast';
import {
@@ -37,7 +38,7 @@
-
- {bookmark.category.name}
-
+ {bookmark.category.name}
+
+ {/if}
diff --git a/src/lib/components/EditCategoryForm/EditCategoryForm.svelte b/src/lib/components/EditCategoryForm/EditCategoryForm.svelte
index 5c688a5..f7bd698 100644
--- a/src/lib/components/EditCategoryForm/EditCategoryForm.svelte
+++ b/src/lib/components/EditCategoryForm/EditCategoryForm.svelte
@@ -16,9 +16,9 @@
let form: HTMLFormElement;
export let closeModal: () => void;
- const categoriesOptions = writable<{ value: string; label: string }[]>([
+ const categoriesOptions = writable<{ value: number; label: string }[]>([
{
- value: 'null',
+ value: 0,
label: 'No parent'
}
]);
@@ -26,7 +26,7 @@
$: {
$categoriesOptions = [
{
- value: 'null',
+ value: 0,
label: 'No parent'
},
...$page.data.categories
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 704e257..7d8e3f4 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -1,7 +1,8 @@
import type { LayoutServerLoad } from './$types';
import { db } from '$lib/database/db';
import {
- getBookmarksByUserId, getBookmarksCountForUser
+ getBookmarksByUserId,
+ getBookmarksCountForUser
} from '$lib/database/repositories/Bookmark.repository';
import { fetchUserCategoryAndTags, getUserCount } from '$lib/database/repositories/User.repository';
import { searchIndexKeys } from '$lib/utils/search';
@@ -10,7 +11,9 @@ import type { Category } from '$lib/types/Category.type';
import type { Bookmark, BookmarkForIndex } from '$lib/types/Bookmark.type';
import type { Tag } from '$lib/types/Tag.type';
-export const load = (async ({ locals, url }) => {
+export const load = (async ({ locals, url, depends }) => {
+ depends('app:main-page');
+
const userCount = await getUserCount();
const noUsersFound = userCount === 0;
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 0e47f83..47c1720 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,30 +1,53 @@
+
+
@@ -42,8 +65,7 @@
type="text"
placeholder="Search"
bind:value={$searchedValue}
- class={`input input-bordered w-full ${$searchedValue ? 'rounded-r-none' : ''}`}
- />
+ class={`input input-bordered w-full ${$searchedValue ? 'rounded-r-none' : ''}`} />
{#if $searchedValue}
-
+
{#if !user}
@@ -114,8 +134,7 @@
Categories
+ onclick="addCategoryModal.showModal()">➕
@@ -127,8 +146,7 @@
{#each $page.data.tags as tag (tag.id)}
{#if tag.bookmarks?.length > 0}
#{tag.name}
+ >#{tag.name}
{/if}
{/each}
@@ -159,28 +177,4 @@
-
-
+ }} />
diff --git a/src/routes/settings/+page.server.ts b/src/routes/settings/+page.server.ts
index dda4fb8..954ffb6 100644
--- a/src/routes/settings/+page.server.ts
+++ b/src/routes/settings/+page.server.ts
@@ -22,16 +22,43 @@ export const actions = {
};
}
- const data = await request.formData();
- const settings = JSON.parse(data.get('settings') as string) as UserSettings;
+ const settings = await request.formData();
- const updatedSettings = await updateUserSettings(owner, settings)
+ const mappedSettings: UserSettings = {
+ theme: settings.get('theme') as UserSettings['theme'],
+ uiAnimations: settings.get('uiAnimations') === 'on',
+ llm: {
+ enabled: settings.get('llmEnabled') === 'on',
+ provider: settings.get('llmProvider') as UserSettings['llm']['provider'],
+ ollama: {
+ url: settings.get('llmOllamaUrl') as string,
+ model: settings.get('llmOllamaModel') as string,
+ summarize: {
+ enabled: settings.get('llmOllamaSummarizeEnabled') === 'on',
+ system: settings.get('llmOllamaSystemmsg') as string
+ },
+ generateTags: {
+ enabled: settings.get('llmOllamaGenerateTagsEnabled') === 'on',
+ system: settings.get('llmOllamaSystemmsg') as string
+ }
+ },
+ openai: {
+ apiKey: settings.get('llmOpenaiApikey') as string
+ }
+ }
+ };
+
+ console.log('Received mappedSettings:', JSON.stringify(mappedSettings, null, 2));
+
+ const updatedSettings = await updateUserSettings(owner, mappedSettings)
.then(({ settings }) => settings)
.catch((err) => {
console.error('Error updating user settings. Details:', JSON.stringify(err, null, 2));
return null;
});
+ console.log('Updated settings:', JSON.stringify(updatedSettings, null, 2));
+
if (!updatedSettings) {
return {
success: false,