-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
70 lines (59 loc) · 1.56 KB
/
Copy pathtypes.ts
File metadata and controls
70 lines (59 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
export enum TransactionType {
EXPENSE = 'expense',
INCOME = 'income'
}
export enum Category {
FOOD = '餐饮',
TRANSPORT = '交通',
SHOPPING = '购物',
HOUSING = '居住',
ENTERTAINMENT = '娱乐',
MEDICAL = '医疗',
SALARY = '工资',
INVESTMENT = '理财',
OTHER = '其他'
}
export interface Transaction {
id: string;
amount: number;
type: TransactionType;
category: string; // Format: "Main" or "Main - Sub"
date: string; // ISO String
note: string;
createdAt: number;
}
export interface TransactionTemplate {
id: string;
name: string; // Usually same as note or category
amount: number;
type: TransactionType;
category: string;
note: string;
}
export interface SummaryStats {
totalIncome: number;
totalExpense: number;
balance: number;
}
export interface ChartDataPoint {
name: string;
value: number;
color: string;
}
export type CustomCategoryMap = Record<string, string[]>; // Main -> Sub[]
export type CustomMainCategoryMap = Record<TransactionType, string[]>; // Type -> Main[]
// --- Habit Types ---
export type HabitPeriod = 'daily' | 'weekly' | 'monthly' | 'custom';
export interface Habit {
id: string;
name: string;
icon: string; // Key for icon map
color: string;
targetCount: number; // e.g. 8 glasses of water
period: HabitPeriod;
customInterval?: number; // In days, used when period is 'custom'
allowExceed?: boolean; // If true, can log more than target count
logs: number[]; // Array of timestamps (ms) when action occurred
createdAt: number;
archived?: boolean; // Soft delete
}