porridger/front/src/assets/category.ts
dm1sh 0218cdced5
Code styling
Added brackets for const lambdas
Converted const lambdas with multiple instructions to functions
2023-07-15 12:55:25 +03:00

43 lines
1.5 KiB
TypeScript

import { isLiteralUnion } from '../utils/types'
const categories = ['PORRIDGE', 'conspects', 'milk', 'bred', 'wathing', 'cloth',
'fruits_vegatables', 'soup', 'dinner', 'conserves', 'pens', 'other_things'] as const
type Category = typeof categories[number]
const isCategory = (obj: unknown): obj is Category => (
isLiteralUnion(obj, categories)
)
const categoryGraphics: Record<Category, string> = {
'PORRIDGE': 'static/PORRIDGE.jpg',
'conspects': 'static/conspects.jpg',
'milk': 'static/milk.jpg',
'bred': 'static/bred.jpg',
'wathing': 'static/wathing.jpg',
'cloth': 'static/cloth.jpg',
'fruits_vegatables': 'static/fruits_vegatables.jpg',
'soup': 'static/soup.jpg',
'dinner': 'static/dinner.jpg',
'conserves': 'static/conserves.jpg',
'pens': 'static/pens.jpg',
'other_things': 'static/other_things.jpg',
}
const categoryNames: Record<Category, string> = {
'PORRIDGE': 'PORRIDGE',
'conspects': 'Конспекты',
'milk': 'Молочные продукты',
'bred': 'Хлебобулочные изделия',
'wathing': 'Моющие средства',
'cloth': 'Одежда',
'fruits_vegatables': 'Фрукты и овощи',
'soup': 'Супы',
'dinner': 'Ужин',
'conserves': 'Консервы',
'pens': 'Канцелярия',
'other_things': 'Всякая всячина',
}
export type { Category }
export { categories, categoryNames, categoryGraphics, isCategory }