Skip to content

Open source personal finance application

refactor: use WalletType from types instead of hardcoded union in demo

Ilya Komichev70a8abb5d441
diff --git a/app/components/demo/data.ts b/app/components/demo/data.ts
index 1710b9b8..c2567f0c 100644
--- a/app/components/demo/data.ts
+++ b/app/components/demo/data.ts
@@ -1,34 +1,25 @@
-import type { CategoryId } from '~/components/categories/types'
-import type { WalletId } from '~/components/wallets/types'
+import type { CategoryId, CategoryItem } from '~/components/categories/types'
+import type { WalletId, WalletItem } from '~/components/wallets/types'
type LocaleString = {
en: string
ru: string
}
-type DemoCategoryItem = {
- color: string
- icon: string
+/** CategoryItem with localized name + optional order for demo sorting */
+type DemoCategoryItem = Omit<CategoryItem, 'name'> & {
name: LocaleString
order?: number
- parentId: string | 0
- showInLastUsed: boolean
- showInQuickSelector: boolean
- updatedAt?: number
}
-type DemoWalletItem = {
+/** WalletItem with localized name/desc, optional fields for compact demo data */
+type DemoWalletItem = Partial<Omit<WalletItem, 'color' | 'currency' | 'desc' | 'name' | 'type'>> & {
color: string
creditLimit?: number
currency: string
desc: LocaleString
- isArchived?: boolean
- isExcludeInTotal?: boolean
- isWithdrawal?: boolean
name: LocaleString
- order?: number
- type: 'cash' | 'cashless' | 'credit' | 'crypto' | 'debt' | 'deposit'
- updatedAt?: number
+ type: WalletItem['type']
}
export const data: {