mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 21:46:35 +00:00
fix: get names from categories
This commit is contained in:
+12
-10
@@ -7,14 +7,16 @@ export type CategoryId =
|
|||||||
| 'generate'
|
| 'generate'
|
||||||
| 'filters';
|
| 'filters';
|
||||||
|
|
||||||
export type Category = { id: CategoryId; label: string };
|
/**
|
||||||
|
* Порядок категорий в каталоге. Человекочитаемые названия живут в словарях
|
||||||
export const CATEGORIES: Category[] = [
|
* i18n: секция categories, ключ = CategoryId.
|
||||||
{ id: 'convert', label: 'Конвертация' },
|
*/
|
||||||
{ id: 'alpha', label: 'Прозрачность' },
|
export const CATEGORIES: readonly CategoryId[] = [
|
||||||
{ id: 'color', label: 'Цвет' },
|
'convert',
|
||||||
{ id: 'geometry', label: 'Геометрия' },
|
'alpha',
|
||||||
{ id: 'filters', label: 'Фильтры' },
|
'color',
|
||||||
{ id: 'analyze', label: 'Анализ' },
|
'geometry',
|
||||||
{ id: 'generate', label: 'Генерация' }
|
'filters',
|
||||||
|
'analyze',
|
||||||
|
'generate'
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ describe('реестр инструментов', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it.each(TOOLS.map((t) => [t.id, t] as const))('%s: категория валидна', (_, tool) => {
|
it.each(TOOLS.map((t) => [t.id, t] as const))('%s: категория валидна', (_, tool) => {
|
||||||
expect(CATEGORIES.map((c) => c.id)).toContain(tool.category);
|
expect(CATEGORIES).toContain(tool.category);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each(TOOLS.map((t) => [t.id, t] as const))('%s: исполнители определены', (_, tool) => {
|
it.each(TOOLS.map((t) => [t.id, t] as const))('%s: исполнители определены', (_, tool) => {
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
<h1>{t('catalog.heading')}</h1>
|
<h1>{t('catalog.heading')}</h1>
|
||||||
<p class="lead text-muted">{t('catalog.lead', { count: TOOLS.length })}</p>
|
<p class="lead text-muted">{t('catalog.lead', { count: TOOLS.length })}</p>
|
||||||
|
|
||||||
{#each CATEGORIES as category (category.id)}
|
{#each CATEGORIES as category (category)}
|
||||||
{@const categoryTools = TOOLS.filter((tool) => tool.category === category.id)}
|
{@const categoryTools = TOOLS.filter((tool) => tool.category === category)}
|
||||||
{#if categoryTools.length > 0}
|
{#if categoryTools.length > 0}
|
||||||
<section id={category.id} class="category" aria-labelledby="{category.id}-heading">
|
<section id={category} class="category" aria-labelledby="{category}-heading">
|
||||||
<h2 id="{category.id}-heading" class="heading-section">{t(`categories.${category.id}`)}</h2>
|
<h2 id="{category}-heading" class="heading-section">{t(`categories.${category}`)}</h2>
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{#each categoryTools as tool (tool.id)}
|
{#each categoryTools as tool (tool.id)}
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
|
|||||||
Reference in New Issue
Block a user