chore: delete unused code

This commit is contained in:
Ilia Mashkov
2026-01-13 19:56:20 +03:00
parent 4c9b9f631f
commit 4810c2b228
10 changed files with 0 additions and 1297 deletions

View File

@@ -1,115 +0,0 @@
import {
filterValidValues,
isValidFontCategory,
isValidFontProvider,
isValidFontSubset,
} from '$entities/Font/lib/typeGuards';
import type { UnifiedFontStore } from '$entities/Font/model/store';
import { filterManager } from '$features/FilterFonts';
import type { Property } from '$shared/lib';
/**
* ============================================================================
* FILTER BRIDGE
* ============================================================================
*
* Bridges the UI filter state (filterManager from FilterFonts feature) with the
* unified font store (unifiedFontStore from Font entity).
*
* OPTIMIZATIONS (P1):
* - Runtime type validation using type guards
* - No more 'as any[]' casts - type-safe assignments
*/
// ... (comments)
// ============================================================================
// FILTER GROUP MAPPING
// ============================================================================
/**
* Get selected values from a filter manager group by ID
*/
function getSelectedFilterValues(groupId: string): string[] {
const group = filterManager.getGroup(groupId);
if (!group) return [];
return group.instance.selectedProperties.map((property: Property<string>) => property.value);
}
// ============================================================================
// SYNC LOGIC
// ============================================================================
/**
* Sync filter manager state to unified font store
*
* @param store - The unified font store instance
*/
export function syncFilters(store: UnifiedFontStore): void {
const providers = getSelectedFilterValues('providers');
const categories = getSelectedFilterValues('categories');
const subsets = getSelectedFilterValues('subsets');
// Validate and filter providers
const validProviders = filterValidValues(providers, isValidFontProvider);
// Validate and filter categories
const validCategories = filterValidValues(categories, isValidFontCategory);
// Validate and filter subsets
const validSubsets = filterValidValues(subsets, isValidFontSubset);
// Update unified store filters with validated, type-safe values
store.filters = {
providers: validProviders,
categories: validCategories,
subsets: validSubsets,
searchQuery: store.filters.searchQuery,
};
}
// ============================================================================
// PUBLIC API
// ============================================================================
/**
* Apply current filters and fetch fonts from providers
*
* @param store - The unified font store instance
*/
export async function applyFilters(store: UnifiedFontStore): Promise<void> {
await store.fetchFonts();
}
/**
* Reset all filters to their default state
*
* @param store - The unified font store instance
*/
export function resetFilters(store: UnifiedFontStore): void {
// Reset filter manager selections
filterManager.deselectAllGlobal();
// Clear unified store filters
store.clearFilters();
}
/**
* Apply current filter selections and fetch fonts
*
* @param store - The unified font store instance
*/
export async function applyFilterType(store: UnifiedFontStore): Promise<void> {
syncFilters(store);
await store.fetchFonts();
}
// ============================================================================
// RE-EXPORTS FOR CONVENIENCE
// ============================================================================
/**
* Re-export filter manager for direct access
*/
export { filterManager } from '$features/FilterFonts';