fix(filters): remove hardcoded fallback
This commit is contained in:
@@ -38,6 +38,12 @@ const letterSpacing = $derived(controlManager.spacing);
|
|||||||
// Adjust the property name to match your UnifiedFont type
|
// Adjust the property name to match your UnifiedFont type
|
||||||
const fontType = $derived((font as any).type ?? (font as any).category ?? '');
|
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([
|
const stats = $derived([
|
||||||
{ label: 'SZ', value: `${fontSize}PX` },
|
{ label: 'SZ', value: `${fontSize}PX` },
|
||||||
{ label: 'WGT', value: `${fontWeight}` },
|
{ label: 'WGT', value: `${fontWeight}` },
|
||||||
@@ -73,7 +79,7 @@ const stats = $derived([
|
|||||||
bg-paper dark:bg-dark-card
|
bg-paper dark:bg-dark-card
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<!-- Left: index · name · type badge -->
|
<!-- Left: index · name · type badge · provider badge -->
|
||||||
<div class="flex items-center gap-2 sm:gap-4 min-w-0 shrink-0">
|
<div class="flex items-center gap-2 sm:gap-4 min-w-0 shrink-0">
|
||||||
<span class="font-mono text-[0.625rem] tracking-widest text-neutral-400 uppercase leading-none shrink-0">
|
<span class="font-mono text-[0.625rem] tracking-widest text-neutral-400 uppercase leading-none shrink-0">
|
||||||
{String(index + 1).padStart(2, '0')}
|
{String(index + 1).padStart(2, '0')}
|
||||||
@@ -91,6 +97,13 @@ const stats = $derived([
|
|||||||
{fontType}
|
{fontType}
|
||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<!-- Provider badge -->
|
||||||
|
{#if providerBadge}
|
||||||
|
<Badge size="xs" variant="default" class="text-nowrap font-mono" data-provider={font.provider}>
|
||||||
|
{providerBadge}
|
||||||
|
</Badge>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Right: stats, hidden on mobile, fade in on group hover -->
|
<!-- Right: stats, hidden on mobile, fade in on group hover -->
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
import { createFilterManager } from '../../lib/filterManager/filterManager.svelte';
|
import { createFilterManager } from '../../lib/filterManager/filterManager.svelte';
|
||||||
import {
|
|
||||||
FONT_CATEGORIES,
|
|
||||||
FONT_PROVIDERS,
|
|
||||||
FONT_SUBSETS,
|
|
||||||
} from '../const/const';
|
|
||||||
import { filtersStore } from './filters.svelte';
|
import { filtersStore } from './filters.svelte';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates initial filter config
|
* Creates initial filter config
|
||||||
*
|
*
|
||||||
* Uses dynamic filters from backend if available,
|
* Uses dynamic filters from backend with empty state initially
|
||||||
* otherwise falls back to hard-coded constants
|
|
||||||
*/
|
*/
|
||||||
function createInitialConfig() {
|
function createInitialConfig() {
|
||||||
const dynamicFilters = filtersStore.filters;
|
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 {
|
return {
|
||||||
queryValue: '',
|
queryValue: '',
|
||||||
groups: [
|
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,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user