mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-23 06:11:09 +03:00
Option to set bookmarks as homepage
This commit is contained in:
1 parent
acf16d1bab
commit
257d648169
5 files changed
+65
-50
No files matched your search
@@ -0,0 +1,52 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import ToolsGrid from '$lib/components/global/ToolsGrid.svelte';
|
||||
import BookmarksGrid from '$lib/components/global/BookmarksGrid.svelte';
|
||||
import { bookmarks } from '$lib/stores/bookmarks';
|
||||
|
||||
onMount(() => {
|
||||
bookmarks.init();
|
||||
});
|
||||
|
||||
const bookmarkCount = $derived($bookmarks.length);
|
||||
let showAll = $state(false);
|
||||
</script>
|
||||
|
||||
<BookmarksGrid />
|
||||
|
||||
<!-- Button for showing all tools, so user can find some to bookmark -->
|
||||
{#if bookmarkCount > 0}
|
||||
<div class="toggle-container">
|
||||
<button onclick={() => (showAll = !showAll)} class="toggle-button">
|
||||
{showAll ? 'Hide All' : 'Show All'}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Show all tools -->
|
||||
{#if bookmarkCount === 0 || showAll}
|
||||
<ToolsGrid />
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.toggle-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: var(--spacing-lg) 0;
|
||||
|
||||
.toggle-button {
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
background: var(--color-primary);
|
||||
color: var(--bg-primary);
|
||||
font-size: var(--font-size-md);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
transition: background 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--color-primary-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -228,6 +228,7 @@
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-md);
|
||||
background: var(--bg-tertiary);
|
||||
background: radial-gradient(var(--bg-tertiary), color-mix(in srgb, var(--bg-tertiary), var(--bg-primary) 25%));
|
||||
padding: var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
export type HomepageLayoutMode = 'default' | 'minimal' | 'carousel' | 'categories';
|
||||
export type HomepageLayoutMode = 'default' | 'minimal' | 'carousel' | 'categories' | 'bookmarks';
|
||||
|
||||
export interface HomepageLayoutOption {
|
||||
id: HomepageLayoutMode;
|
||||
@@ -18,6 +18,11 @@ export const homepageLayoutOptions: HomepageLayoutOption[] = [
|
||||
name: 'Categories',
|
||||
description: 'Organized by tool categories with flexible grid layout',
|
||||
},
|
||||
{
|
||||
id: 'bookmarks',
|
||||
name: 'Bookmarks',
|
||||
description: 'Show only your bookmarked tools',
|
||||
},
|
||||
{
|
||||
id: 'minimal',
|
||||
name: 'Minimal',
|
||||
@@ -25,7 +30,7 @@ export const homepageLayoutOptions: HomepageLayoutOption[] = [
|
||||
},
|
||||
{
|
||||
id: 'carousel',
|
||||
name: 'carousel',
|
||||
name: 'Carousel',
|
||||
description: 'Full homepage with all sections and features',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import HomepageMinimal from '$lib/components/home/HomepageMinimal.svelte';
|
||||
import HomepageCategories from '$lib/components/home/HomepageCategories.svelte';
|
||||
import HomepageCarousel from '$lib/components/home/HomepageCarousel.svelte';
|
||||
import HomepageBookmarks from '$lib/components/home/HomepageBookmarks.svelte';
|
||||
|
||||
// Helper function to extract nav items from mixed structure
|
||||
function extractNavItems(items: (NavItem | NavGroup)[]): NavItem[] {
|
||||
@@ -41,6 +42,8 @@
|
||||
<HomepageCategories {toolPages} {referencePages} />
|
||||
{:else if $currentLayout === 'carousel'}
|
||||
<HomepageCarousel />
|
||||
{:else if $currentLayout === 'bookmarks'}
|
||||
<HomepageBookmarks {toolPages} {referencePages} />
|
||||
{:else}
|
||||
<HomepageDefault {toolPages} {referencePages} />
|
||||
{/if}
|
||||
@@ -1,51 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import ToolsGrid from '$lib/components/global/ToolsGrid.svelte';
|
||||
import BookmarksGrid from '$lib/components/global/BookmarksGrid.svelte';
|
||||
import { bookmarks } from '$lib/stores/bookmarks';
|
||||
|
||||
onMount(() => {
|
||||
bookmarks.init();
|
||||
});
|
||||
|
||||
$: bookmarkCount = $bookmarks.length;
|
||||
let showAll = false;
|
||||
import HomepageBookmarks from '$lib/components/home/HomepageBookmarks.svelte';
|
||||
</script>
|
||||
|
||||
<BookmarksGrid />
|
||||
|
||||
<!-- Button for showing all tools, so user can find some to bookmark -->
|
||||
{#if bookmarkCount > 0}
|
||||
<div class="toggle-container">
|
||||
<button on:click={() => (showAll = !showAll)} class="toggle-button">
|
||||
{showAll ? 'Hide All' : 'Show All'}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Show all tools -->
|
||||
{#if bookmarkCount === 0 || showAll}
|
||||
<ToolsGrid />
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.toggle-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: var(--spacing-lg) 0;
|
||||
.toggle-button {
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
background: var(--color-primary);
|
||||
color: var(--bg-primary);
|
||||
font-size: var(--font-size-md);
|
||||
border-radius: var(--radius-sm);
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
transition: background 0.3s ease;
|
||||
&:hover {
|
||||
background: var(--color-primary-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<HomepageBookmarks />
|
||||
Reference in new issue
Block a user