From 6d06f9f877e59bc96068a2bd112a6d46b56678b1 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Mon, 2 Mar 2026 14:53:54 +0300 Subject: [PATCH] fix(filters): remove hardcoded fallback --- .../ui/FontSampler/FontSampler.svelte | 15 +++++++++- .../GetFonts/model/state/manager.svelte.ts | 28 ++----------------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte b/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte index 5d891c0..a9d5d73 100644 --- a/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte +++ b/src/features/DisplayFont/ui/FontSampler/FontSampler.svelte @@ -38,6 +38,12 @@ const letterSpacing = $derived(controlManager.spacing); // Adjust the property name to match your UnifiedFont type const fontType = $derived((font as any).type ?? (font as any).category ?? ''); +// Extract provider badge with fallback +const providerBadge = $derived( + font.providerBadge + ?? (font.provider === 'google' ? 'Google Fonts' : 'Fontshare'), +); + const stats = $derived([ { label: 'SZ', value: `${fontSize}PX` }, { label: 'WGT', value: `${fontWeight}` }, @@ -73,7 +79,7 @@ const stats = $derived([ bg-paper dark:bg-dark-card " > - +
{String(index + 1).padStart(2, '0')} @@ -91,6 +97,13 @@ const stats = $derived([ {fontType} {/if} + + + {#if providerBadge} + + {providerBadge} + + {/if}
diff --git a/src/features/GetFonts/model/state/manager.svelte.ts b/src/features/GetFonts/model/state/manager.svelte.ts index f17057d..dd35e6f 100644 --- a/src/features/GetFonts/model/state/manager.svelte.ts +++ b/src/features/GetFonts/model/state/manager.svelte.ts @@ -1,16 +1,10 @@ import { createFilterManager } from '../../lib/filterManager/filterManager.svelte'; -import { - FONT_CATEGORIES, - FONT_PROVIDERS, - FONT_SUBSETS, -} from '../const/const'; import { filtersStore } from './filters.svelte'; /** * Creates initial filter config * - * Uses dynamic filters from backend if available, - * otherwise falls back to hard-coded constants + * Uses dynamic filters from backend with empty state initially */ function createInitialConfig() { const dynamicFilters = filtersStore.filters; @@ -33,26 +27,10 @@ function createInitialConfig() { }; } - // Fallback to hard-coded constants (backward compatibility) + // No filters loaded yet - return empty state return { queryValue: '', - groups: [ - { - id: 'providers', - label: 'Font provider', - properties: FONT_PROVIDERS, - }, - { - id: 'subsets', - label: 'Font subset', - properties: FONT_SUBSETS, - }, - { - id: 'categories', - label: 'Font category', - properties: FONT_CATEGORIES, - }, - ], + groups: [], }; }