managarten/packages/help/src/components/FeaturesOverview.svelte
Till JS 9bf73fffa3 fix(help): correct broken imports + tighten SupportedLanguage typing
Two unrelated bugs in the @mana/help package surface that together
accounted for ~40 type errors:

Broken component imports
  Ten components inside packages/help/src/components/ were importing
  from `'../types.js'` and `'./content'` — neither path resolves.
  The actual files are at `../ui-types` (where FAQSectionProps,
  FeaturesOverviewProps etc. live) and `../content` (where FAQItem,
  FeatureItem, FAQCategory live). Fix the imports to point at the
  real files. ESM resolution doesn't need `.js` suffixes when
  TypeScript is feeding tsc, and the existing index.ts already
  re-exports under the correct paths.

  Net: -19 type errors across:
    ChangelogEntry, ChangelogSection, ContactSection, FAQItem,
    FAQSection, FeatureCard, FeaturesOverview, GettingStartedGuide,
    HelpSearch, KeyboardShortcuts

content/help/index.ts SupportedLanguage cast
  `getManaHelpContent()` was passing `currentLocale` (typed `string`)
  into FAQ rows that expect a `SupportedLanguage` enum — 9 errors
  from each FAQ row. Add a small `asSupportedLanguage()` guard that
  validates the locale string against the union and falls back to
  'de' for unknown values. Single source of truth lives next to
  the function that needed it.

  Net: -9 type errors.

Combined with the spiral-db dist rebuild (local-only, gitignored)
and the previous Observable migration commit, the total error count
drops from 418 → 115.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 18:13:18 +02:00

50 lines
1.2 KiB
Svelte

<script lang="ts">
import type { FeaturesOverviewProps } from '../ui-types';
import FeatureCard from './FeatureCard.svelte';
let { items, translations }: FeaturesOverviewProps = $props();
const groupedItems = $derived(() => {
const groups: Record<string, typeof items> = {
'getting-started': [],
core: [],
advanced: [],
integration: [],
};
for (const item of items) {
const category = item.category || 'core';
if (groups[category]) {
groups[category].push(item);
} else {
groups.core.push(item);
}
}
return groups;
});
const hasItems = $derived(items.length > 0);
</script>
{#if !hasItems}
<p class="py-8 text-center text-gray-500 dark:text-gray-400">
{translations.features.noItems}
</p>
{:else}
<div class="space-y-8">
{#each Object.entries(groupedItems()) as [_category, categoryItems]}
{#if categoryItems.length > 0}
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
{#each categoryItems as item (item.id)}
<FeatureCard
{item}
learnMoreLabel={translations.features.learnMore}
comingSoonLabel={translations.features.comingSoon}
/>
{/each}
</div>
{/if}
{/each}
</div>
{/if}