add new toy category list support traditional chinese
This commit is contained in:
parent
ae1d9d269e
commit
86bbba00b9
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
|
@ -14,7 +15,21 @@ import { ToyBrick, Save, PlusCircle, Trash2 } from 'lucide-react';
|
||||||
import type { Toy } from '@/types';
|
import type { Toy } from '@/types';
|
||||||
import { useI18n, useCurrentLocale } from '@/locales/client';
|
import { useI18n, useCurrentLocale } from '@/locales/client';
|
||||||
|
|
||||||
const toyCategories = ["Educational", "Vehicles", "Electronics", "Plush Toys", "Musical", "Outdoor", "Board Games", "Action Figures", "Dolls", "Puzzles", "Arts & Crafts", "Building Blocks"];
|
const toyCategoryDefinitions = [
|
||||||
|
{ key: 'educational', value: 'Educational' },
|
||||||
|
{ key: 'vehicles', value: 'Vehicles' },
|
||||||
|
{ key: 'electronics', value: 'Electronics' },
|
||||||
|
{ key: 'plush_toys', value: 'Plush Toys' },
|
||||||
|
{ key: 'musical', value: 'Musical' },
|
||||||
|
{ key: 'outdoor', value: 'Outdoor' },
|
||||||
|
{ key: 'board_games', value: 'Board Games' },
|
||||||
|
{ key: 'action_figures', value: 'Action Figures' },
|
||||||
|
{ key: 'dolls', value: 'Dolls' },
|
||||||
|
{ key: 'puzzles', value: 'Puzzles' },
|
||||||
|
{ key: 'arts_crafts', value: 'Arts & Crafts' },
|
||||||
|
{ key: 'building_blocks', value: 'Building Blocks' },
|
||||||
|
];
|
||||||
|
|
||||||
const daysOfWeek = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] as const;
|
const daysOfWeek = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'] as const;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -120,7 +135,11 @@ export default function AddToyForm({ initialData, isEditMode = false }: AddToyFo
|
||||||
<SelectValue placeholder={t('add_toy_form.select_category_placeholder')} />
|
<SelectValue placeholder={t('add_toy_form.select_category_placeholder')} />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{toyCategories.map(cat => <SelectItem key={cat} value={cat}>{cat}</SelectItem>)}
|
{toyCategoryDefinitions.map(catDef => (
|
||||||
|
<SelectItem key={catDef.key} value={catDef.value}>
|
||||||
|
{t(`toy_categories.${catDef.key}` as any)} {/* Use 'as any' if TS complains about template literal type */}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -193,3 +212,5 @@ export default function AddToyForm({ initialData, isEditMode = false }: AddToyFo
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'header.browse_toys': 'Browse Toys',
|
'header.browse_toys': 'Browse Toys',
|
||||||
'header.login': 'Login',
|
'header.login': 'Login',
|
||||||
|
|
@ -149,4 +150,18 @@ export default {
|
||||||
'owner_toys.owner_not_found': 'Owner not found or has no toys listed.',
|
'owner_toys.owner_not_found': 'Owner not found or has no toys listed.',
|
||||||
'owner_toys.back_to_home': 'Back to Home',
|
'owner_toys.back_to_home': 'Back to Home',
|
||||||
'owner_toys.unknown_owner': 'Unknown Owner',
|
'owner_toys.unknown_owner': 'Unknown Owner',
|
||||||
|
'toy_categories.educational': 'Educational',
|
||||||
|
'toy_categories.vehicles': 'Vehicles',
|
||||||
|
'toy_categories.electronics': 'Electronics',
|
||||||
|
'toy_categories.plush_toys': 'Plush Toys',
|
||||||
|
'toy_categories.musical': 'Musical',
|
||||||
|
'toy_categories.outdoor': 'Outdoor',
|
||||||
|
'toy_categories.board_games': 'Board Games',
|
||||||
|
'toy_categories.action_figures': 'Action Figures',
|
||||||
|
'toy_categories.dolls': 'Dolls',
|
||||||
|
'toy_categories.puzzles': 'Puzzles',
|
||||||
|
'toy_categories.arts_crafts': 'Arts & Crafts',
|
||||||
|
'toy_categories.building_blocks': 'Building Blocks',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'header.browse_toys': '瀏覽玩具',
|
'header.browse_toys': '瀏覽玩具',
|
||||||
'header.login': '登入',
|
'header.login': '登入',
|
||||||
|
|
@ -149,4 +150,18 @@ export default {
|
||||||
'owner_toys.owner_not_found': '找不到擁有者或該擁有者沒有列出任何玩具。',
|
'owner_toys.owner_not_found': '找不到擁有者或該擁有者沒有列出任何玩具。',
|
||||||
'owner_toys.back_to_home': '返回首頁',
|
'owner_toys.back_to_home': '返回首頁',
|
||||||
'owner_toys.unknown_owner': '未知擁有者',
|
'owner_toys.unknown_owner': '未知擁有者',
|
||||||
|
'toy_categories.educational': '教育類',
|
||||||
|
'toy_categories.vehicles': '交通工具',
|
||||||
|
'toy_categories.electronics': '電子玩具',
|
||||||
|
'toy_categories.plush_toys': '絨毛玩具',
|
||||||
|
'toy_categories.musical': '音樂玩具',
|
||||||
|
'toy_categories.outdoor': '戶外玩具',
|
||||||
|
'toy_categories.board_games': '桌遊',
|
||||||
|
'toy_categories.action_figures': '動作公仔',
|
||||||
|
'toy_categories.dolls': '娃娃',
|
||||||
|
'toy_categories.puzzles': '拼圖',
|
||||||
|
'toy_categories.arts_crafts': '美術勞作',
|
||||||
|
'toy_categories.building_blocks': '積木',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue