29fd0c9a0f
Aggressive cleanup of 359 exports across 153 files identified as having zero importers outside their declaring module: - 105 symbols deleted entirely (no internal uses either) - 254 symbols un-exported (still referenced file-locally; dropped the `export` keyword to shrink the public surface) - ~70 cascade cleanups of locals that became dead once their sole consumer was removed Notable shrinkage: - src/hooks/useShakespeare.ts: 626 \u2192 22 lines (unwired AI chat surface; only the ChatMessage type is consumed) - src/hooks/useTrending.ts: only useEventStats survives; trending feed hooks were never wired up - src/hooks/useTrustedCountryStats.ts: dead type re-exports removed - src/lib/bitcoin.ts: PSBT helpers \u2014 unused wallet feature scaffolding - src/lib/communityUtils.ts: unused NIP-72 moderation helpers - src/lib/extraKinds.ts, src/lib/colorUtils.ts: unused helpers - src/lib/logger.ts: bare debug/info/warn/error exports dropped; consumers use the `logger` object - src/lib/aiChatSystemPrompt.ts: trimmed to the DEFAULT_SYSTEM_PROMPT_TEMPLATE constant - src/components/music/MusicTrackRow.tsx: dead row component removed; only the skeleton is consumed src/hooks/useNostr.ts (intentional decoy) and src/i18n.ts (side-effect import) were preserved per their respective contracts.
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
import { AGORA_PRESET_KIND_VALUES } from "./feedFilterUtils"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
/**
|
|
* Parse a kindFilter string into an array of kind numbers.
|
|
* Supports:
|
|
* - 'all' → undefined (no override)
|
|
* - 'agora' → the AGORA_PRESET_KIND_VALUES set (Campaigns, Pledges,
|
|
* Communities, Posts, Articles, Events, Polls, Photos, Videos)
|
|
* - 'custom' → parse customKindText as comma/space-separated numbers
|
|
* - Single kind number (e.g. '1') → [1]
|
|
* - Comma-separated kind numbers (e.g. '1,30023,20') → [1, 30023, 20]
|
|
*/
|
|
export function parseKindFilter(kindFilter: string, customKindText?: string): number[] | undefined {
|
|
if (kindFilter === 'all' || kindFilter === '') return undefined;
|
|
if (kindFilter === 'agora') return AGORA_PRESET_KIND_VALUES.map(Number);
|
|
if (kindFilter === 'custom') {
|
|
if (!customKindText) return undefined;
|
|
const parsed = customKindText.trim().split(/[\s,]+/).map(Number).filter((n) => Number.isInteger(n) && n > 0);
|
|
return parsed.length > 0 ? parsed : undefined;
|
|
}
|
|
// Comma-separated or single value
|
|
const parsed = kindFilter.split(',').map(Number).filter((n) => Number.isInteger(n) && n > 0);
|
|
return parsed.length > 0 ? parsed : undefined;
|
|
}
|
|
|