mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 11:21:09 +02:00
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>
60 lines
1.7 KiB
Svelte
60 lines
1.7 KiB
Svelte
<script lang="ts">
|
|
import type { KeyboardShortcutsProps } from '../ui-types';
|
|
|
|
let { items, translations }: KeyboardShortcutsProps = $props();
|
|
|
|
const allShortcuts = $derived(() => {
|
|
return items.flatMap((item) =>
|
|
item.shortcuts.map((shortcut) => ({
|
|
...shortcut,
|
|
category: item.category,
|
|
title: item.title,
|
|
}))
|
|
);
|
|
});
|
|
|
|
const hasItems = $derived(allShortcuts().length > 0);
|
|
</script>
|
|
|
|
{#if !hasItems}
|
|
<p class="py-8 text-center text-gray-500 dark:text-gray-400">
|
|
{translations.shortcuts.noItems}
|
|
</p>
|
|
{:else}
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-left text-sm">
|
|
<thead>
|
|
<tr class="border-b border-gray-200 dark:border-gray-700">
|
|
<th class="pb-3 pr-4 font-semibold text-gray-900 dark:text-gray-100"
|
|
>{translations.shortcuts.columns.shortcut}</th
|
|
>
|
|
<th class="pb-3 pr-4 font-semibold text-gray-900 dark:text-gray-100"
|
|
>{translations.shortcuts.columns.action}</th
|
|
>
|
|
<th class="pb-3 font-semibold text-gray-900 dark:text-gray-100"
|
|
>{translations.shortcuts.columns.description}</th
|
|
>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100 dark:divide-gray-800">
|
|
{#each allShortcuts() as shortcut}
|
|
<tr>
|
|
<td class="py-3 pr-4">
|
|
<kbd
|
|
class="rounded bg-gray-100 px-2 py-1 font-mono text-xs text-gray-800 dark:bg-gray-800 dark:text-gray-200"
|
|
>
|
|
{shortcut.shortcut}
|
|
</kbd>
|
|
</td>
|
|
<td class="py-3 pr-4 text-gray-900 dark:text-gray-100">
|
|
{shortcut.action}
|
|
</td>
|
|
<td class="py-3 text-gray-600 dark:text-gray-400">
|
|
{shortcut.description || '-'}
|
|
</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|