diff --git a/src/lib/components/furniture/SettingsMenu.svelte b/src/lib/components/furniture/SettingsMenu.svelte
index 8d595f8..50c7a89 100644
--- a/src/lib/components/furniture/SettingsMenu.svelte
+++ b/src/lib/components/furniture/SettingsMenu.svelte
@@ -7,6 +7,7 @@
import { browser } from '$app/environment';
import { theme, themes, type ThemeOption, type Theme } from '$lib/stores/theme';
import { navbarDisplay, navbarDisplayOptions, type NavbarDisplayMode } from '$lib/stores/navbarDisplay';
+ import { homepageLayout, homepageLayoutOptions, type HomepageLayoutMode } from '$lib/stores/homepageLayout';
import { site } from '$lib/constants/site';
import { resolve } from '$app/paths';
@@ -24,6 +25,7 @@
let accessibilitySettings = $state(accessibility);
let currentTheme = $state(theme);
let currentNavbarDisplay = $state(navbarDisplay);
+ let currentHomepageLayout = $state(homepageLayout);
// Shortcut key detection
const isMac = browser && navigator.platform.toUpperCase().indexOf('MAC') >= 0;
@@ -54,6 +56,12 @@
navbarDisplay.setMode(target.value as NavbarDisplayMode);
}
+ // Handle homepage layout mode change
+ function handleHomepageLayoutChange(event: Event) {
+ const target = event.currentTarget as HTMLSelectElement;
+ homepageLayout.setMode(target.value as HomepageLayoutMode);
+ }
+
// Primary accessibility options (always visible)
const primaryA11yOptions = ['reduce-motion'];
// const primaryA11yOptions: string[] = [];
@@ -108,6 +116,7 @@
accessibility.init();
theme.init();
navbarDisplay.init();
+ homepageLayout.init();
return () => {
document.removeEventListener('click', handleClickOutside);
@@ -236,6 +245,24 @@
+
+
+
Homepage Layout
+
+
+
+
+
+
+
+ {homepageLayoutOptions.find((opt) => opt.id === $currentHomepageLayout)?.description}
+
+
+
Accessibility
diff --git a/src/lib/components/global/ContextMenu.svelte b/src/lib/components/global/ContextMenu.svelte
new file mode 100644
index 0000000..14039c9
--- /dev/null
+++ b/src/lib/components/global/ContextMenu.svelte
@@ -0,0 +1,138 @@
+
+
+
+
+
diff --git a/src/lib/components/global/ToolCard.svelte b/src/lib/components/global/ToolCard.svelte
index daf78e4..b02582e 100644
--- a/src/lib/components/global/ToolCard.svelte
+++ b/src/lib/components/global/ToolCard.svelte
@@ -2,24 +2,36 @@
import { tooltip } from '$lib/actions/tooltip';
import { onMount } from 'svelte';
import Icon from '$lib/components/global/Icon.svelte';
+ import ContextMenu from '$lib/components/global/ContextMenu.svelte';
import type { NavItem } from '$lib/constants/nav';
import { bookmarks, type BookmarkedTool } from '$lib/stores/bookmarks';
+ import { toolUsage, recentlyUsedTools } from '$lib/stores/toolUsage';
+ import { activeContextMenu } from '$lib/stores/contextMenu';
+ import { site } from '$lib/constants/site';
export let tool: NavItem;
- export let small: boolean = false;
+ export let size: 'default' | 'small' | 'compact' = 'default';
let isHovered = false;
let isBookmarked = false;
+ // Generate unique ID for this tool card
+ const menuId = `context-menu-${tool.href}`;
+
onMount(() => {
bookmarks.init();
+ toolUsage.init();
});
$: isBookmarked = bookmarks.isBookmarked(tool.href, $bookmarks);
+ $: isInRecents = $recentlyUsedTools.some((t) => t.href === tool.href);
+ $: showContextMenu = $activeContextMenu.id === menuId;
- function toggleBookmark(e: Event) {
- e.preventDefault();
- e.stopPropagation();
+ function toggleBookmark(e?: Event) {
+ if (e) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
const bookmarkedTool: BookmarkedTool = {
href: tool.href,
@@ -30,10 +42,60 @@
bookmarks.toggle(bookmarkedTool);
}
+
+ function handleContextMenu(e: MouseEvent) {
+ e.preventDefault();
+ e.stopPropagation();
+ activeContextMenu.open(menuId, e.clientX, e.clientY);
+ }
+
+ function copyUrl() {
+ const origin = typeof window !== 'undefined' ? window.location.origin : site.url;
+ const url = `${origin}${tool.href}`;
+ navigator.clipboard.writeText(url);
+ }
+
+ function openTool() {
+ window.location.href = tool.href;
+ }
+
+ function removeFromRecents() {
+ toolUsage.remove(tool.href);
+ }
+
+ $: contextMenuItems = [
+ {
+ label: isBookmarked ? 'Remove Bookmark' : 'Bookmark',
+ icon: isBookmarked ? 'bookmark-remove' : 'bookmark-add',
+ action: () => toggleBookmark(),
+ },
+ {
+ label: 'Open',
+ icon: 'external-link',
+ action: openTool,
+ },
+ {
+ label: 'Copy URL',
+ icon: 'link',
+ action: copyUrl,
+ },
+ {
+ label: 'Remove from Recents',
+ icon: 'trash',
+ action: removeFromRecents,
+ condition: isInRecents,
+ },
+ ];
-{#if small}
-
+{#if size === 'small'}
+