@nice2dev/templates 1.1.6 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +974 -971
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Y = Object.defineProperty;
|
|
2
|
-
var _ = (
|
|
3
|
-
var w = (
|
|
4
|
-
import { jsx as i, jsxs as
|
|
5
|
-
import { createContext as
|
|
2
|
+
var _ = (s, e, t) => e in s ? Y(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var w = (s, e, t) => _(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
import { createContext as W, useContext as F, useState as S, useCallback as L, useMemo as z, useEffect as X } from "react";
|
|
6
6
|
const J = [
|
|
7
7
|
{
|
|
8
8
|
id: "apple",
|
|
@@ -127,12 +127,12 @@ class Z {
|
|
|
127
127
|
WORKOUTS
|
|
128
128
|
───────────────────────────────────────────────────────────── */
|
|
129
129
|
addWorkout(e) {
|
|
130
|
-
const t = this.generateId(),
|
|
131
|
-
return this.workouts.set(t,
|
|
130
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
131
|
+
return this.workouts.set(t, r), r;
|
|
132
132
|
}
|
|
133
133
|
updateWorkout(e, t) {
|
|
134
|
-
const
|
|
135
|
-
|
|
134
|
+
const r = this.workouts.get(e);
|
|
135
|
+
r && this.workouts.set(e, { ...r, ...t, id: e });
|
|
136
136
|
}
|
|
137
137
|
deleteWorkout(e) {
|
|
138
138
|
this.workouts.delete(e);
|
|
@@ -143,37 +143,37 @@ class Z {
|
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
getWorkoutsForPeriod(e, t) {
|
|
146
|
-
return this.getAllWorkouts().filter((
|
|
147
|
-
const
|
|
148
|
-
return
|
|
146
|
+
return this.getAllWorkouts().filter((r) => {
|
|
147
|
+
const n = new Date(r.date);
|
|
148
|
+
return n >= e && n <= t;
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
getWorkoutStats(e = 7) {
|
|
152
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
153
|
-
for (const
|
|
154
|
-
|
|
152
|
+
const t = new Date(Date.now() - e * 864e5), r = this.getWorkoutsForPeriod(t, /* @__PURE__ */ new Date()), n = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const o of r)
|
|
154
|
+
n.set(o.type, (n.get(o.type) || 0) + 1);
|
|
155
155
|
return {
|
|
156
|
-
totalWorkouts:
|
|
157
|
-
totalDuration:
|
|
158
|
-
totalCalories:
|
|
159
|
-
avgDuration:
|
|
160
|
-
byType: Array.from(
|
|
156
|
+
totalWorkouts: r.length,
|
|
157
|
+
totalDuration: r.reduce((o, l) => o + l.duration, 0),
|
|
158
|
+
totalCalories: r.reduce((o, l) => o + l.caloriesBurned, 0),
|
|
159
|
+
avgDuration: r.length > 0 ? r.reduce((o, l) => o + l.duration, 0) / r.length : 0,
|
|
160
|
+
byType: Array.from(n.entries()).map(([o, l]) => ({ type: o, count: l }))
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
/* ─────────────────────────────────────────────────────────────
|
|
164
164
|
NUTRITION
|
|
165
165
|
───────────────────────────────────────────────────────────── */
|
|
166
166
|
addMeal(e) {
|
|
167
|
-
const t = this.generateId(),
|
|
168
|
-
return this.meals.set(t,
|
|
167
|
+
const t = this.generateId(), r = this.calculateMealTotals(e.foods), n = { ...e, id: t, ...r };
|
|
168
|
+
return this.meals.set(t, n), n;
|
|
169
169
|
}
|
|
170
170
|
calculateMealTotals(e) {
|
|
171
171
|
return e.reduce(
|
|
172
|
-
(t, { item:
|
|
173
|
-
totalCalories: t.totalCalories +
|
|
174
|
-
totalProtein: t.totalProtein +
|
|
175
|
-
totalCarbs: t.totalCarbs +
|
|
176
|
-
totalFat: t.totalFat +
|
|
172
|
+
(t, { item: r, servings: n }) => ({
|
|
173
|
+
totalCalories: t.totalCalories + r.calories * n,
|
|
174
|
+
totalProtein: t.totalProtein + r.protein * n,
|
|
175
|
+
totalCarbs: t.totalCarbs + r.carbs * n,
|
|
176
|
+
totalFat: t.totalFat + r.fat * n
|
|
177
177
|
}),
|
|
178
178
|
{ totalCalories: 0, totalProtein: 0, totalCarbs: 0, totalFat: 0 }
|
|
179
179
|
);
|
|
@@ -189,46 +189,46 @@ class Z {
|
|
|
189
189
|
getMealsForDate(e) {
|
|
190
190
|
const t = new Date(e);
|
|
191
191
|
t.setHours(0, 0, 0, 0);
|
|
192
|
-
const
|
|
193
|
-
return this.getAllMeals().filter((
|
|
194
|
-
const
|
|
195
|
-
return
|
|
192
|
+
const r = new Date(t.getTime() + 864e5);
|
|
193
|
+
return this.getAllMeals().filter((n) => {
|
|
194
|
+
const o = new Date(n.date);
|
|
195
|
+
return o >= t && o < r;
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
getDailyNutrition(e) {
|
|
199
199
|
const t = this.getMealsForDate(e);
|
|
200
200
|
return {
|
|
201
|
-
calories: t.reduce((
|
|
202
|
-
protein: t.reduce((
|
|
203
|
-
carbs: t.reduce((
|
|
204
|
-
fat: t.reduce((
|
|
201
|
+
calories: t.reduce((r, n) => r + n.totalCalories, 0),
|
|
202
|
+
protein: t.reduce((r, n) => r + n.totalProtein, 0),
|
|
203
|
+
carbs: t.reduce((r, n) => r + n.totalCarbs, 0),
|
|
204
|
+
fat: t.reduce((r, n) => r + n.totalFat, 0),
|
|
205
205
|
meals: t.length
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
searchFoods(e) {
|
|
209
209
|
const t = e.toLowerCase();
|
|
210
|
-
return this.foodDatabase.filter((
|
|
210
|
+
return this.foodDatabase.filter((r) => r.name.toLowerCase().includes(t));
|
|
211
211
|
}
|
|
212
212
|
addCustomFood(e) {
|
|
213
|
-
const t = this.generateId(),
|
|
214
|
-
return this.foodDatabase.push(
|
|
213
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
214
|
+
return this.foodDatabase.push(r), r;
|
|
215
215
|
}
|
|
216
216
|
/* ─────────────────────────────────────────────────────────────
|
|
217
217
|
SLEEP
|
|
218
218
|
───────────────────────────────────────────────────────────── */
|
|
219
219
|
addSleepEntry(e) {
|
|
220
|
-
const t = this.generateId(),
|
|
221
|
-
return this.sleep.set(t,
|
|
220
|
+
const t = this.generateId(), r = (new Date(e.wakeTime).getTime() - new Date(e.bedtime).getTime()) / 36e5, n = { ...e, id: t, duration: r };
|
|
221
|
+
return this.sleep.set(t, n), n;
|
|
222
222
|
}
|
|
223
223
|
updateSleepEntry(e, t) {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
let
|
|
224
|
+
const r = this.sleep.get(e);
|
|
225
|
+
if (r) {
|
|
226
|
+
let n = r.duration;
|
|
227
227
|
if (t.bedtime || t.wakeTime) {
|
|
228
|
-
const
|
|
229
|
-
|
|
228
|
+
const o = t.bedtime || r.bedtime, l = t.wakeTime || r.wakeTime;
|
|
229
|
+
n = (new Date(l).getTime() - new Date(o).getTime()) / 36e5;
|
|
230
230
|
}
|
|
231
|
-
this.sleep.set(e, { ...
|
|
231
|
+
this.sleep.set(e, { ...r, ...t, id: e, duration: n });
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
deleteSleepEntry(e) {
|
|
@@ -240,19 +240,19 @@ class Z {
|
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
242
|
getSleepStats(e = 7) {
|
|
243
|
-
const t = new Date(Date.now() - e * 864e5),
|
|
243
|
+
const t = new Date(Date.now() - e * 864e5), r = this.getAllSleepEntries().filter((l) => new Date(l.date) >= t), n = {
|
|
244
244
|
poor: 1,
|
|
245
245
|
fair: 2,
|
|
246
246
|
good: 3,
|
|
247
247
|
excellent: 4
|
|
248
|
-
},
|
|
249
|
-
for (const l of
|
|
250
|
-
|
|
248
|
+
}, o = /* @__PURE__ */ new Map();
|
|
249
|
+
for (const l of r)
|
|
250
|
+
o.set(l.quality, (o.get(l.quality) || 0) + 1);
|
|
251
251
|
return {
|
|
252
|
-
avgDuration:
|
|
253
|
-
avgQuality:
|
|
254
|
-
totalEntries:
|
|
255
|
-
qualityDistribution: Array.from(
|
|
252
|
+
avgDuration: r.length > 0 ? r.reduce((l, d) => l + d.duration, 0) / r.length : 0,
|
|
253
|
+
avgQuality: r.length > 0 ? r.reduce((l, d) => l + n[d.quality], 0) / r.length : 0,
|
|
254
|
+
totalEntries: r.length,
|
|
255
|
+
qualityDistribution: Array.from(o.entries()).map(([l, d]) => ({
|
|
256
256
|
quality: l,
|
|
257
257
|
count: d
|
|
258
258
|
}))
|
|
@@ -262,12 +262,12 @@ class Z {
|
|
|
262
262
|
MEDICAL RECORDS
|
|
263
263
|
───────────────────────────────────────────────────────────── */
|
|
264
264
|
addMedicalRecord(e) {
|
|
265
|
-
const t = this.generateId(),
|
|
266
|
-
return this.medicalRecords.set(t,
|
|
265
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
266
|
+
return this.medicalRecords.set(t, r), r;
|
|
267
267
|
}
|
|
268
268
|
updateMedicalRecord(e, t) {
|
|
269
|
-
const
|
|
270
|
-
|
|
269
|
+
const r = this.medicalRecords.get(e);
|
|
270
|
+
r && this.medicalRecords.set(e, { ...r, ...t, id: e });
|
|
271
271
|
}
|
|
272
272
|
deleteMedicalRecord(e) {
|
|
273
273
|
this.medicalRecords.delete(e);
|
|
@@ -281,21 +281,21 @@ class Z {
|
|
|
281
281
|
return this.getAllMedicalRecords().filter((t) => t.type === e);
|
|
282
282
|
}
|
|
283
283
|
getUpcomingFollowUps(e = 30) {
|
|
284
|
-
const t = /* @__PURE__ */ new Date(),
|
|
284
|
+
const t = /* @__PURE__ */ new Date(), r = new Date(t.getTime() + e * 864e5);
|
|
285
285
|
return this.getAllMedicalRecords().filter(
|
|
286
|
-
(
|
|
286
|
+
(n) => n.followUp && new Date(n.followUp) >= t && new Date(n.followUp) <= r
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
/* ─────────────────────────────────────────────────────────────
|
|
290
290
|
MEDICATIONS
|
|
291
291
|
───────────────────────────────────────────────────────────── */
|
|
292
292
|
addMedication(e) {
|
|
293
|
-
const t = this.generateId(),
|
|
294
|
-
return this.medications.set(t,
|
|
293
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
294
|
+
return this.medications.set(t, r), r;
|
|
295
295
|
}
|
|
296
296
|
updateMedication(e, t) {
|
|
297
|
-
const
|
|
298
|
-
|
|
297
|
+
const r = this.medications.get(e);
|
|
298
|
+
r && this.medications.set(e, { ...r, ...t, id: e });
|
|
299
299
|
}
|
|
300
300
|
deleteMedication(e) {
|
|
301
301
|
this.medications.delete(e), this.medicationLogs = this.medicationLogs.filter((t) => t.medicationId !== e);
|
|
@@ -306,46 +306,46 @@ class Z {
|
|
|
306
306
|
getActiveMedications() {
|
|
307
307
|
return this.getAllMedications().filter((e) => e.isActive);
|
|
308
308
|
}
|
|
309
|
-
logMedication(e, t,
|
|
310
|
-
const
|
|
309
|
+
logMedication(e, t, r, n) {
|
|
310
|
+
const o = {
|
|
311
311
|
id: this.generateId(),
|
|
312
312
|
medicationId: e,
|
|
313
313
|
scheduledTime: t,
|
|
314
|
-
takenTime:
|
|
315
|
-
skipped: !
|
|
316
|
-
notes:
|
|
314
|
+
takenTime: r ? /* @__PURE__ */ new Date() : void 0,
|
|
315
|
+
skipped: !r,
|
|
316
|
+
notes: n
|
|
317
317
|
};
|
|
318
|
-
this.medicationLogs.push(
|
|
318
|
+
this.medicationLogs.push(o);
|
|
319
319
|
}
|
|
320
320
|
getMedicationLogsForDate(e) {
|
|
321
321
|
const t = new Date(e);
|
|
322
322
|
t.setHours(0, 0, 0, 0);
|
|
323
|
-
const
|
|
324
|
-
return this.medicationLogs.filter((
|
|
325
|
-
const
|
|
326
|
-
return
|
|
323
|
+
const r = new Date(t.getTime() + 864e5);
|
|
324
|
+
return this.medicationLogs.filter((n) => {
|
|
325
|
+
const o = new Date(n.scheduledTime);
|
|
326
|
+
return o >= t && o < r;
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
329
|
getTodayMedicationSchedule() {
|
|
330
|
-
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e),
|
|
331
|
-
for (const
|
|
332
|
-
for (const
|
|
330
|
+
const e = /* @__PURE__ */ new Date(), t = this.getMedicationLogsForDate(e), r = [];
|
|
331
|
+
for (const n of this.getActiveMedications())
|
|
332
|
+
for (const o of n.times) {
|
|
333
333
|
const l = t.find(
|
|
334
|
-
(d) => d.medicationId ===
|
|
334
|
+
(d) => d.medicationId === n.id && new Date(d.scheduledTime).toTimeString().startsWith(o)
|
|
335
335
|
);
|
|
336
|
-
|
|
337
|
-
medication:
|
|
338
|
-
time:
|
|
336
|
+
r.push({
|
|
337
|
+
medication: n,
|
|
338
|
+
time: o,
|
|
339
339
|
taken: (l == null ? void 0 : l.takenTime) !== void 0
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
|
-
return
|
|
342
|
+
return r.sort((n, o) => n.time.localeCompare(o.time));
|
|
343
343
|
}
|
|
344
344
|
/* ─────────────────────────────────────────────────────────────
|
|
345
345
|
VITALS
|
|
346
346
|
───────────────────────────────────────────────────────────── */
|
|
347
347
|
recordVitals(e) {
|
|
348
|
-
this.vitals.push(e), this.vitals.sort((t,
|
|
348
|
+
this.vitals.push(e), this.vitals.sort((t, r) => new Date(r.date).getTime() - new Date(t.date).getTime());
|
|
349
349
|
}
|
|
350
350
|
getVitalsHistory() {
|
|
351
351
|
return [...this.vitals];
|
|
@@ -355,21 +355,21 @@ class Z {
|
|
|
355
355
|
}
|
|
356
356
|
getWeightHistory(e = 30) {
|
|
357
357
|
const t = new Date(Date.now() - e * 864e5);
|
|
358
|
-
return this.vitals.filter((
|
|
358
|
+
return this.vitals.filter((r) => r.weight !== void 0 && new Date(r.date) >= t).map((r) => ({ date: r.date, weight: r.weight }));
|
|
359
359
|
}
|
|
360
360
|
/* ─────────────────────────────────────────────────────────────
|
|
361
361
|
GOALS
|
|
362
362
|
───────────────────────────────────────────────────────────── */
|
|
363
363
|
setGoal(e) {
|
|
364
|
-
const t = this.goals.findIndex((
|
|
364
|
+
const t = this.goals.findIndex((r) => r.id === e.id);
|
|
365
365
|
t >= 0 ? this.goals[t] = e : this.goals.push(e);
|
|
366
366
|
}
|
|
367
367
|
getGoals() {
|
|
368
368
|
return [...this.goals];
|
|
369
369
|
}
|
|
370
370
|
updateGoalProgress(e, t) {
|
|
371
|
-
const
|
|
372
|
-
|
|
371
|
+
const r = this.goals.find((n) => n.id === e);
|
|
372
|
+
r && (r.current = t);
|
|
373
373
|
}
|
|
374
374
|
/* ─────────────────────────────────────────────────────────────
|
|
375
375
|
UTILITIES
|
|
@@ -384,19 +384,21 @@ class Z {
|
|
|
384
384
|
function Ue() {
|
|
385
385
|
return new Z();
|
|
386
386
|
}
|
|
387
|
-
const
|
|
388
|
-
function
|
|
389
|
-
const
|
|
390
|
-
if (!
|
|
387
|
+
const $ = W(null);
|
|
388
|
+
function Ne() {
|
|
389
|
+
const s = F($);
|
|
390
|
+
if (!s)
|
|
391
391
|
throw new Error("useHealth must be used within HealthProvider");
|
|
392
|
-
return
|
|
392
|
+
return s;
|
|
393
393
|
}
|
|
394
394
|
const h = {
|
|
395
395
|
container: {
|
|
396
396
|
display: "flex",
|
|
397
397
|
height: "100%",
|
|
398
398
|
fontFamily: "'Inter', sans-serif",
|
|
399
|
-
backgroundColor: "#f5f7fa"
|
|
399
|
+
backgroundColor: "#f5f7fa",
|
|
400
|
+
// A fixed light design: its text must not inherit a dark host theme's light colour.
|
|
401
|
+
color: "#1a202c"
|
|
400
402
|
},
|
|
401
403
|
sidebar: {
|
|
402
404
|
width: "200px",
|
|
@@ -460,129 +462,126 @@ const h = {
|
|
|
460
462
|
borderBottom: "1px solid #f0f0f0"
|
|
461
463
|
}
|
|
462
464
|
};
|
|
463
|
-
function He({ service:
|
|
464
|
-
const [,
|
|
465
|
-
{ id: "overview",
|
|
466
|
-
{ id: "workouts",
|
|
467
|
-
{ id: "nutrition",
|
|
468
|
-
{ id: "sleep",
|
|
469
|
-
{ id: "medical",
|
|
470
|
-
{ id: "medications",
|
|
465
|
+
function He({ service: s, className: e, style: t }) {
|
|
466
|
+
const [, r] = S(0), [n, o] = S("overview"), l = L(() => r((g) => g + 1), []), d = { service: s, refresh: l }, c = [
|
|
467
|
+
{ id: "overview", label: "Overview" },
|
|
468
|
+
{ id: "workouts", label: "Workouts" },
|
|
469
|
+
{ id: "nutrition", label: "Nutrition" },
|
|
470
|
+
{ id: "sleep", label: "Sleep" },
|
|
471
|
+
{ id: "medical", label: "Medical" },
|
|
472
|
+
{ id: "medications", label: "Medications" }
|
|
471
473
|
];
|
|
472
|
-
return /* @__PURE__ */ i(
|
|
473
|
-
/* @__PURE__ */ i("div", { style: h.sidebar, children: c.map((g) => /* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ i($.Provider, { value: d, children: /* @__PURE__ */ a("div", { className: e, style: { ...h.container, ...t }, children: [
|
|
475
|
+
/* @__PURE__ */ i("div", { style: h.sidebar, children: c.map((g) => /* @__PURE__ */ i(
|
|
474
476
|
"div",
|
|
475
477
|
{
|
|
476
|
-
onClick: () =>
|
|
478
|
+
onClick: () => o(g.id),
|
|
477
479
|
style: {
|
|
478
480
|
...h.navItem,
|
|
479
|
-
backgroundColor:
|
|
480
|
-
borderLeftColor:
|
|
481
|
-
fontWeight:
|
|
481
|
+
backgroundColor: n === g.id ? "#e3f2fd" : "transparent",
|
|
482
|
+
borderLeftColor: n === g.id ? "#1976d2" : "transparent",
|
|
483
|
+
fontWeight: n === g.id ? 600 : 400
|
|
482
484
|
},
|
|
483
|
-
children:
|
|
484
|
-
/* @__PURE__ */ i("span", { children: g.icon }),
|
|
485
|
-
/* @__PURE__ */ i("span", { children: g.label })
|
|
486
|
-
]
|
|
485
|
+
children: /* @__PURE__ */ i("span", { children: g.label })
|
|
487
486
|
},
|
|
488
487
|
g.id
|
|
489
488
|
)) }),
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
489
|
+
/* @__PURE__ */ a("div", { style: h.main, children: [
|
|
490
|
+
n === "overview" && /* @__PURE__ */ i(ee, { service: s }),
|
|
491
|
+
n === "workouts" && /* @__PURE__ */ i(te, { service: s, refresh: l }),
|
|
492
|
+
n === "nutrition" && /* @__PURE__ */ i(re, { service: s }),
|
|
493
|
+
n === "sleep" && /* @__PURE__ */ i(ne, { service: s }),
|
|
494
|
+
n === "medical" && /* @__PURE__ */ i(ie, { service: s }),
|
|
495
|
+
n === "medications" && /* @__PURE__ */ i(oe, { service: s, refresh: l })
|
|
497
496
|
] })
|
|
498
497
|
] }) });
|
|
499
498
|
}
|
|
500
|
-
function ee({ service:
|
|
501
|
-
const e =
|
|
502
|
-
return /* @__PURE__ */
|
|
499
|
+
function ee({ service: s }) {
|
|
500
|
+
const e = s.getWorkoutStats(7), t = s.getSleepStats(7), r = s.getDailyNutrition(/* @__PURE__ */ new Date()), n = s.getLatestVitals(), o = s.getTodayMedicationSchedule();
|
|
501
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
503
502
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Health Overview" }),
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ a("div", { style: h.grid, children: [
|
|
504
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
506
505
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "This Week's Workouts" }),
|
|
507
506
|
/* @__PURE__ */ i("div", { style: h.statValue, children: e.totalWorkouts }),
|
|
508
507
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Workouts" }),
|
|
509
|
-
/* @__PURE__ */
|
|
510
|
-
/* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ a("div", { style: { marginTop: "12px", display: "flex", gap: "20px" }, children: [
|
|
509
|
+
/* @__PURE__ */ a("div", { children: [
|
|
511
510
|
/* @__PURE__ */ i("div", { style: { fontSize: "18px", fontWeight: 600 }, children: e.totalDuration }),
|
|
512
511
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Minutes" })
|
|
513
512
|
] }),
|
|
514
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ a("div", { children: [
|
|
515
514
|
/* @__PURE__ */ i("div", { style: { fontSize: "18px", fontWeight: 600 }, children: e.totalCalories }),
|
|
516
515
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Calories" })
|
|
517
516
|
] })
|
|
518
517
|
] })
|
|
519
518
|
] }),
|
|
520
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
521
520
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Sleep (7-Day Average)" }),
|
|
522
|
-
/* @__PURE__ */
|
|
521
|
+
/* @__PURE__ */ a("div", { style: h.statValue, children: [
|
|
523
522
|
t.avgDuration.toFixed(1),
|
|
524
523
|
"h"
|
|
525
524
|
] }),
|
|
526
525
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Per Night" }),
|
|
527
|
-
/* @__PURE__ */ i("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ i("div", { style: { marginTop: "12px" }, children: /* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: [
|
|
528
527
|
"Quality: ",
|
|
529
528
|
t.avgQuality.toFixed(1),
|
|
530
529
|
"/4"
|
|
531
530
|
] }) })
|
|
532
531
|
] }),
|
|
533
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
534
533
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Today's Nutrition" }),
|
|
535
|
-
/* @__PURE__ */ i("div", { style: h.statValue, children:
|
|
534
|
+
/* @__PURE__ */ i("div", { style: h.statValue, children: r.calories }),
|
|
536
535
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Calories" }),
|
|
537
|
-
/* @__PURE__ */
|
|
538
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ a("div", { style: { marginTop: "12px", display: "flex", gap: "16px", fontSize: "14px" }, children: [
|
|
537
|
+
/* @__PURE__ */ a("div", { children: [
|
|
539
538
|
"P: ",
|
|
540
|
-
|
|
539
|
+
r.protein,
|
|
541
540
|
"g"
|
|
542
541
|
] }),
|
|
543
|
-
/* @__PURE__ */
|
|
542
|
+
/* @__PURE__ */ a("div", { children: [
|
|
544
543
|
"C: ",
|
|
545
|
-
|
|
544
|
+
r.carbs,
|
|
546
545
|
"g"
|
|
547
546
|
] }),
|
|
548
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ a("div", { children: [
|
|
549
548
|
"F: ",
|
|
550
|
-
|
|
549
|
+
r.fat,
|
|
551
550
|
"g"
|
|
552
551
|
] })
|
|
553
552
|
] })
|
|
554
553
|
] }),
|
|
555
|
-
/* @__PURE__ */
|
|
554
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
556
555
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Latest Vitals" }),
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
|
|
556
|
+
n ? /* @__PURE__ */ a("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "12px" }, children: [
|
|
557
|
+
n.weight && /* @__PURE__ */ a("div", { children: [
|
|
558
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
559
|
+
n.weight,
|
|
561
560
|
" ",
|
|
562
|
-
|
|
561
|
+
n.weightUnit || "kg"
|
|
563
562
|
] }),
|
|
564
563
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Weight" })
|
|
565
564
|
] }),
|
|
566
|
-
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
|
|
565
|
+
n.bloodPressureSystolic && /* @__PURE__ */ a("div", { children: [
|
|
566
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "18px", fontWeight: 600 }, children: [
|
|
567
|
+
n.bloodPressureSystolic,
|
|
569
568
|
"/",
|
|
570
|
-
|
|
569
|
+
n.bloodPressureDiastolic
|
|
571
570
|
] }),
|
|
572
571
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Blood Pressure" })
|
|
573
572
|
] }),
|
|
574
|
-
|
|
575
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "18px", fontWeight: 600 }, children:
|
|
573
|
+
n.heartRate && /* @__PURE__ */ a("div", { children: [
|
|
574
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "18px", fontWeight: 600 }, children: n.heartRate }),
|
|
576
575
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Heart Rate" })
|
|
577
576
|
] })
|
|
578
577
|
] }) : /* @__PURE__ */ i("div", { style: { color: "#999" }, children: "No vitals recorded" })
|
|
579
578
|
] })
|
|
580
579
|
] }),
|
|
581
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
582
581
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Today's Medications" }),
|
|
583
|
-
|
|
582
|
+
o.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No medications scheduled" }) : o.map((l, d) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
584
583
|
/* @__PURE__ */ i("span", { style: { width: "60px", fontWeight: 500 }, children: l.time }),
|
|
585
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: [
|
|
586
585
|
l.medication.name,
|
|
587
586
|
" (",
|
|
588
587
|
l.medication.dosage,
|
|
@@ -606,38 +605,38 @@ function ee({ service: a }) {
|
|
|
606
605
|
] });
|
|
607
606
|
}
|
|
608
607
|
function te({
|
|
609
|
-
service:
|
|
608
|
+
service: s,
|
|
610
609
|
refresh: e
|
|
611
610
|
}) {
|
|
612
|
-
const t =
|
|
613
|
-
return /* @__PURE__ */
|
|
611
|
+
const t = s.getAllWorkouts(), r = s.getWorkoutStats(30);
|
|
612
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
614
613
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Workouts" }),
|
|
615
|
-
/* @__PURE__ */
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */ i("div", { style: h.statValue, children:
|
|
614
|
+
/* @__PURE__ */ a("div", { style: h.grid, children: [
|
|
615
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
616
|
+
/* @__PURE__ */ i("div", { style: h.statValue, children: r.totalWorkouts }),
|
|
618
617
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Workouts (30 days)" })
|
|
619
618
|
] }),
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */ i("div", { style: h.statValue, children:
|
|
619
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
620
|
+
/* @__PURE__ */ i("div", { style: h.statValue, children: r.totalDuration }),
|
|
622
621
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Total Minutes" })
|
|
623
622
|
] }),
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
/* @__PURE__ */ i("div", { style: h.statValue, children:
|
|
623
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
624
|
+
/* @__PURE__ */ i("div", { style: h.statValue, children: r.totalCalories }),
|
|
626
625
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Calories Burned" })
|
|
627
626
|
] })
|
|
628
627
|
] }),
|
|
629
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
630
629
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Recent Workouts" }),
|
|
631
|
-
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No workouts logged yet" }) : t.slice(0, 10).map((
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children:
|
|
634
|
-
/* @__PURE__ */
|
|
635
|
-
new Date(
|
|
630
|
+
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No workouts logged yet" }) : t.slice(0, 10).map((n) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
631
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
632
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: n.name }),
|
|
633
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
634
|
+
new Date(n.date).toLocaleDateString(),
|
|
636
635
|
" • ",
|
|
637
|
-
|
|
636
|
+
n.duration,
|
|
638
637
|
" min •",
|
|
639
638
|
" ",
|
|
640
|
-
|
|
639
|
+
n.caloriesBurned,
|
|
641
640
|
" cal"
|
|
642
641
|
] })
|
|
643
642
|
] }),
|
|
@@ -652,97 +651,97 @@ function te({
|
|
|
652
651
|
color: "#1565c0",
|
|
653
652
|
textTransform: "capitalize"
|
|
654
653
|
},
|
|
655
|
-
children:
|
|
654
|
+
children: n.type
|
|
656
655
|
}
|
|
657
656
|
)
|
|
658
|
-
] },
|
|
657
|
+
] }, n.id))
|
|
659
658
|
] })
|
|
660
659
|
] });
|
|
661
660
|
}
|
|
662
|
-
function
|
|
663
|
-
const e =
|
|
664
|
-
return /* @__PURE__ */
|
|
661
|
+
function re({ service: s }) {
|
|
662
|
+
const e = s.getDailyNutrition(/* @__PURE__ */ new Date()), t = s.getMealsForDate(/* @__PURE__ */ new Date()), r = { calories: 2e3, protein: 150, carbs: 250, fat: 65 };
|
|
663
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
665
664
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Nutrition" }),
|
|
666
665
|
/* @__PURE__ */ i("div", { style: h.grid, children: [
|
|
667
|
-
{ label: "Calories", value: e.calories, target:
|
|
668
|
-
{ label: "Protein", value: e.protein, target:
|
|
669
|
-
{ label: "Carbs", value: e.carbs, target:
|
|
670
|
-
{ label: "Fat", value: e.fat, target:
|
|
671
|
-
].map((
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children:
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
|
|
676
|
-
|
|
666
|
+
{ label: "Calories", value: e.calories, target: r.calories, unit: "" },
|
|
667
|
+
{ label: "Protein", value: e.protein, target: r.protein, unit: "g" },
|
|
668
|
+
{ label: "Carbs", value: e.carbs, target: r.carbs, unit: "g" },
|
|
669
|
+
{ label: "Fat", value: e.fat, target: r.fat, unit: "g" }
|
|
670
|
+
].map((n) => /* @__PURE__ */ a("div", { style: h.card, children: [
|
|
671
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
672
|
+
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: n.label }),
|
|
673
|
+
/* @__PURE__ */ a("span", { children: [
|
|
674
|
+
n.value,
|
|
675
|
+
n.unit,
|
|
677
676
|
" / ",
|
|
678
|
-
|
|
679
|
-
|
|
677
|
+
n.target,
|
|
678
|
+
n.unit
|
|
680
679
|
] })
|
|
681
680
|
] }),
|
|
682
681
|
/* @__PURE__ */ i("div", { style: h.progressBar, children: /* @__PURE__ */ i(
|
|
683
682
|
"div",
|
|
684
683
|
{
|
|
685
684
|
style: {
|
|
686
|
-
width: `${Math.min(100,
|
|
685
|
+
width: `${Math.min(100, n.value / n.target * 100)}%`,
|
|
687
686
|
height: "100%",
|
|
688
|
-
backgroundColor:
|
|
687
|
+
backgroundColor: n.value > n.target ? "#f44336" : "#4caf50",
|
|
689
688
|
borderRadius: "4px"
|
|
690
689
|
}
|
|
691
690
|
}
|
|
692
691
|
) })
|
|
693
|
-
] },
|
|
694
|
-
/* @__PURE__ */
|
|
692
|
+
] }, n.label)) }),
|
|
693
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
695
694
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Today's Meals" }),
|
|
696
|
-
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No meals logged today" }) : t.map((
|
|
697
|
-
/* @__PURE__ */ i("span", { style: { textTransform: "capitalize", fontWeight: 500, width: "80px" }, children:
|
|
698
|
-
/* @__PURE__ */
|
|
699
|
-
/* @__PURE__ */ i("div", { children:
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
|
|
695
|
+
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No meals logged today" }) : t.map((n) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
696
|
+
/* @__PURE__ */ i("span", { style: { textTransform: "capitalize", fontWeight: 500, width: "80px" }, children: n.type }),
|
|
697
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
698
|
+
/* @__PURE__ */ i("div", { children: n.foods.map((o) => o.item.name).join(", ") }),
|
|
699
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
700
|
+
n.totalCalories,
|
|
702
701
|
" cal • P:",
|
|
703
|
-
|
|
702
|
+
n.totalProtein,
|
|
704
703
|
"g C:",
|
|
705
|
-
|
|
704
|
+
n.totalCarbs,
|
|
706
705
|
"g F:",
|
|
707
|
-
|
|
706
|
+
n.totalFat,
|
|
708
707
|
"g"
|
|
709
708
|
] })
|
|
710
709
|
] })
|
|
711
|
-
] },
|
|
710
|
+
] }, n.id))
|
|
712
711
|
] })
|
|
713
712
|
] });
|
|
714
713
|
}
|
|
715
|
-
function
|
|
716
|
-
const e =
|
|
714
|
+
function ne({ service: s }) {
|
|
715
|
+
const e = s.getSleepStats(7), t = s.getAllSleepEntries(), r = {
|
|
717
716
|
poor: "#f44336",
|
|
718
717
|
fair: "#ff9800",
|
|
719
718
|
good: "#4caf50",
|
|
720
719
|
excellent: "#2196f3"
|
|
721
720
|
};
|
|
722
|
-
return /* @__PURE__ */
|
|
721
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
723
722
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Sleep Tracking" }),
|
|
724
|
-
/* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ a("div", { style: h.grid, children: [
|
|
724
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
725
|
+
/* @__PURE__ */ a("div", { style: h.statValue, children: [
|
|
727
726
|
e.avgDuration.toFixed(1),
|
|
728
727
|
"h"
|
|
729
728
|
] }),
|
|
730
729
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Avg Sleep (7 days)" })
|
|
731
730
|
] }),
|
|
732
|
-
/* @__PURE__ */
|
|
733
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
732
|
+
/* @__PURE__ */ a("div", { style: h.statValue, children: [
|
|
734
733
|
e.avgQuality.toFixed(1),
|
|
735
734
|
"/4"
|
|
736
735
|
] }),
|
|
737
736
|
/* @__PURE__ */ i("div", { style: h.statLabel, children: "Avg Quality" })
|
|
738
737
|
] })
|
|
739
738
|
] }),
|
|
740
|
-
/* @__PURE__ */
|
|
739
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
741
740
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Sleep History" }),
|
|
742
|
-
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No sleep data logged" }) : t.slice(0, 10).map((
|
|
743
|
-
/* @__PURE__ */ i("span", { style: { width: "100px" }, children: new Date(
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
|
|
741
|
+
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No sleep data logged" }) : t.slice(0, 10).map((n) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
742
|
+
/* @__PURE__ */ i("span", { style: { width: "100px" }, children: new Date(n.date).toLocaleDateString() }),
|
|
743
|
+
/* @__PURE__ */ a("span", { style: { flex: 1 }, children: [
|
|
744
|
+
n.duration.toFixed(1),
|
|
746
745
|
" hours"
|
|
747
746
|
] }),
|
|
748
747
|
/* @__PURE__ */ i(
|
|
@@ -752,79 +751,85 @@ function re({ service: a }) {
|
|
|
752
751
|
padding: "4px 12px",
|
|
753
752
|
borderRadius: "12px",
|
|
754
753
|
fontSize: "12px",
|
|
755
|
-
backgroundColor: n
|
|
756
|
-
color: n
|
|
754
|
+
backgroundColor: r[n.quality] + "20",
|
|
755
|
+
color: r[n.quality],
|
|
757
756
|
textTransform: "capitalize"
|
|
758
757
|
},
|
|
759
|
-
children:
|
|
758
|
+
children: n.quality
|
|
760
759
|
}
|
|
761
760
|
)
|
|
762
|
-
] },
|
|
761
|
+
] }, n.id))
|
|
763
762
|
] })
|
|
764
763
|
] });
|
|
765
764
|
}
|
|
766
|
-
function ie({ service:
|
|
767
|
-
const e =
|
|
768
|
-
appointment: "
|
|
769
|
-
"lab-result": "
|
|
770
|
-
vaccination: "
|
|
771
|
-
prescription: "
|
|
772
|
-
procedure: "
|
|
773
|
-
diagnosis: "
|
|
774
|
-
note: "
|
|
765
|
+
function ie({ service: s }) {
|
|
766
|
+
const e = s.getAllMedicalRecords(), t = s.getUpcomingFollowUps(), r = {
|
|
767
|
+
appointment: "Appt",
|
|
768
|
+
"lab-result": "Lab",
|
|
769
|
+
vaccination: "Vacc",
|
|
770
|
+
prescription: "Rx",
|
|
771
|
+
procedure: "Proc",
|
|
772
|
+
diagnosis: "Dx",
|
|
773
|
+
note: "Note"
|
|
774
|
+
}, n = {
|
|
775
|
+
minWidth: "40px",
|
|
776
|
+
fontSize: "11px",
|
|
777
|
+
fontWeight: 600,
|
|
778
|
+
textTransform: "uppercase",
|
|
779
|
+
color: "#666"
|
|
775
780
|
};
|
|
776
|
-
return /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
777
782
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Medical Records" }),
|
|
778
|
-
t.length > 0 && /* @__PURE__ */
|
|
783
|
+
t.length > 0 && /* @__PURE__ */ a("div", { style: { ...h.card, marginBottom: "20px", backgroundColor: "#fff3e0" }, children: [
|
|
779
784
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Upcoming Follow-ups" }),
|
|
780
|
-
t.map((
|
|
781
|
-
/* @__PURE__ */ i("span", { children:
|
|
782
|
-
/* @__PURE__ */ i("span", { style: { flex: 1 }, children:
|
|
783
|
-
/* @__PURE__ */ i("span", { style: { color: "#ef6c00" }, children: new Date(
|
|
784
|
-
] },
|
|
785
|
+
t.map((o) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
786
|
+
/* @__PURE__ */ i("span", { style: n, children: r[o.type] }),
|
|
787
|
+
/* @__PURE__ */ i("span", { style: { flex: 1 }, children: o.title }),
|
|
788
|
+
/* @__PURE__ */ i("span", { style: { color: "#ef6c00" }, children: new Date(o.followUp).toLocaleDateString() })
|
|
789
|
+
] }, o.id))
|
|
785
790
|
] }),
|
|
786
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
787
792
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "All Records" }),
|
|
788
|
-
e.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No medical records" }) : e.slice(0, 15).map((
|
|
789
|
-
/* @__PURE__ */ i("span", { style:
|
|
790
|
-
/* @__PURE__ */
|
|
791
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children:
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
new Date(
|
|
794
|
-
|
|
793
|
+
e.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No medical records" }) : e.slice(0, 15).map((o) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
794
|
+
/* @__PURE__ */ i("span", { style: n, children: r[o.type] }),
|
|
795
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
796
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: o.title }),
|
|
797
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
798
|
+
new Date(o.date).toLocaleDateString(),
|
|
799
|
+
o.provider && ` • ${o.provider}`
|
|
795
800
|
] })
|
|
796
801
|
] })
|
|
797
|
-
] },
|
|
802
|
+
] }, o.id))
|
|
798
803
|
] })
|
|
799
804
|
] });
|
|
800
805
|
}
|
|
801
|
-
function
|
|
802
|
-
service:
|
|
806
|
+
function oe({
|
|
807
|
+
service: s,
|
|
803
808
|
refresh: e
|
|
804
809
|
}) {
|
|
805
|
-
|
|
806
|
-
const t =
|
|
810
|
+
s.getAllMedications();
|
|
811
|
+
const t = s.getActiveMedications(), r = s.getTodayMedicationSchedule(), n = (o) => {
|
|
807
812
|
const l = /* @__PURE__ */ new Date();
|
|
808
813
|
l.setHours(
|
|
809
|
-
parseInt(
|
|
810
|
-
parseInt(
|
|
814
|
+
parseInt(o.times[0].split(":")[0]),
|
|
815
|
+
parseInt(o.times[0].split(":")[1]),
|
|
811
816
|
0
|
|
812
|
-
),
|
|
817
|
+
), s.logMedication(o.id, l, !0), e();
|
|
813
818
|
};
|
|
814
|
-
return /* @__PURE__ */
|
|
819
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
815
820
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Medications" }),
|
|
816
|
-
/* @__PURE__ */
|
|
821
|
+
/* @__PURE__ */ a("div", { style: { ...h.card, marginBottom: "20px" }, children: [
|
|
817
822
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Today's Schedule" }),
|
|
818
|
-
|
|
819
|
-
/* @__PURE__ */ i("span", { style: { width: "60px", fontWeight: 500 }, children:
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children:
|
|
822
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children:
|
|
823
|
+
r.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No medications scheduled" }) : r.map((o, l) => /* @__PURE__ */ a("div", { style: h.listItem, children: [
|
|
824
|
+
/* @__PURE__ */ i("span", { style: { width: "60px", fontWeight: 500 }, children: o.time }),
|
|
825
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
826
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: o.medication.name }),
|
|
827
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: o.medication.dosage })
|
|
823
828
|
] }),
|
|
824
|
-
!
|
|
829
|
+
!o.taken && /* @__PURE__ */ i(
|
|
825
830
|
"button",
|
|
826
831
|
{
|
|
827
|
-
onClick: () =>
|
|
832
|
+
onClick: () => n(o.medication),
|
|
828
833
|
style: {
|
|
829
834
|
padding: "6px 16px",
|
|
830
835
|
border: "none",
|
|
@@ -837,49 +842,46 @@ function se({
|
|
|
837
842
|
children: "Mark Taken"
|
|
838
843
|
}
|
|
839
844
|
),
|
|
840
|
-
|
|
845
|
+
o.taken && /* @__PURE__ */ i("span", { style: { color: "#4caf50", fontSize: "12px" }, children: "Taken" })
|
|
841
846
|
] }, l))
|
|
842
847
|
] }),
|
|
843
|
-
/* @__PURE__ */
|
|
848
|
+
/* @__PURE__ */ a("div", { style: h.card, children: [
|
|
844
849
|
/* @__PURE__ */ i("div", { style: h.cardTitle, children: "Active Medications" }),
|
|
845
|
-
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No active medications" }) : t.map((
|
|
846
|
-
/* @__PURE__ */ i("
|
|
847
|
-
/* @__PURE__ */
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
" • ",
|
|
854
|
-
s.times.join(", ")
|
|
855
|
-
] })
|
|
850
|
+
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "30px" }, children: "No active medications" }) : t.map((o) => /* @__PURE__ */ i("div", { style: h.listItem, children: /* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
851
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: o.name }),
|
|
852
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
853
|
+
o.dosage,
|
|
854
|
+
" • ",
|
|
855
|
+
o.frequency,
|
|
856
|
+
" • ",
|
|
857
|
+
o.times.join(", ")
|
|
856
858
|
] })
|
|
857
|
-
] },
|
|
859
|
+
] }) }, o.id))
|
|
858
860
|
] })
|
|
859
861
|
] });
|
|
860
862
|
}
|
|
861
|
-
const
|
|
862
|
-
{ id: "income", name: "Income", icon: "
|
|
863
|
-
{ id: "salary", name: "Salary", icon: "
|
|
864
|
-
{ id: "interest", name: "Interest", icon: "
|
|
865
|
-
{ id: "housing", name: "Housing", icon: "
|
|
866
|
-
{ id: "rent", name: "Rent", icon: "
|
|
867
|
-
{ id: "utilities", name: "Utilities", icon: "
|
|
868
|
-
{ id: "food", name: "Food & Dining", icon: "
|
|
869
|
-
{ id: "groceries", name: "Groceries", icon: "
|
|
870
|
-
{ id: "restaurants", name: "Restaurants", icon: "
|
|
871
|
-
{ id: "transport", name: "Transportation", icon: "
|
|
872
|
-
{ id: "gas", name: "Gas", icon: "
|
|
873
|
-
{ id: "parking", name: "Parking", icon: "
|
|
874
|
-
{ id: "shopping", name: "Shopping", icon: "
|
|
875
|
-
{ id: "entertainment", name: "Entertainment", icon: "
|
|
876
|
-
{ id: "health", name: "Health", icon: "
|
|
877
|
-
{ id: "personal", name: "Personal", icon: "
|
|
878
|
-
{ id: "education", name: "Education", icon: "
|
|
879
|
-
{ id: "travel", name: "Travel", icon: "
|
|
880
|
-
{ id: "subscriptions", name: "Subscriptions", icon: "
|
|
881
|
-
{ id: "transfer", name: "Transfer", icon: "
|
|
882
|
-
{ id: "other", name: "Other", icon: "
|
|
863
|
+
const se = [
|
|
864
|
+
{ id: "income", name: "Income", icon: "dollar", color: "#4caf50" },
|
|
865
|
+
{ id: "salary", name: "Salary", icon: "briefcase", color: "#4caf50", parent: "income" },
|
|
866
|
+
{ id: "interest", name: "Interest", icon: "building", color: "#4caf50", parent: "income" },
|
|
867
|
+
{ id: "housing", name: "Housing", icon: "home", color: "#2196f3" },
|
|
868
|
+
{ id: "rent", name: "Rent", icon: "home", color: "#2196f3", parent: "housing" },
|
|
869
|
+
{ id: "utilities", name: "Utilities", icon: "lightbulb", color: "#2196f3", parent: "housing" },
|
|
870
|
+
{ id: "food", name: "Food & Dining", icon: "utensils", color: "#ff9800" },
|
|
871
|
+
{ id: "groceries", name: "Groceries", icon: "box", color: "#ff9800", parent: "food" },
|
|
872
|
+
{ id: "restaurants", name: "Restaurants", icon: "utensils", color: "#ff9800", parent: "food" },
|
|
873
|
+
{ id: "transport", name: "Transportation", icon: "map-pin", color: "#9c27b0" },
|
|
874
|
+
{ id: "gas", name: "Gas", icon: "droplet", color: "#9c27b0", parent: "transport" },
|
|
875
|
+
{ id: "parking", name: "Parking", icon: "square", color: "#9c27b0", parent: "transport" },
|
|
876
|
+
{ id: "shopping", name: "Shopping", icon: "tag", color: "#e91e63" },
|
|
877
|
+
{ id: "entertainment", name: "Entertainment", icon: "video", color: "#673ab7" },
|
|
878
|
+
{ id: "health", name: "Health", icon: "heart", color: "#f44336" },
|
|
879
|
+
{ id: "personal", name: "Personal", icon: "user", color: "#607d8b" },
|
|
880
|
+
{ id: "education", name: "Education", icon: "book", color: "#00bcd4" },
|
|
881
|
+
{ id: "travel", name: "Travel", icon: "globe", color: "#009688" },
|
|
882
|
+
{ id: "subscriptions", name: "Subscriptions", icon: "refresh", color: "#795548" },
|
|
883
|
+
{ id: "transfer", name: "Transfer", icon: "shuffle", color: "#9e9e9e" },
|
|
884
|
+
{ id: "other", name: "Other", icon: "box", color: "#9e9e9e" }
|
|
883
885
|
];
|
|
884
886
|
class ae {
|
|
885
887
|
constructor() {
|
|
@@ -888,24 +890,24 @@ class ae {
|
|
|
888
890
|
w(this, "budgets", /* @__PURE__ */ new Map());
|
|
889
891
|
w(this, "bills", /* @__PURE__ */ new Map());
|
|
890
892
|
w(this, "investments", /* @__PURE__ */ new Map());
|
|
891
|
-
w(this, "categories", [...
|
|
893
|
+
w(this, "categories", [...se]);
|
|
892
894
|
w(this, "netWorthHistory", []);
|
|
893
895
|
}
|
|
894
896
|
/* ─────────────────────────────────────────────────────────────
|
|
895
897
|
ACCOUNTS
|
|
896
898
|
───────────────────────────────────────────────────────────── */
|
|
897
899
|
addAccount(e) {
|
|
898
|
-
const t = this.generateId(),
|
|
899
|
-
return this.accounts.set(t,
|
|
900
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
901
|
+
return this.accounts.set(t, r), r;
|
|
900
902
|
}
|
|
901
903
|
updateAccount(e, t) {
|
|
902
|
-
const
|
|
903
|
-
|
|
904
|
+
const r = this.accounts.get(e);
|
|
905
|
+
r && this.accounts.set(e, { ...r, ...t, id: e });
|
|
904
906
|
}
|
|
905
907
|
deleteAccount(e) {
|
|
906
908
|
this.accounts.delete(e);
|
|
907
|
-
for (const [t,
|
|
908
|
-
|
|
909
|
+
for (const [t, r] of this.transactions)
|
|
910
|
+
r.accountId === e && this.transactions.delete(t);
|
|
909
911
|
}
|
|
910
912
|
getAllAccounts() {
|
|
911
913
|
return Array.from(this.accounts.values());
|
|
@@ -938,30 +940,30 @@ class ae {
|
|
|
938
940
|
TRANSACTIONS
|
|
939
941
|
───────────────────────────────────────────────────────────── */
|
|
940
942
|
addTransaction(e) {
|
|
941
|
-
const t = this.generateId(),
|
|
942
|
-
this.transactions.set(t,
|
|
943
|
-
const
|
|
944
|
-
if (
|
|
945
|
-
const
|
|
946
|
-
|
|
943
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
944
|
+
this.transactions.set(t, r);
|
|
945
|
+
const n = this.accounts.get(e.accountId);
|
|
946
|
+
if (n) {
|
|
947
|
+
const o = e.type === "income" ? e.amount : -e.amount;
|
|
948
|
+
n.balance += o, this.accounts.set(n.id, n);
|
|
947
949
|
}
|
|
948
950
|
if (e.categoryId && e.type === "expense") {
|
|
949
|
-
const
|
|
950
|
-
|
|
951
|
+
const o = this.getBudgetByCategory(e.categoryId);
|
|
952
|
+
o && (o.spent += e.amount, this.budgets.set(o.id, o));
|
|
951
953
|
}
|
|
952
|
-
return
|
|
954
|
+
return r;
|
|
953
955
|
}
|
|
954
956
|
updateTransaction(e, t) {
|
|
955
|
-
const
|
|
956
|
-
|
|
957
|
+
const r = this.transactions.get(e);
|
|
958
|
+
r && this.transactions.set(e, { ...r, ...t, id: e });
|
|
957
959
|
}
|
|
958
960
|
deleteTransaction(e) {
|
|
959
961
|
const t = this.transactions.get(e);
|
|
960
962
|
if (t) {
|
|
961
|
-
const
|
|
962
|
-
if (
|
|
963
|
-
const
|
|
964
|
-
|
|
963
|
+
const r = this.accounts.get(t.accountId);
|
|
964
|
+
if (r) {
|
|
965
|
+
const n = t.type === "income" ? -t.amount : t.amount;
|
|
966
|
+
r.balance += n, this.accounts.set(r.id, r);
|
|
965
967
|
}
|
|
966
968
|
this.transactions.delete(e);
|
|
967
969
|
}
|
|
@@ -975,9 +977,9 @@ class ae {
|
|
|
975
977
|
return this.getAllTransactions().filter((t) => t.accountId === e);
|
|
976
978
|
}
|
|
977
979
|
getTransactionsForPeriod(e, t) {
|
|
978
|
-
return this.getAllTransactions().filter((
|
|
979
|
-
const
|
|
980
|
-
return
|
|
980
|
+
return this.getAllTransactions().filter((r) => {
|
|
981
|
+
const n = new Date(r.date);
|
|
982
|
+
return n >= e && n <= t;
|
|
981
983
|
});
|
|
982
984
|
}
|
|
983
985
|
getTransactionsByCategory(e) {
|
|
@@ -997,9 +999,9 @@ class ae {
|
|
|
997
999
|
{ pattern: /doctor|pharmacy|hospital|medical/i, categoryId: "health" },
|
|
998
1000
|
{ pattern: /payroll|salary|paycheck|deposit/i, categoryId: "salary" }
|
|
999
1001
|
];
|
|
1000
|
-
for (const
|
|
1001
|
-
if (
|
|
1002
|
-
return
|
|
1002
|
+
for (const r of t)
|
|
1003
|
+
if (r.pattern.test(e))
|
|
1004
|
+
return r.categoryId;
|
|
1003
1005
|
}
|
|
1004
1006
|
/* ─────────────────────────────────────────────────────────────
|
|
1005
1007
|
CATEGORIES
|
|
@@ -1020,12 +1022,12 @@ class ae {
|
|
|
1020
1022
|
BUDGETS
|
|
1021
1023
|
───────────────────────────────────────────────────────────── */
|
|
1022
1024
|
addBudget(e) {
|
|
1023
|
-
const t = this.generateId(),
|
|
1024
|
-
return this.budgets.set(t,
|
|
1025
|
+
const t = this.generateId(), r = { ...e, id: t, spent: 0 };
|
|
1026
|
+
return this.budgets.set(t, r), r;
|
|
1025
1027
|
}
|
|
1026
1028
|
updateBudget(e, t) {
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
+
const r = this.budgets.get(e);
|
|
1030
|
+
r && this.budgets.set(e, { ...r, ...t, id: e });
|
|
1029
1031
|
}
|
|
1030
1032
|
deleteBudget(e) {
|
|
1031
1033
|
this.budgets.delete(e);
|
|
@@ -1041,19 +1043,19 @@ class ae {
|
|
|
1041
1043
|
t.rollover || (t.spent = 0), this.budgets.set(e, t);
|
|
1042
1044
|
}
|
|
1043
1045
|
calculateBudgetStatus() {
|
|
1044
|
-
const e = this.getAllBudgets(), t = e.reduce((
|
|
1045
|
-
return { total: t, used:
|
|
1046
|
+
const e = this.getAllBudgets(), t = e.reduce((o, l) => o + l.amount, 0), r = e.reduce((o, l) => o + l.spent, 0), n = e.filter((o) => o.spent > o.amount);
|
|
1047
|
+
return { total: t, used: r, remaining: t - r, overBudget: n };
|
|
1046
1048
|
}
|
|
1047
1049
|
/* ─────────────────────────────────────────────────────────────
|
|
1048
1050
|
BILLS
|
|
1049
1051
|
───────────────────────────────────────────────────────────── */
|
|
1050
1052
|
addBill(e) {
|
|
1051
|
-
const t = this.generateId(),
|
|
1052
|
-
return this.bills.set(t,
|
|
1053
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
1054
|
+
return this.bills.set(t, r), r;
|
|
1053
1055
|
}
|
|
1054
1056
|
updateBill(e, t) {
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
+
const r = this.bills.get(e);
|
|
1058
|
+
r && this.bills.set(e, { ...r, ...t, id: e });
|
|
1057
1059
|
}
|
|
1058
1060
|
deleteBill(e) {
|
|
1059
1061
|
this.bills.delete(e);
|
|
@@ -1066,11 +1068,11 @@ class ae {
|
|
|
1066
1068
|
return Array.from(this.bills.values());
|
|
1067
1069
|
}
|
|
1068
1070
|
getUpcomingBills(e = 30) {
|
|
1069
|
-
const
|
|
1070
|
-
return this.getAllBills().filter((
|
|
1071
|
-
let
|
|
1072
|
-
return
|
|
1073
|
-
}).sort((
|
|
1071
|
+
const r = (/* @__PURE__ */ new Date()).getDate();
|
|
1072
|
+
return this.getAllBills().filter((n) => {
|
|
1073
|
+
let o = n.dueDate - r;
|
|
1074
|
+
return o < 0 && (o += 30), o <= e;
|
|
1075
|
+
}).sort((n, o) => n.dueDate - o.dueDate);
|
|
1074
1076
|
}
|
|
1075
1077
|
calculateMonthlyBillTotal() {
|
|
1076
1078
|
return this.getAllBills().filter((e) => e.frequency === "monthly").reduce((e, t) => e + t.amount, 0);
|
|
@@ -1079,12 +1081,12 @@ class ae {
|
|
|
1079
1081
|
INVESTMENTS
|
|
1080
1082
|
───────────────────────────────────────────────────────────── */
|
|
1081
1083
|
addInvestment(e) {
|
|
1082
|
-
const t = this.generateId(),
|
|
1084
|
+
const t = this.generateId(), r = e.shares * e.currentPrice, n = r - e.costBasis, o = e.costBasis > 0 ? n / e.costBasis * 100 : 0, l = { ...e, id: t, currentValue: r, gain: n, gainPercent: o };
|
|
1083
1085
|
return this.investments.set(t, l), l;
|
|
1084
1086
|
}
|
|
1085
1087
|
updateInvestmentPrice(e, t) {
|
|
1086
|
-
const
|
|
1087
|
-
|
|
1088
|
+
const r = this.investments.get(e);
|
|
1089
|
+
r && (r.currentPrice = t, r.currentValue = r.shares * t, r.gain = r.currentValue - r.costBasis, r.gainPercent = r.costBasis > 0 ? r.gain / r.costBasis * 100 : 0, this.investments.set(e, r));
|
|
1088
1090
|
}
|
|
1089
1091
|
deleteInvestment(e) {
|
|
1090
1092
|
this.investments.delete(e);
|
|
@@ -1102,34 +1104,34 @@ class ae {
|
|
|
1102
1104
|
return this.getAllInvestments().reduce((e, t) => e + t.gain, 0);
|
|
1103
1105
|
}
|
|
1104
1106
|
getPortfolioAllocation() {
|
|
1105
|
-
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(),
|
|
1106
|
-
for (const
|
|
1107
|
-
|
|
1108
|
-
return Array.from(
|
|
1109
|
-
type:
|
|
1110
|
-
value:
|
|
1111
|
-
percentage: t > 0 ?
|
|
1107
|
+
const e = this.getAllInvestments(), t = this.calculateTotalInvestmentValue(), r = /* @__PURE__ */ new Map();
|
|
1108
|
+
for (const n of e)
|
|
1109
|
+
r.set(n.type, (r.get(n.type) || 0) + n.currentValue);
|
|
1110
|
+
return Array.from(r.entries()).map(([n, o]) => ({
|
|
1111
|
+
type: n,
|
|
1112
|
+
value: o,
|
|
1113
|
+
percentage: t > 0 ? o / t * 100 : 0
|
|
1112
1114
|
}));
|
|
1113
1115
|
}
|
|
1114
1116
|
/* ─────────────────────────────────────────────────────────────
|
|
1115
1117
|
ANALYTICS
|
|
1116
1118
|
───────────────────────────────────────────────────────────── */
|
|
1117
1119
|
getSpendingSummary(e, t) {
|
|
1118
|
-
const
|
|
1120
|
+
const r = this.getTransactionsForPeriod(e, t).filter(
|
|
1119
1121
|
(l) => l.type === "expense"
|
|
1120
|
-
),
|
|
1121
|
-
let
|
|
1122
|
-
for (const l of
|
|
1123
|
-
const d = l.categoryId || "other", c =
|
|
1124
|
-
c.amount += l.amount, c.count++,
|
|
1122
|
+
), n = /* @__PURE__ */ new Map();
|
|
1123
|
+
let o = 0;
|
|
1124
|
+
for (const l of r) {
|
|
1125
|
+
const d = l.categoryId || "other", c = n.get(d) || { amount: 0, count: 0 };
|
|
1126
|
+
c.amount += l.amount, c.count++, n.set(d, c), o += l.amount;
|
|
1125
1127
|
}
|
|
1126
|
-
return Array.from(
|
|
1128
|
+
return Array.from(n.entries()).map(([l, d]) => {
|
|
1127
1129
|
const c = this.categories.find((g) => g.id === l);
|
|
1128
1130
|
return {
|
|
1129
1131
|
categoryId: l,
|
|
1130
1132
|
categoryName: (c == null ? void 0 : c.name) || "Other",
|
|
1131
1133
|
amount: d.amount,
|
|
1132
|
-
percentage:
|
|
1134
|
+
percentage: o > 0 ? d.amount / o * 100 : 0,
|
|
1133
1135
|
transactions: d.count,
|
|
1134
1136
|
trend: "stable"
|
|
1135
1137
|
// Would compare with previous period
|
|
@@ -1138,11 +1140,11 @@ class ae {
|
|
|
1138
1140
|
}
|
|
1139
1141
|
getMonthlyIncome() {
|
|
1140
1142
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1141
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1143
|
+
return this.getTransactionsForPeriod(t, e).filter((n) => n.type === "income").reduce((n, o) => n + o.amount, 0);
|
|
1142
1144
|
}
|
|
1143
1145
|
getMonthlyExpenses() {
|
|
1144
1146
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
1145
|
-
return this.getTransactionsForPeriod(t, e).filter((
|
|
1147
|
+
return this.getTransactionsForPeriod(t, e).filter((n) => n.type === "expense").reduce((n, o) => n + o.amount, 0);
|
|
1146
1148
|
}
|
|
1147
1149
|
getSavingsRate() {
|
|
1148
1150
|
const e = this.getMonthlyIncome(), t = this.getMonthlyExpenses();
|
|
@@ -1176,22 +1178,24 @@ class ae {
|
|
|
1176
1178
|
);
|
|
1177
1179
|
}
|
|
1178
1180
|
}
|
|
1179
|
-
function
|
|
1181
|
+
function $e() {
|
|
1180
1182
|
return new ae();
|
|
1181
1183
|
}
|
|
1182
|
-
const
|
|
1183
|
-
function
|
|
1184
|
-
const
|
|
1185
|
-
if (!
|
|
1184
|
+
const j = W(null);
|
|
1185
|
+
function je() {
|
|
1186
|
+
const s = F(j);
|
|
1187
|
+
if (!s)
|
|
1186
1188
|
throw new Error("usePersonalFinance must be used within PersonalFinanceProvider");
|
|
1187
|
-
return
|
|
1189
|
+
return s;
|
|
1188
1190
|
}
|
|
1189
1191
|
const m = {
|
|
1190
1192
|
container: {
|
|
1191
1193
|
display: "flex",
|
|
1192
1194
|
height: "100%",
|
|
1193
1195
|
fontFamily: "'Inter', sans-serif",
|
|
1194
|
-
backgroundColor: "#f5f7fa"
|
|
1196
|
+
backgroundColor: "#f5f7fa",
|
|
1197
|
+
// A fixed light design: its text must not inherit a dark host theme's light colour.
|
|
1198
|
+
color: "#1a202c"
|
|
1195
1199
|
},
|
|
1196
1200
|
sidebar: {
|
|
1197
1201
|
width: "250px",
|
|
@@ -1267,14 +1271,14 @@ const m = {
|
|
|
1267
1271
|
}
|
|
1268
1272
|
};
|
|
1269
1273
|
function Ee({
|
|
1270
|
-
service:
|
|
1274
|
+
service: s,
|
|
1271
1275
|
className: e,
|
|
1272
1276
|
style: t
|
|
1273
1277
|
}) {
|
|
1274
|
-
const [,
|
|
1275
|
-
return /* @__PURE__ */ i(
|
|
1276
|
-
/* @__PURE__ */
|
|
1277
|
-
/* @__PURE__ */
|
|
1278
|
+
const [, r] = S(0), [n, o] = S("overview"), l = L(() => r((p) => p + 1), []), d = { service: s, refresh: l }, c = (p) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(p), g = s.getAllAccounts(), u = s.calculateNetWorth();
|
|
1279
|
+
return /* @__PURE__ */ i(j.Provider, { value: d, children: /* @__PURE__ */ a("div", { className: e, style: { ...m.container, ...t }, children: [
|
|
1280
|
+
/* @__PURE__ */ a("div", { style: m.sidebar, children: [
|
|
1281
|
+
/* @__PURE__ */ a("div", { style: m.netWorth, children: [
|
|
1278
1282
|
/* @__PURE__ */ i("div", { style: m.netWorthLabel, children: "Net Worth" }),
|
|
1279
1283
|
/* @__PURE__ */ i("div", { style: { ...m.netWorthValue, color: u >= 0 ? "#4caf50" : "#f44336" }, children: c(u) })
|
|
1280
1284
|
] }),
|
|
@@ -1288,20 +1292,20 @@ function Ee({
|
|
|
1288
1292
|
].map((p) => /* @__PURE__ */ i(
|
|
1289
1293
|
"div",
|
|
1290
1294
|
{
|
|
1291
|
-
onClick: () =>
|
|
1295
|
+
onClick: () => o(p),
|
|
1292
1296
|
style: {
|
|
1293
1297
|
padding: "12px 16px",
|
|
1294
1298
|
borderRadius: "8px",
|
|
1295
1299
|
cursor: "pointer",
|
|
1296
1300
|
marginBottom: "4px",
|
|
1297
|
-
backgroundColor:
|
|
1301
|
+
backgroundColor: n === p ? "rgba(255,255,255,0.1)" : "transparent",
|
|
1298
1302
|
textTransform: "capitalize"
|
|
1299
1303
|
},
|
|
1300
1304
|
children: p
|
|
1301
1305
|
},
|
|
1302
1306
|
p
|
|
1303
1307
|
)) }),
|
|
1304
|
-
/* @__PURE__ */
|
|
1308
|
+
/* @__PURE__ */ a("div", { style: m.accountList, children: [
|
|
1305
1309
|
/* @__PURE__ */ i(
|
|
1306
1310
|
"div",
|
|
1307
1311
|
{
|
|
@@ -1314,38 +1318,38 @@ function Ee({
|
|
|
1314
1318
|
children: "Accounts"
|
|
1315
1319
|
}
|
|
1316
1320
|
),
|
|
1317
|
-
g.slice(0, 5).map((p) => /* @__PURE__ */
|
|
1321
|
+
g.slice(0, 5).map((p) => /* @__PURE__ */ a("div", { style: m.accountItem, children: [
|
|
1318
1322
|
/* @__PURE__ */ i("span", { children: p.name }),
|
|
1319
1323
|
/* @__PURE__ */ i("span", { style: { color: p.balance >= 0 ? "#4caf50" : "#f44336" }, children: c(p.balance) })
|
|
1320
1324
|
] }, p.id))
|
|
1321
1325
|
] })
|
|
1322
1326
|
] }),
|
|
1323
|
-
/* @__PURE__ */
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1327
|
+
/* @__PURE__ */ a("div", { style: m.main, children: [
|
|
1328
|
+
n === "overview" && /* @__PURE__ */ i(le, { service: s }),
|
|
1329
|
+
n === "accounts" && /* @__PURE__ */ i(de, { service: s, refresh: l }),
|
|
1330
|
+
n === "transactions" && /* @__PURE__ */ i(ce, { service: s }),
|
|
1331
|
+
n === "budgets" && /* @__PURE__ */ i(ue, { service: s }),
|
|
1332
|
+
n === "bills" && /* @__PURE__ */ i(ge, { service: s }),
|
|
1333
|
+
n === "investments" && /* @__PURE__ */ i(he, { service: s })
|
|
1330
1334
|
] })
|
|
1331
1335
|
] }) });
|
|
1332
1336
|
}
|
|
1333
|
-
function le({ service:
|
|
1334
|
-
const e = (g) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(g), t =
|
|
1335
|
-
return /* @__PURE__ */
|
|
1337
|
+
function le({ service: s }) {
|
|
1338
|
+
const e = (g) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(g), t = s.getMonthlyIncome(), r = s.getMonthlyExpenses(), n = s.getSavingsRate(), o = s.calculateBudgetStatus(), l = s.getUpcomingBills(14), d = /* @__PURE__ */ new Date(), c = s.getSpendingSummary(new Date(d.getFullYear(), d.getMonth(), 1), d);
|
|
1339
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1336
1340
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Financial Overview" }),
|
|
1337
|
-
/* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1341
|
+
/* @__PURE__ */ a("div", { style: m.grid, children: [
|
|
1342
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1339
1343
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "This Month" }),
|
|
1340
|
-
/* @__PURE__ */
|
|
1344
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1341
1345
|
/* @__PURE__ */ i("span", { children: "Income" }),
|
|
1342
1346
|
/* @__PURE__ */ i("span", { style: { color: "#4caf50", fontWeight: 600 }, children: e(t) })
|
|
1343
1347
|
] }),
|
|
1344
|
-
/* @__PURE__ */
|
|
1348
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1345
1349
|
/* @__PURE__ */ i("span", { children: "Expenses" }),
|
|
1346
|
-
/* @__PURE__ */ i("span", { style: { color: "#f44336", fontWeight: 600 }, children: e(
|
|
1350
|
+
/* @__PURE__ */ i("span", { style: { color: "#f44336", fontWeight: 600 }, children: e(r) })
|
|
1347
1351
|
] }),
|
|
1348
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ a(
|
|
1349
1353
|
"div",
|
|
1350
1354
|
{
|
|
1351
1355
|
style: {
|
|
@@ -1356,43 +1360,43 @@ function le({ service: a }) {
|
|
|
1356
1360
|
},
|
|
1357
1361
|
children: [
|
|
1358
1362
|
/* @__PURE__ */ i("span", { children: "Savings Rate" }),
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
|
|
1363
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: [
|
|
1364
|
+
n.toFixed(1),
|
|
1361
1365
|
"%"
|
|
1362
1366
|
] })
|
|
1363
1367
|
]
|
|
1364
1368
|
}
|
|
1365
1369
|
)
|
|
1366
1370
|
] }),
|
|
1367
|
-
/* @__PURE__ */
|
|
1371
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1368
1372
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Budget Status" }),
|
|
1369
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" }, children: [
|
|
1370
1374
|
/* @__PURE__ */ i("span", { children: "Used" }),
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
e(
|
|
1375
|
+
/* @__PURE__ */ a("span", { children: [
|
|
1376
|
+
e(o.used),
|
|
1373
1377
|
" / ",
|
|
1374
|
-
e(
|
|
1378
|
+
e(o.total)
|
|
1375
1379
|
] })
|
|
1376
1380
|
] }),
|
|
1377
1381
|
/* @__PURE__ */ i("div", { style: m.progressBar, children: /* @__PURE__ */ i(
|
|
1378
1382
|
"div",
|
|
1379
1383
|
{
|
|
1380
1384
|
style: {
|
|
1381
|
-
width: `${Math.min(100,
|
|
1385
|
+
width: `${Math.min(100, o.used / o.total * 100)}%`,
|
|
1382
1386
|
height: "100%",
|
|
1383
|
-
backgroundColor:
|
|
1387
|
+
backgroundColor: o.used > o.total ? "#f44336" : "#4caf50",
|
|
1384
1388
|
borderRadius: "4px"
|
|
1385
1389
|
}
|
|
1386
1390
|
}
|
|
1387
1391
|
) }),
|
|
1388
|
-
|
|
1389
|
-
|
|
1392
|
+
o.overBudget.length > 0 && /* @__PURE__ */ a("div", { style: { color: "#f44336", fontSize: "12px", marginTop: "8px" }, children: [
|
|
1393
|
+
o.overBudget.length,
|
|
1390
1394
|
" categories over budget"
|
|
1391
1395
|
] })
|
|
1392
1396
|
] }),
|
|
1393
|
-
/* @__PURE__ */
|
|
1397
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1394
1398
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Upcoming Bills (14 days)" }),
|
|
1395
|
-
l.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No upcoming bills" }) : l.slice(0, 4).map((g) => /* @__PURE__ */
|
|
1399
|
+
l.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No upcoming bills" }) : l.slice(0, 4).map((g) => /* @__PURE__ */ a(
|
|
1396
1400
|
"div",
|
|
1397
1401
|
{
|
|
1398
1402
|
style: {
|
|
@@ -1402,9 +1406,9 @@ function le({ service: a }) {
|
|
|
1402
1406
|
borderBottom: "1px solid #f0f0f0"
|
|
1403
1407
|
},
|
|
1404
1408
|
children: [
|
|
1405
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1406
1410
|
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: g.name }),
|
|
1407
|
-
/* @__PURE__ */
|
|
1411
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1408
1412
|
"Due: ",
|
|
1409
1413
|
g.dueDate,
|
|
1410
1414
|
"th"
|
|
@@ -1416,16 +1420,16 @@ function le({ service: a }) {
|
|
|
1416
1420
|
g.id
|
|
1417
1421
|
))
|
|
1418
1422
|
] }),
|
|
1419
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1420
1424
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Spending by Category" }),
|
|
1421
|
-
c.slice(0, 5).map((g) => /* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1425
|
+
c.slice(0, 5).map((g) => /* @__PURE__ */ a("div", { style: { marginBottom: "12px" }, children: [
|
|
1426
|
+
/* @__PURE__ */ a(
|
|
1423
1427
|
"div",
|
|
1424
1428
|
{
|
|
1425
1429
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" },
|
|
1426
1430
|
children: [
|
|
1427
1431
|
/* @__PURE__ */ i("span", { children: g.categoryName }),
|
|
1428
|
-
/* @__PURE__ */
|
|
1432
|
+
/* @__PURE__ */ a("span", { children: [
|
|
1429
1433
|
e(g.amount),
|
|
1430
1434
|
" (",
|
|
1431
1435
|
g.percentage.toFixed(0),
|
|
@@ -1451,12 +1455,12 @@ function le({ service: a }) {
|
|
|
1451
1455
|
] });
|
|
1452
1456
|
}
|
|
1453
1457
|
function de({
|
|
1454
|
-
service:
|
|
1458
|
+
service: s,
|
|
1455
1459
|
refresh: e
|
|
1456
1460
|
}) {
|
|
1457
1461
|
const t = (l) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(l);
|
|
1458
|
-
|
|
1459
|
-
const
|
|
1462
|
+
s.getAllAccounts();
|
|
1463
|
+
const r = s.calculateTotalAssets(), n = s.calculateTotalLiabilities(), o = [
|
|
1460
1464
|
"checking",
|
|
1461
1465
|
"savings",
|
|
1462
1466
|
"credit-card",
|
|
@@ -1464,24 +1468,24 @@ function de({
|
|
|
1464
1468
|
"loan",
|
|
1465
1469
|
"cash"
|
|
1466
1470
|
];
|
|
1467
|
-
return /* @__PURE__ */
|
|
1471
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1468
1472
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Accounts" }),
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ a("div", { style: m.grid, children: [
|
|
1474
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1471
1475
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Assets" }),
|
|
1472
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600, color: "#4caf50" }, children: t(
|
|
1476
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600, color: "#4caf50" }, children: t(r) })
|
|
1473
1477
|
] }),
|
|
1474
|
-
/* @__PURE__ */
|
|
1478
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1475
1479
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Liabilities" }),
|
|
1476
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600, color: "#f44336" }, children: t(
|
|
1480
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600, color: "#f44336" }, children: t(n) })
|
|
1477
1481
|
] })
|
|
1478
1482
|
] }),
|
|
1479
|
-
|
|
1480
|
-
const d =
|
|
1481
|
-
return d.length === 0 ? null : /* @__PURE__ */
|
|
1483
|
+
o.map((l) => {
|
|
1484
|
+
const d = s.getAccountsByType(l);
|
|
1485
|
+
return d.length === 0 ? null : /* @__PURE__ */ a("div", { style: { ...m.card, marginBottom: "20px" }, children: [
|
|
1482
1486
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: l.replace("-", " ").replace(/\b\w/g, (c) => c.toUpperCase()) }),
|
|
1483
|
-
d.map((c) => /* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1487
|
+
d.map((c) => /* @__PURE__ */ a("div", { style: m.transactionRow, children: [
|
|
1488
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1485
1489
|
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: c.name }),
|
|
1486
1490
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: c.institution })
|
|
1487
1491
|
] }),
|
|
@@ -1491,45 +1495,45 @@ function de({
|
|
|
1491
1495
|
})
|
|
1492
1496
|
] });
|
|
1493
1497
|
}
|
|
1494
|
-
function ce({ service:
|
|
1495
|
-
const e = (
|
|
1498
|
+
function ce({ service: s }) {
|
|
1499
|
+
const e = (o) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(o), t = s.getAllTransactions(), r = s.getAllCategories(), n = (o) => {
|
|
1496
1500
|
var l;
|
|
1497
|
-
return ((l =
|
|
1501
|
+
return ((l = r.find((d) => d.id === o)) == null ? void 0 : l.name) || "Uncategorized";
|
|
1498
1502
|
};
|
|
1499
|
-
return /* @__PURE__ */
|
|
1503
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1500
1504
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Transactions" }),
|
|
1501
|
-
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No transactions" }) : t.slice(0, 20).map((
|
|
1502
|
-
/* @__PURE__ */
|
|
1503
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children:
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
new Date(
|
|
1505
|
+
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No transactions" }) : t.slice(0, 20).map((o) => /* @__PURE__ */ a("div", { style: m.transactionRow, children: [
|
|
1506
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1507
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: o.description }),
|
|
1508
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1509
|
+
new Date(o.date).toLocaleDateString(),
|
|
1506
1510
|
" • ",
|
|
1507
|
-
|
|
1511
|
+
n(o.categoryId)
|
|
1508
1512
|
] })
|
|
1509
1513
|
] }),
|
|
1510
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ a(
|
|
1511
1515
|
"span",
|
|
1512
1516
|
{
|
|
1513
|
-
style: { fontWeight: 600, color:
|
|
1517
|
+
style: { fontWeight: 600, color: o.type === "income" ? "#4caf50" : "#f44336" },
|
|
1514
1518
|
children: [
|
|
1515
|
-
|
|
1516
|
-
e(
|
|
1519
|
+
o.type === "income" ? "+" : "-",
|
|
1520
|
+
e(o.amount)
|
|
1517
1521
|
]
|
|
1518
1522
|
}
|
|
1519
1523
|
)
|
|
1520
|
-
] },
|
|
1524
|
+
] }, o.id)) })
|
|
1521
1525
|
] });
|
|
1522
1526
|
}
|
|
1523
|
-
function ue({ service:
|
|
1524
|
-
const e = (
|
|
1527
|
+
function ue({ service: s }) {
|
|
1528
|
+
const e = (o) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(o), t = s.getAllBudgets(), r = s.getAllCategories(), n = (o) => {
|
|
1525
1529
|
var l;
|
|
1526
|
-
return ((l =
|
|
1530
|
+
return ((l = r.find((d) => d.id === o)) == null ? void 0 : l.name) || "Unknown";
|
|
1527
1531
|
};
|
|
1528
|
-
return /* @__PURE__ */
|
|
1532
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1529
1533
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Budgets" }),
|
|
1530
|
-
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No budgets set" }) : t.map((
|
|
1531
|
-
const l =
|
|
1532
|
-
return /* @__PURE__ */
|
|
1534
|
+
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No budgets set" }) : t.map((o) => {
|
|
1535
|
+
const l = o.spent / o.amount * 100, d = o.spent > o.amount;
|
|
1536
|
+
return /* @__PURE__ */ a(
|
|
1533
1537
|
"div",
|
|
1534
1538
|
{
|
|
1535
1539
|
style: {
|
|
@@ -1538,16 +1542,16 @@ function ue({ service: a }) {
|
|
|
1538
1542
|
borderBottom: "1px solid #f0f0f0"
|
|
1539
1543
|
},
|
|
1540
1544
|
children: [
|
|
1541
|
-
/* @__PURE__ */
|
|
1545
|
+
/* @__PURE__ */ a(
|
|
1542
1546
|
"div",
|
|
1543
1547
|
{
|
|
1544
1548
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
1545
1549
|
children: [
|
|
1546
|
-
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children:
|
|
1547
|
-
/* @__PURE__ */
|
|
1548
|
-
e(
|
|
1550
|
+
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: n(o.categoryId) }),
|
|
1551
|
+
/* @__PURE__ */ a("span", { children: [
|
|
1552
|
+
e(o.spent),
|
|
1549
1553
|
" / ",
|
|
1550
|
-
e(
|
|
1554
|
+
e(o.amount)
|
|
1551
1555
|
] })
|
|
1552
1556
|
]
|
|
1553
1557
|
}
|
|
@@ -1567,72 +1571,72 @@ function ue({ service: a }) {
|
|
|
1567
1571
|
"div",
|
|
1568
1572
|
{
|
|
1569
1573
|
style: { fontSize: "12px", color: d ? "#f44336" : "#666", marginTop: "4px" },
|
|
1570
|
-
children: d ? `Over by ${e(
|
|
1574
|
+
children: d ? `Over by ${e(o.spent - o.amount)}` : `${e(o.amount - o.spent)} remaining`
|
|
1571
1575
|
}
|
|
1572
1576
|
)
|
|
1573
1577
|
]
|
|
1574
1578
|
},
|
|
1575
|
-
|
|
1579
|
+
o.id
|
|
1576
1580
|
);
|
|
1577
1581
|
}) })
|
|
1578
1582
|
] });
|
|
1579
1583
|
}
|
|
1580
|
-
function ge({ service:
|
|
1581
|
-
const e = (
|
|
1582
|
-
return /* @__PURE__ */
|
|
1584
|
+
function ge({ service: s }) {
|
|
1585
|
+
const e = (n) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(n), t = s.getAllBills(), r = s.calculateMonthlyBillTotal();
|
|
1586
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1583
1587
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Bills & Subscriptions" }),
|
|
1584
|
-
/* @__PURE__ */
|
|
1588
|
+
/* @__PURE__ */ a("div", { style: { ...m.card, marginBottom: "20px" }, children: [
|
|
1585
1589
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Monthly Bills Total" }),
|
|
1586
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600 }, children: e(
|
|
1590
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600 }, children: e(r) })
|
|
1587
1591
|
] }),
|
|
1588
|
-
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No bills tracked" }) : t.map((
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children:
|
|
1591
|
-
/* @__PURE__ */
|
|
1592
|
+
/* @__PURE__ */ i("div", { style: m.card, children: t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No bills tracked" }) : t.map((n) => /* @__PURE__ */ a("div", { style: m.transactionRow, children: [
|
|
1593
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1594
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: n.name }),
|
|
1595
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1592
1596
|
"Due: ",
|
|
1593
|
-
|
|
1597
|
+
n.dueDate,
|
|
1594
1598
|
"th • ",
|
|
1595
|
-
|
|
1596
|
-
|
|
1599
|
+
n.frequency,
|
|
1600
|
+
n.autoPay && " • Auto-pay"
|
|
1597
1601
|
] })
|
|
1598
1602
|
] }),
|
|
1599
|
-
/* @__PURE__ */ i("span", { style: { fontWeight: 600 }, children: e(
|
|
1600
|
-
] },
|
|
1603
|
+
/* @__PURE__ */ i("span", { style: { fontWeight: 600 }, children: e(n.amount) })
|
|
1604
|
+
] }, n.id)) })
|
|
1601
1605
|
] });
|
|
1602
1606
|
}
|
|
1603
|
-
function he({ service:
|
|
1604
|
-
const e = (l) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(l), t =
|
|
1605
|
-
return /* @__PURE__ */
|
|
1607
|
+
function he({ service: s }) {
|
|
1608
|
+
const e = (l) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(l), t = s.getAllInvestments(), r = s.calculateTotalInvestmentValue(), n = s.calculateTotalGain(), o = s.getPortfolioAllocation();
|
|
1609
|
+
return /* @__PURE__ */ a("div", { children: [
|
|
1606
1610
|
/* @__PURE__ */ i("h2", { style: { marginBottom: "20px" }, children: "Investments" }),
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
/* @__PURE__ */
|
|
1611
|
+
/* @__PURE__ */ a("div", { style: m.grid, children: [
|
|
1612
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1609
1613
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Portfolio Value" }),
|
|
1610
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600 }, children: e(
|
|
1614
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "24px", fontWeight: 600 }, children: e(r) })
|
|
1611
1615
|
] }),
|
|
1612
|
-
/* @__PURE__ */
|
|
1616
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1613
1617
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Total Gain/Loss" }),
|
|
1614
|
-
/* @__PURE__ */
|
|
1618
|
+
/* @__PURE__ */ a(
|
|
1615
1619
|
"div",
|
|
1616
1620
|
{
|
|
1617
1621
|
style: {
|
|
1618
1622
|
fontSize: "24px",
|
|
1619
1623
|
fontWeight: 600,
|
|
1620
|
-
color:
|
|
1624
|
+
color: n >= 0 ? "#4caf50" : "#f44336"
|
|
1621
1625
|
},
|
|
1622
1626
|
children: [
|
|
1623
|
-
|
|
1624
|
-
e(
|
|
1627
|
+
n >= 0 ? "+" : "",
|
|
1628
|
+
e(n)
|
|
1625
1629
|
]
|
|
1626
1630
|
}
|
|
1627
1631
|
)
|
|
1628
1632
|
] })
|
|
1629
1633
|
] }),
|
|
1630
|
-
/* @__PURE__ */
|
|
1634
|
+
/* @__PURE__ */ a("div", { style: { ...m.card, marginBottom: "20px" }, children: [
|
|
1631
1635
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Asset Allocation" }),
|
|
1632
|
-
|
|
1633
|
-
/* @__PURE__ */
|
|
1636
|
+
o.map((l) => /* @__PURE__ */ a("div", { style: { marginBottom: "12px" }, children: [
|
|
1637
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "4px" }, children: [
|
|
1634
1638
|
/* @__PURE__ */ i("span", { style: { textTransform: "capitalize" }, children: l.type }),
|
|
1635
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ a("span", { children: [
|
|
1636
1640
|
l.percentage.toFixed(1),
|
|
1637
1641
|
"%"
|
|
1638
1642
|
] })
|
|
@@ -1650,20 +1654,20 @@ function he({ service: a }) {
|
|
|
1650
1654
|
) })
|
|
1651
1655
|
] }, l.type))
|
|
1652
1656
|
] }),
|
|
1653
|
-
/* @__PURE__ */
|
|
1657
|
+
/* @__PURE__ */ a("div", { style: m.card, children: [
|
|
1654
1658
|
/* @__PURE__ */ i("div", { style: m.cardTitle, children: "Holdings" }),
|
|
1655
|
-
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No investments tracked" }) : t.map((l) => /* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
1659
|
+
t.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "40px" }, children: "No investments tracked" }) : t.map((l) => /* @__PURE__ */ a("div", { style: m.transactionRow, children: [
|
|
1660
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1657
1661
|
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: l.symbol }),
|
|
1658
|
-
/* @__PURE__ */
|
|
1662
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
1659
1663
|
l.shares,
|
|
1660
1664
|
" shares @ ",
|
|
1661
1665
|
e(l.currentPrice)
|
|
1662
1666
|
] })
|
|
1663
1667
|
] }),
|
|
1664
|
-
/* @__PURE__ */
|
|
1668
|
+
/* @__PURE__ */ a("div", { style: { textAlign: "right" }, children: [
|
|
1665
1669
|
/* @__PURE__ */ i("div", { style: { fontWeight: 600 }, children: e(l.currentValue) }),
|
|
1666
|
-
/* @__PURE__ */
|
|
1670
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: l.gain >= 0 ? "#4caf50" : "#f44336" }, children: [
|
|
1667
1671
|
l.gain >= 0 ? "+" : "",
|
|
1668
1672
|
e(l.gain),
|
|
1669
1673
|
" (",
|
|
@@ -1675,7 +1679,7 @@ function he({ service: a }) {
|
|
|
1675
1679
|
] })
|
|
1676
1680
|
] });
|
|
1677
1681
|
}
|
|
1678
|
-
const
|
|
1682
|
+
const N = {
|
|
1679
1683
|
urgent: 0,
|
|
1680
1684
|
high: 1,
|
|
1681
1685
|
medium: 2,
|
|
@@ -1693,26 +1697,26 @@ class pe {
|
|
|
1693
1697
|
TASKS
|
|
1694
1698
|
───────────────────────────────────────────────────────────── */
|
|
1695
1699
|
addTask(e) {
|
|
1696
|
-
const t = this.generateId(),
|
|
1700
|
+
const t = this.generateId(), r = /* @__PURE__ */ new Date(), n = {
|
|
1697
1701
|
...e,
|
|
1698
1702
|
id: t,
|
|
1699
1703
|
subtasks: [],
|
|
1700
|
-
createdAt:
|
|
1701
|
-
updatedAt:
|
|
1704
|
+
createdAt: r,
|
|
1705
|
+
updatedAt: r
|
|
1702
1706
|
};
|
|
1703
|
-
return this.tasks.set(t,
|
|
1707
|
+
return this.tasks.set(t, n), n;
|
|
1704
1708
|
}
|
|
1705
1709
|
updateTask(e, t) {
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1710
|
+
const r = this.tasks.get(e);
|
|
1711
|
+
r && this.tasks.set(e, { ...r, ...t, id: e, updatedAt: /* @__PURE__ */ new Date() });
|
|
1708
1712
|
}
|
|
1709
1713
|
deleteTask(e) {
|
|
1710
1714
|
const t = this.tasks.get(e);
|
|
1711
1715
|
if (t) {
|
|
1712
|
-
for (const
|
|
1713
|
-
this.deleteTask(
|
|
1714
|
-
for (const
|
|
1715
|
-
this.timeBlocks.delete(
|
|
1716
|
+
for (const r of t.subtasks)
|
|
1717
|
+
this.deleteTask(r.id);
|
|
1718
|
+
for (const r of t.timeBlocks)
|
|
1719
|
+
this.timeBlocks.delete(r.id);
|
|
1716
1720
|
this.tasks.delete(e);
|
|
1717
1721
|
}
|
|
1718
1722
|
}
|
|
@@ -1738,23 +1742,23 @@ class pe {
|
|
|
1738
1742
|
});
|
|
1739
1743
|
}
|
|
1740
1744
|
parseQuickAdd(e) {
|
|
1741
|
-
let t = e,
|
|
1742
|
-
const
|
|
1745
|
+
let t = e, r = "none", n;
|
|
1746
|
+
const o = [];
|
|
1743
1747
|
let l;
|
|
1744
|
-
e.includes("!!!") ? (
|
|
1748
|
+
e.includes("!!!") ? (r = "urgent", t = t.replace("!!!", "")) : e.includes("!!") ? (r = "high", t = t.replace("!!", "")) : e.includes("!") && (r = "medium", t = t.replace("!", ""));
|
|
1745
1749
|
const d = e.match(/#(\w+)/);
|
|
1746
1750
|
if (d) {
|
|
1747
1751
|
const u = Array.from(this.projects.values()).find(
|
|
1748
1752
|
(p) => p.name.toLowerCase() === d[1].toLowerCase()
|
|
1749
1753
|
);
|
|
1750
|
-
u && (
|
|
1754
|
+
u && (n = u.id, t = t.replace(d[0], ""));
|
|
1751
1755
|
}
|
|
1752
1756
|
const c = e.matchAll(/@(\w+)/g);
|
|
1753
1757
|
for (const u of c) {
|
|
1754
1758
|
const p = Array.from(this.tags.values()).find(
|
|
1755
1759
|
(y) => y.name.toLowerCase() === u[1].toLowerCase()
|
|
1756
1760
|
);
|
|
1757
|
-
p && (
|
|
1761
|
+
p && (o.push(p.id), t = t.replace(u[0], ""));
|
|
1758
1762
|
}
|
|
1759
1763
|
const g = [
|
|
1760
1764
|
{ pattern: /\btoday\b/i, offset: () => /* @__PURE__ */ new Date() },
|
|
@@ -1775,9 +1779,9 @@ class pe {
|
|
|
1775
1779
|
}
|
|
1776
1780
|
return {
|
|
1777
1781
|
title: t.trim(),
|
|
1778
|
-
priority:
|
|
1779
|
-
projectId:
|
|
1780
|
-
tags:
|
|
1782
|
+
priority: r,
|
|
1783
|
+
projectId: n,
|
|
1784
|
+
tags: o,
|
|
1781
1785
|
dueDate: l
|
|
1782
1786
|
};
|
|
1783
1787
|
}
|
|
@@ -1807,14 +1811,14 @@ class pe {
|
|
|
1807
1811
|
return null;
|
|
1808
1812
|
const {
|
|
1809
1813
|
pattern: t,
|
|
1810
|
-
interval:
|
|
1811
|
-
endDate:
|
|
1812
|
-
endAfterOccurrences:
|
|
1814
|
+
interval: r,
|
|
1815
|
+
endDate: n,
|
|
1816
|
+
endAfterOccurrences: o
|
|
1813
1817
|
} = e.recurrence, l = new Date(e.dueDate);
|
|
1814
1818
|
let d;
|
|
1815
1819
|
switch (t) {
|
|
1816
1820
|
case "daily":
|
|
1817
|
-
d = new Date(l.getTime() +
|
|
1821
|
+
d = new Date(l.getTime() + r * 864e5);
|
|
1818
1822
|
break;
|
|
1819
1823
|
case "weekdays":
|
|
1820
1824
|
d = new Date(l);
|
|
@@ -1823,29 +1827,29 @@ class pe {
|
|
|
1823
1827
|
while (d.getDay() === 0 || d.getDay() === 6);
|
|
1824
1828
|
break;
|
|
1825
1829
|
case "weekly":
|
|
1826
|
-
d = new Date(l.getTime() +
|
|
1830
|
+
d = new Date(l.getTime() + r * 7 * 864e5);
|
|
1827
1831
|
break;
|
|
1828
1832
|
case "bi-weekly":
|
|
1829
1833
|
d = new Date(l.getTime() + 14 * 864e5);
|
|
1830
1834
|
break;
|
|
1831
1835
|
case "monthly":
|
|
1832
|
-
d = new Date(l), d.setMonth(d.getMonth() +
|
|
1836
|
+
d = new Date(l), d.setMonth(d.getMonth() + r);
|
|
1833
1837
|
break;
|
|
1834
1838
|
case "yearly":
|
|
1835
|
-
d = new Date(l), d.setFullYear(d.getFullYear() +
|
|
1839
|
+
d = new Date(l), d.setFullYear(d.getFullYear() + r);
|
|
1836
1840
|
break;
|
|
1837
1841
|
default:
|
|
1838
1842
|
return null;
|
|
1839
1843
|
}
|
|
1840
|
-
return
|
|
1844
|
+
return n && d > n ? null : d;
|
|
1841
1845
|
}
|
|
1842
1846
|
/* ─────────────────────────────────────────────────────────────
|
|
1843
1847
|
FILTERING & SORTING
|
|
1844
1848
|
───────────────────────────────────────────────────────────── */
|
|
1845
1849
|
filterTasks(e) {
|
|
1846
|
-
var
|
|
1850
|
+
var r, n, o;
|
|
1847
1851
|
let t = this.getAllTasks();
|
|
1848
|
-
if ((
|
|
1852
|
+
if ((r = e.status) != null && r.length && (t = t.filter((l) => e.status.includes(l.status))), (n = e.priority) != null && n.length && (t = t.filter((l) => e.priority.includes(l.priority))), e.projectId !== void 0 && (t = t.filter((l) => l.projectId === e.projectId)), (o = e.tags) != null && o.length && (t = t.filter((l) => e.tags.some((d) => l.tags.includes(d)))), e.dueDateRange) {
|
|
1849
1853
|
const { start: l, end: d } = e.dueDateRange;
|
|
1850
1854
|
t = t.filter((c) => {
|
|
1851
1855
|
if (!c.dueDate)
|
|
@@ -1865,29 +1869,29 @@ class pe {
|
|
|
1865
1869
|
}
|
|
1866
1870
|
return t;
|
|
1867
1871
|
}
|
|
1868
|
-
sortTasks(e, t = "dueDate",
|
|
1869
|
-
return [...e].sort((
|
|
1872
|
+
sortTasks(e, t = "dueDate", r = "asc") {
|
|
1873
|
+
return [...e].sort((o, l) => {
|
|
1870
1874
|
let d = 0;
|
|
1871
1875
|
switch (t) {
|
|
1872
1876
|
case "dueDate": {
|
|
1873
|
-
const c =
|
|
1877
|
+
const c = o.dueDate ? new Date(o.dueDate).getTime() : 1 / 0, g = l.dueDate ? new Date(l.dueDate).getTime() : 1 / 0;
|
|
1874
1878
|
d = c - g;
|
|
1875
1879
|
break;
|
|
1876
1880
|
}
|
|
1877
1881
|
case "priority":
|
|
1878
|
-
d =
|
|
1882
|
+
d = N[o.priority] - N[l.priority];
|
|
1879
1883
|
break;
|
|
1880
1884
|
case "createdAt":
|
|
1881
|
-
d = new Date(
|
|
1885
|
+
d = new Date(o.createdAt).getTime() - new Date(l.createdAt).getTime();
|
|
1882
1886
|
break;
|
|
1883
1887
|
case "title":
|
|
1884
|
-
d =
|
|
1888
|
+
d = o.title.localeCompare(l.title);
|
|
1885
1889
|
break;
|
|
1886
1890
|
case "status":
|
|
1887
|
-
d =
|
|
1891
|
+
d = o.status.localeCompare(l.status);
|
|
1888
1892
|
break;
|
|
1889
1893
|
}
|
|
1890
|
-
return
|
|
1894
|
+
return r === "asc" ? d : -d;
|
|
1891
1895
|
});
|
|
1892
1896
|
}
|
|
1893
1897
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -1908,10 +1912,10 @@ class pe {
|
|
|
1908
1912
|
getUpcoming(e = 7) {
|
|
1909
1913
|
const t = /* @__PURE__ */ new Date();
|
|
1910
1914
|
t.setHours(0, 0, 0, 0);
|
|
1911
|
-
const
|
|
1915
|
+
const r = new Date(t.getTime() + e * 864e5);
|
|
1912
1916
|
return this.filterTasks({
|
|
1913
1917
|
status: ["todo", "in-progress"],
|
|
1914
|
-
dueDateRange: { start: t, end:
|
|
1918
|
+
dueDateRange: { start: t, end: r }
|
|
1915
1919
|
});
|
|
1916
1920
|
}
|
|
1917
1921
|
getOverdue() {
|
|
@@ -1924,27 +1928,27 @@ class pe {
|
|
|
1924
1928
|
PRIORITY MATRIX
|
|
1925
1929
|
───────────────────────────────────────────────────────────── */
|
|
1926
1930
|
getPriorityMatrix() {
|
|
1927
|
-
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (
|
|
1931
|
+
const e = this.filterTasks({ status: ["todo", "in-progress"] }), t = (n) => n.dueDate ? Math.ceil((new Date(n.dueDate).getTime() - Date.now()) / 864e5) <= 2 : !1, r = (n) => ["urgent", "high"].includes(n.priority);
|
|
1928
1932
|
return {
|
|
1929
1933
|
doFirst: {
|
|
1930
1934
|
name: "Do First",
|
|
1931
1935
|
description: "Urgent and Important",
|
|
1932
|
-
tasks: e.filter((
|
|
1936
|
+
tasks: e.filter((n) => t(n) && r(n))
|
|
1933
1937
|
},
|
|
1934
1938
|
schedule: {
|
|
1935
1939
|
name: "Schedule",
|
|
1936
1940
|
description: "Important but Not Urgent",
|
|
1937
|
-
tasks: e.filter((
|
|
1941
|
+
tasks: e.filter((n) => !t(n) && r(n))
|
|
1938
1942
|
},
|
|
1939
1943
|
delegate: {
|
|
1940
1944
|
name: "Delegate",
|
|
1941
1945
|
description: "Urgent but Not Important",
|
|
1942
|
-
tasks: e.filter((
|
|
1946
|
+
tasks: e.filter((n) => t(n) && !r(n))
|
|
1943
1947
|
},
|
|
1944
1948
|
eliminate: {
|
|
1945
1949
|
name: "Eliminate",
|
|
1946
1950
|
description: "Neither Urgent nor Important",
|
|
1947
|
-
tasks: e.filter((
|
|
1951
|
+
tasks: e.filter((n) => !t(n) && !r(n))
|
|
1948
1952
|
}
|
|
1949
1953
|
};
|
|
1950
1954
|
}
|
|
@@ -1952,54 +1956,54 @@ class pe {
|
|
|
1952
1956
|
TIME BLOCKING
|
|
1953
1957
|
───────────────────────────────────────────────────────────── */
|
|
1954
1958
|
addTimeBlock(e) {
|
|
1955
|
-
const t = this.generateId(),
|
|
1956
|
-
if (this.timeBlocks.set(t,
|
|
1957
|
-
const
|
|
1958
|
-
|
|
1959
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
1960
|
+
if (this.timeBlocks.set(t, r), e.taskId) {
|
|
1961
|
+
const n = this.tasks.get(e.taskId);
|
|
1962
|
+
n && (n.timeBlocks.push(r), this.tasks.set(e.taskId, n));
|
|
1959
1963
|
}
|
|
1960
|
-
return
|
|
1964
|
+
return r;
|
|
1961
1965
|
}
|
|
1962
1966
|
updateTimeBlock(e, t) {
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1967
|
+
const r = this.timeBlocks.get(e);
|
|
1968
|
+
r && this.timeBlocks.set(e, { ...r, ...t, id: e });
|
|
1965
1969
|
}
|
|
1966
1970
|
deleteTimeBlock(e) {
|
|
1967
1971
|
const t = this.timeBlocks.get(e);
|
|
1968
1972
|
if (t != null && t.taskId) {
|
|
1969
|
-
const
|
|
1970
|
-
|
|
1973
|
+
const r = this.tasks.get(t.taskId);
|
|
1974
|
+
r && (r.timeBlocks = r.timeBlocks.filter((n) => n.id !== e), this.tasks.set(r.id, r));
|
|
1971
1975
|
}
|
|
1972
1976
|
this.timeBlocks.delete(e);
|
|
1973
1977
|
}
|
|
1974
1978
|
getTimeBlocksForDate(e) {
|
|
1975
1979
|
const t = new Date(e);
|
|
1976
1980
|
t.setHours(0, 0, 0, 0);
|
|
1977
|
-
const
|
|
1978
|
-
return Array.from(this.timeBlocks.values()).filter((
|
|
1979
|
-
const
|
|
1980
|
-
return
|
|
1981
|
+
const r = new Date(t.getTime() + 864e5);
|
|
1982
|
+
return Array.from(this.timeBlocks.values()).filter((n) => {
|
|
1983
|
+
const o = new Date(n.start);
|
|
1984
|
+
return o >= t && o < r;
|
|
1981
1985
|
});
|
|
1982
1986
|
}
|
|
1983
1987
|
/* ─────────────────────────────────────────────────────────────
|
|
1984
1988
|
PROJECTS
|
|
1985
1989
|
───────────────────────────────────────────────────────────── */
|
|
1986
1990
|
addProject(e) {
|
|
1987
|
-
const t = this.generateId(),
|
|
1991
|
+
const t = this.generateId(), r = {
|
|
1988
1992
|
...e,
|
|
1989
1993
|
id: t,
|
|
1990
1994
|
order: this.projects.size,
|
|
1991
1995
|
createdAt: /* @__PURE__ */ new Date()
|
|
1992
1996
|
};
|
|
1993
|
-
return this.projects.set(t,
|
|
1997
|
+
return this.projects.set(t, r), r;
|
|
1994
1998
|
}
|
|
1995
1999
|
updateProject(e, t) {
|
|
1996
|
-
const
|
|
1997
|
-
|
|
2000
|
+
const r = this.projects.get(e);
|
|
2001
|
+
r && this.projects.set(e, { ...r, ...t, id: e });
|
|
1998
2002
|
}
|
|
1999
2003
|
deleteProject(e) {
|
|
2000
2004
|
this.projects.delete(e);
|
|
2001
|
-
for (const [t,
|
|
2002
|
-
|
|
2005
|
+
for (const [t, r] of this.tasks)
|
|
2006
|
+
r.projectId === e && (r.projectId = void 0, this.tasks.set(t, r));
|
|
2003
2007
|
}
|
|
2004
2008
|
getAllProjects() {
|
|
2005
2009
|
return Array.from(this.projects.values()).sort((e, t) => e.order - t.order);
|
|
@@ -2008,24 +2012,24 @@ class pe {
|
|
|
2008
2012
|
return this.filterTasks({ projectId: e });
|
|
2009
2013
|
}
|
|
2010
2014
|
getProjectProgress(e) {
|
|
2011
|
-
const t = this.getProjectTasks(e),
|
|
2015
|
+
const t = this.getProjectTasks(e), r = t.filter((n) => n.status === "done").length;
|
|
2012
2016
|
return {
|
|
2013
2017
|
total: t.length,
|
|
2014
|
-
completed:
|
|
2015
|
-
percentage: t.length > 0 ? Math.round(
|
|
2018
|
+
completed: r,
|
|
2019
|
+
percentage: t.length > 0 ? Math.round(r / t.length * 100) : 0
|
|
2016
2020
|
};
|
|
2017
2021
|
}
|
|
2018
2022
|
/* ─────────────────────────────────────────────────────────────
|
|
2019
2023
|
TAGS
|
|
2020
2024
|
───────────────────────────────────────────────────────────── */
|
|
2021
2025
|
addTag(e) {
|
|
2022
|
-
const t = this.generateId(),
|
|
2023
|
-
return this.tags.set(t,
|
|
2026
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
2027
|
+
return this.tags.set(t, r), r;
|
|
2024
2028
|
}
|
|
2025
2029
|
deleteTag(e) {
|
|
2026
2030
|
this.tags.delete(e);
|
|
2027
|
-
for (const [t,
|
|
2028
|
-
|
|
2031
|
+
for (const [t, r] of this.tasks)
|
|
2032
|
+
r.tags.includes(e) && (r.tags = r.tags.filter((n) => n !== e), this.tasks.set(t, r));
|
|
2029
2033
|
}
|
|
2030
2034
|
getAllTags() {
|
|
2031
2035
|
return Array.from(this.tags.values());
|
|
@@ -2036,16 +2040,16 @@ class pe {
|
|
|
2036
2040
|
getStatistics() {
|
|
2037
2041
|
const e = this.getAllTasks(), t = /* @__PURE__ */ new Date();
|
|
2038
2042
|
t.setHours(0, 0, 0, 0);
|
|
2039
|
-
const
|
|
2040
|
-
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) <
|
|
2043
|
+
const r = new Date(t.getTime() + 864e5), n = e.filter((c) => c.status === "done").length, o = this.getOverdue().length, l = e.filter(
|
|
2044
|
+
(c) => c.dueDate && new Date(c.dueDate) >= t && new Date(c.dueDate) < r && c.status !== "done"
|
|
2041
2045
|
).length, d = e.filter((c) => c.status === "in-progress").length;
|
|
2042
2046
|
return {
|
|
2043
2047
|
total: e.length,
|
|
2044
|
-
completed:
|
|
2045
|
-
overdue:
|
|
2048
|
+
completed: n,
|
|
2049
|
+
overdue: o,
|
|
2046
2050
|
dueToday: l,
|
|
2047
2051
|
inProgress: d,
|
|
2048
|
-
completionRate: e.length > 0 ? Math.round(
|
|
2052
|
+
completionRate: e.length > 0 ? Math.round(n / e.length * 100) : 0
|
|
2049
2053
|
};
|
|
2050
2054
|
}
|
|
2051
2055
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2061,19 +2065,21 @@ class pe {
|
|
|
2061
2065
|
function Ve() {
|
|
2062
2066
|
return new pe();
|
|
2063
2067
|
}
|
|
2064
|
-
const E =
|
|
2068
|
+
const E = W(null);
|
|
2065
2069
|
function Oe() {
|
|
2066
|
-
const
|
|
2067
|
-
if (!
|
|
2070
|
+
const s = F(E);
|
|
2071
|
+
if (!s)
|
|
2068
2072
|
throw new Error("useTaskManager must be used within TaskManagerProvider");
|
|
2069
|
-
return
|
|
2073
|
+
return s;
|
|
2070
2074
|
}
|
|
2071
2075
|
const k = {
|
|
2072
2076
|
container: {
|
|
2073
2077
|
display: "flex",
|
|
2074
2078
|
height: "100%",
|
|
2075
2079
|
fontFamily: "'Inter', sans-serif",
|
|
2076
|
-
backgroundColor: "#f5f7fa"
|
|
2080
|
+
backgroundColor: "#f5f7fa",
|
|
2081
|
+
// A fixed light design: its text must not inherit a dark host theme's light colour.
|
|
2082
|
+
color: "#1a202c"
|
|
2077
2083
|
},
|
|
2078
2084
|
sidebar: {
|
|
2079
2085
|
width: "250px",
|
|
@@ -2196,105 +2202,93 @@ const k = {
|
|
|
2196
2202
|
none: "#e0e0e0"
|
|
2197
2203
|
};
|
|
2198
2204
|
function Ge({
|
|
2199
|
-
service:
|
|
2205
|
+
service: s,
|
|
2200
2206
|
className: e,
|
|
2201
2207
|
style: t
|
|
2202
2208
|
}) {
|
|
2203
2209
|
var M;
|
|
2204
|
-
const [,
|
|
2205
|
-
c.trim() && (
|
|
2210
|
+
const [, r] = S(0), [n, o] = S("inbox"), [l, d] = S(null), [c, g] = S(""), u = L(() => r((T) => T + 1), []), p = { service: s, refresh: u }, y = s.getStatistics(), f = s.getAllProjects(), b = () => {
|
|
2211
|
+
c.trim() && (s.quickAddTask(c), g(""), u());
|
|
2206
2212
|
}, D = (T, P) => {
|
|
2207
|
-
|
|
2213
|
+
o(T), d(P ?? null);
|
|
2208
2214
|
};
|
|
2209
|
-
return /* @__PURE__ */ i(E.Provider, { value: p, children: /* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2215
|
+
return /* @__PURE__ */ i(E.Provider, { value: p, children: /* @__PURE__ */ a("div", { className: e, style: { ...k.container, ...t }, children: [
|
|
2216
|
+
/* @__PURE__ */ a("div", { style: k.sidebar, children: [
|
|
2217
|
+
/* @__PURE__ */ a(
|
|
2212
2218
|
"div",
|
|
2213
2219
|
{
|
|
2214
2220
|
onClick: () => D("inbox"),
|
|
2215
2221
|
style: {
|
|
2216
2222
|
...k.menuItem,
|
|
2217
|
-
backgroundColor:
|
|
2223
|
+
backgroundColor: n === "inbox" ? "#e3f2fd" : "transparent"
|
|
2218
2224
|
},
|
|
2219
2225
|
children: [
|
|
2220
|
-
/* @__PURE__ */ i("span", { children: "📥" }),
|
|
2221
2226
|
/* @__PURE__ */ i("span", { children: "Inbox" }),
|
|
2222
|
-
y.total - y.completed > 0 && /* @__PURE__ */ i("span", { style: k.badge, children:
|
|
2227
|
+
y.total - y.completed > 0 && /* @__PURE__ */ i("span", { style: k.badge, children: s.getInbox().length })
|
|
2223
2228
|
]
|
|
2224
2229
|
}
|
|
2225
2230
|
),
|
|
2226
|
-
/* @__PURE__ */
|
|
2231
|
+
/* @__PURE__ */ a(
|
|
2227
2232
|
"div",
|
|
2228
2233
|
{
|
|
2229
2234
|
onClick: () => D("today"),
|
|
2230
2235
|
style: {
|
|
2231
2236
|
...k.menuItem,
|
|
2232
|
-
backgroundColor:
|
|
2237
|
+
backgroundColor: n === "today" ? "#e3f2fd" : "transparent"
|
|
2233
2238
|
},
|
|
2234
2239
|
children: [
|
|
2235
|
-
/* @__PURE__ */ i("span", { children: "📅" }),
|
|
2236
2240
|
/* @__PURE__ */ i("span", { children: "Today" }),
|
|
2237
2241
|
y.dueToday > 0 && /* @__PURE__ */ i("span", { style: k.badge, children: y.dueToday })
|
|
2238
2242
|
]
|
|
2239
2243
|
}
|
|
2240
2244
|
),
|
|
2241
|
-
/* @__PURE__ */
|
|
2245
|
+
/* @__PURE__ */ i(
|
|
2242
2246
|
"div",
|
|
2243
2247
|
{
|
|
2244
2248
|
onClick: () => D("upcoming"),
|
|
2245
2249
|
style: {
|
|
2246
2250
|
...k.menuItem,
|
|
2247
|
-
backgroundColor:
|
|
2251
|
+
backgroundColor: n === "upcoming" ? "#e3f2fd" : "transparent"
|
|
2248
2252
|
},
|
|
2249
|
-
children:
|
|
2250
|
-
/* @__PURE__ */ i("span", { children: "🗓️" }),
|
|
2251
|
-
/* @__PURE__ */ i("span", { children: "Upcoming" })
|
|
2252
|
-
]
|
|
2253
|
+
children: /* @__PURE__ */ i("span", { children: "Upcoming" })
|
|
2253
2254
|
}
|
|
2254
2255
|
),
|
|
2255
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ i(
|
|
2256
2257
|
"div",
|
|
2257
2258
|
{
|
|
2258
2259
|
onClick: () => D("matrix"),
|
|
2259
2260
|
style: {
|
|
2260
2261
|
...k.menuItem,
|
|
2261
|
-
backgroundColor:
|
|
2262
|
+
backgroundColor: n === "matrix" ? "#e3f2fd" : "transparent"
|
|
2262
2263
|
},
|
|
2263
|
-
children:
|
|
2264
|
-
/* @__PURE__ */ i("span", { children: "⬜" }),
|
|
2265
|
-
/* @__PURE__ */ i("span", { children: "Priority Matrix" })
|
|
2266
|
-
]
|
|
2264
|
+
children: /* @__PURE__ */ i("span", { children: "Priority Matrix" })
|
|
2267
2265
|
}
|
|
2268
2266
|
),
|
|
2269
|
-
/* @__PURE__ */
|
|
2267
|
+
/* @__PURE__ */ i(
|
|
2270
2268
|
"div",
|
|
2271
2269
|
{
|
|
2272
2270
|
onClick: () => D("all"),
|
|
2273
2271
|
style: {
|
|
2274
2272
|
...k.menuItem,
|
|
2275
|
-
backgroundColor:
|
|
2273
|
+
backgroundColor: n === "all" ? "#e3f2fd" : "transparent"
|
|
2276
2274
|
},
|
|
2277
|
-
children:
|
|
2278
|
-
/* @__PURE__ */ i("span", { children: "📋" }),
|
|
2279
|
-
/* @__PURE__ */ i("span", { children: "All Tasks" })
|
|
2280
|
-
]
|
|
2275
|
+
children: /* @__PURE__ */ i("span", { children: "All Tasks" })
|
|
2281
2276
|
}
|
|
2282
2277
|
),
|
|
2283
|
-
y.overdue > 0 && /* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */ i("span", { children: "⚠️" }),
|
|
2278
|
+
y.overdue > 0 && /* @__PURE__ */ a("div", { style: { ...k.menuItem, color: "#f44336" }, children: [
|
|
2285
2279
|
/* @__PURE__ */ i("span", { children: "Overdue" }),
|
|
2286
2280
|
/* @__PURE__ */ i("span", { style: { ...k.badge, backgroundColor: "#f44336" }, children: y.overdue })
|
|
2287
2281
|
] }),
|
|
2288
2282
|
/* @__PURE__ */ i("div", { style: k.sectionTitle, children: "Projects" }),
|
|
2289
2283
|
f.map((T) => {
|
|
2290
|
-
const P =
|
|
2291
|
-
return /* @__PURE__ */
|
|
2284
|
+
const P = s.getProjectProgress(T.id);
|
|
2285
|
+
return /* @__PURE__ */ a(
|
|
2292
2286
|
"div",
|
|
2293
2287
|
{
|
|
2294
2288
|
onClick: () => D("project", T.id),
|
|
2295
2289
|
style: {
|
|
2296
2290
|
...k.menuItem,
|
|
2297
|
-
backgroundColor:
|
|
2291
|
+
backgroundColor: n === "project" && l === T.id ? "#e3f2fd" : "transparent"
|
|
2298
2292
|
},
|
|
2299
2293
|
children: [
|
|
2300
2294
|
/* @__PURE__ */ i(
|
|
@@ -2309,7 +2303,7 @@ function Ge({
|
|
|
2309
2303
|
}
|
|
2310
2304
|
),
|
|
2311
2305
|
/* @__PURE__ */ i("span", { style: { flex: 1 }, children: T.name }),
|
|
2312
|
-
/* @__PURE__ */
|
|
2306
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "12px", color: "#999" }, children: [
|
|
2313
2307
|
P.percentage,
|
|
2314
2308
|
"%"
|
|
2315
2309
|
] })
|
|
@@ -2319,24 +2313,24 @@ function Ge({
|
|
|
2319
2313
|
);
|
|
2320
2314
|
})
|
|
2321
2315
|
] }),
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2316
|
+
/* @__PURE__ */ a("div", { style: k.main, children: [
|
|
2317
|
+
/* @__PURE__ */ a("div", { style: k.header, children: [
|
|
2318
|
+
/* @__PURE__ */ a("div", { style: k.title, children: [
|
|
2319
|
+
n === "inbox" && "Inbox",
|
|
2320
|
+
n === "today" && "Today",
|
|
2321
|
+
n === "upcoming" && "Upcoming",
|
|
2322
|
+
n === "matrix" && "Priority Matrix",
|
|
2323
|
+
n === "all" && "All Tasks",
|
|
2324
|
+
n === "project" && ((M = f.find((T) => T.id === l)) == null ? void 0 : M.name)
|
|
2331
2325
|
] }),
|
|
2332
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "14px", color: "#666" }, children: [
|
|
2333
2327
|
y.completed,
|
|
2334
2328
|
"/",
|
|
2335
2329
|
y.total,
|
|
2336
2330
|
" completed"
|
|
2337
2331
|
] })
|
|
2338
2332
|
] }),
|
|
2339
|
-
|
|
2333
|
+
n !== "matrix" && /* @__PURE__ */ i(
|
|
2340
2334
|
"input",
|
|
2341
2335
|
{
|
|
2342
2336
|
type: "text",
|
|
@@ -2347,11 +2341,11 @@ function Ge({
|
|
|
2347
2341
|
style: k.taskInput
|
|
2348
2342
|
}
|
|
2349
2343
|
),
|
|
2350
|
-
|
|
2344
|
+
n === "matrix" ? /* @__PURE__ */ i(me, { service: s, onComplete: u }) : /* @__PURE__ */ i(
|
|
2351
2345
|
fe,
|
|
2352
2346
|
{
|
|
2353
|
-
service:
|
|
2354
|
-
view:
|
|
2347
|
+
service: s,
|
|
2348
|
+
view: n,
|
|
2355
2349
|
projectId: l,
|
|
2356
2350
|
onComplete: u
|
|
2357
2351
|
}
|
|
@@ -2360,95 +2354,88 @@ function Ge({
|
|
|
2360
2354
|
] }) });
|
|
2361
2355
|
}
|
|
2362
2356
|
function fe({
|
|
2363
|
-
service:
|
|
2357
|
+
service: s,
|
|
2364
2358
|
view: e,
|
|
2365
2359
|
projectId: t,
|
|
2366
|
-
onComplete:
|
|
2360
|
+
onComplete: r
|
|
2367
2361
|
}) {
|
|
2368
|
-
const
|
|
2362
|
+
const n = z(() => {
|
|
2369
2363
|
switch (e) {
|
|
2370
2364
|
case "inbox":
|
|
2371
|
-
return
|
|
2365
|
+
return s.getInbox();
|
|
2372
2366
|
case "today":
|
|
2373
|
-
return
|
|
2367
|
+
return s.getToday();
|
|
2374
2368
|
case "upcoming":
|
|
2375
|
-
return
|
|
2369
|
+
return s.getUpcoming();
|
|
2376
2370
|
case "all":
|
|
2377
|
-
return
|
|
2378
|
-
|
|
2371
|
+
return s.sortTasks(
|
|
2372
|
+
s.filterTasks({ status: ["inbox", "todo", "in-progress"] }),
|
|
2379
2373
|
"dueDate"
|
|
2380
2374
|
);
|
|
2381
2375
|
case "project":
|
|
2382
|
-
return t ?
|
|
2376
|
+
return t ? s.filterTasks({ projectId: t, status: ["inbox", "todo", "in-progress"] }) : [];
|
|
2383
2377
|
default:
|
|
2384
2378
|
return [];
|
|
2385
2379
|
}
|
|
2386
|
-
}, [
|
|
2387
|
-
return
|
|
2388
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "48px", marginBottom: "16px" }, children: "✨" }),
|
|
2389
|
-
/* @__PURE__ */ i("div", { children: "No tasks here!" })
|
|
2390
|
-
] }) : /* @__PURE__ */ i("div", { children: r.map((s) => /* @__PURE__ */ i(V, { task: s, service: a, onComplete: n }, s.id)) });
|
|
2380
|
+
}, [s, e, t]);
|
|
2381
|
+
return n.length === 0 ? /* @__PURE__ */ i("div", { style: { textAlign: "center", padding: "60px", color: "#999" }, children: /* @__PURE__ */ i("div", { children: "No tasks here!" }) }) : /* @__PURE__ */ i("div", { children: n.map((o) => /* @__PURE__ */ i(V, { task: o, service: s, onComplete: r }, o.id)) });
|
|
2391
2382
|
}
|
|
2392
2383
|
function V({
|
|
2393
|
-
task:
|
|
2384
|
+
task: s,
|
|
2394
2385
|
service: e,
|
|
2395
2386
|
onComplete: t
|
|
2396
2387
|
}) {
|
|
2397
|
-
const
|
|
2398
|
-
l.stopPropagation(), e.completeTask(
|
|
2399
|
-
},
|
|
2388
|
+
const r = (l) => {
|
|
2389
|
+
l.stopPropagation(), e.completeTask(s.id), t();
|
|
2390
|
+
}, n = (l) => {
|
|
2400
2391
|
const d = new Date(l), c = /* @__PURE__ */ new Date();
|
|
2401
2392
|
c.setHours(0, 0, 0, 0);
|
|
2402
2393
|
const g = new Date(c.getTime() + 864e5);
|
|
2403
2394
|
return d < c ? "Overdue" : d.toDateString() === c.toDateString() ? "Today" : d.toDateString() === g.toDateString() ? "Tomorrow" : d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
|
|
2404
|
-
},
|
|
2405
|
-
return /* @__PURE__ */
|
|
2395
|
+
}, o = s.dueDate && new Date(s.dueDate) < /* @__PURE__ */ new Date() && s.status !== "done";
|
|
2396
|
+
return /* @__PURE__ */ a("div", { style: k.taskItem, children: [
|
|
2406
2397
|
/* @__PURE__ */ i(
|
|
2407
2398
|
"div",
|
|
2408
2399
|
{
|
|
2409
|
-
style: { ...k.priorityIndicator, backgroundColor: H[
|
|
2400
|
+
style: { ...k.priorityIndicator, backgroundColor: H[s.priority] }
|
|
2410
2401
|
}
|
|
2411
2402
|
),
|
|
2412
2403
|
/* @__PURE__ */ i(
|
|
2413
2404
|
"div",
|
|
2414
2405
|
{
|
|
2415
|
-
onClick:
|
|
2406
|
+
onClick: r,
|
|
2416
2407
|
style: {
|
|
2417
2408
|
...k.checkbox,
|
|
2418
|
-
borderColor: H[
|
|
2409
|
+
borderColor: H[s.priority]
|
|
2419
2410
|
}
|
|
2420
2411
|
}
|
|
2421
2412
|
),
|
|
2422
|
-
/* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */ i("div", { style: k.taskTitle, children:
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
a.estimatedMinutes && /* @__PURE__ */ o("span", { children: [
|
|
2430
|
-
"⏱️ ",
|
|
2431
|
-
a.estimatedMinutes,
|
|
2432
|
-
"m"
|
|
2413
|
+
/* @__PURE__ */ a("div", { style: k.taskContent, children: [
|
|
2414
|
+
/* @__PURE__ */ i("div", { style: k.taskTitle, children: s.title }),
|
|
2415
|
+
/* @__PURE__ */ a("div", { style: k.taskMeta, children: [
|
|
2416
|
+
s.dueDate && /* @__PURE__ */ i("span", { style: { color: o ? "#f44336" : "#666" }, children: n(s.dueDate) }),
|
|
2417
|
+
s.estimatedMinutes && /* @__PURE__ */ a("span", { children: [
|
|
2418
|
+
s.estimatedMinutes,
|
|
2419
|
+
" min"
|
|
2433
2420
|
] }),
|
|
2434
|
-
|
|
2421
|
+
s.recurrence && /* @__PURE__ */ i("span", { children: "Repeats" })
|
|
2435
2422
|
] })
|
|
2436
2423
|
] })
|
|
2437
2424
|
] });
|
|
2438
2425
|
}
|
|
2439
2426
|
function me({
|
|
2440
|
-
service:
|
|
2427
|
+
service: s,
|
|
2441
2428
|
onComplete: e
|
|
2442
2429
|
}) {
|
|
2443
|
-
const t =
|
|
2430
|
+
const t = s.getPriorityMatrix(), r = {
|
|
2444
2431
|
doFirst: { bg: "#ffebee", border: "#f44336" },
|
|
2445
2432
|
schedule: { bg: "#fff3e0", border: "#ff9800" },
|
|
2446
2433
|
delegate: { bg: "#e3f2fd", border: "#2196f3" },
|
|
2447
2434
|
eliminate: { bg: "#f5f5f5", border: "#9e9e9e" }
|
|
2448
2435
|
};
|
|
2449
|
-
return /* @__PURE__ */ i("div", { style: k.matrixGrid, children: ["doFirst", "schedule", "delegate", "eliminate"].map((
|
|
2450
|
-
const
|
|
2451
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ i("div", { style: k.matrixGrid, children: ["doFirst", "schedule", "delegate", "eliminate"].map((n) => {
|
|
2437
|
+
const o = t[n], l = r[n];
|
|
2438
|
+
return /* @__PURE__ */ a(
|
|
2452
2439
|
"div",
|
|
2453
2440
|
{
|
|
2454
2441
|
style: {
|
|
@@ -2457,13 +2444,13 @@ function me({
|
|
|
2457
2444
|
borderLeft: `4px solid ${l.border}`
|
|
2458
2445
|
},
|
|
2459
2446
|
children: [
|
|
2460
|
-
/* @__PURE__ */ i("div", { style: { fontWeight: 600, marginBottom: "8px" }, children:
|
|
2461
|
-
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666", marginBottom: "12px" }, children:
|
|
2462
|
-
|
|
2463
|
-
|
|
2447
|
+
/* @__PURE__ */ i("div", { style: { fontWeight: 600, marginBottom: "8px" }, children: o.name }),
|
|
2448
|
+
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666", marginBottom: "12px" }, children: o.description }),
|
|
2449
|
+
o.tasks.map((d) => /* @__PURE__ */ i(V, { task: d, service: s, onComplete: e }, d.id)),
|
|
2450
|
+
o.tasks.length === 0 && /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "Empty" })
|
|
2464
2451
|
]
|
|
2465
2452
|
},
|
|
2466
|
-
|
|
2453
|
+
n
|
|
2467
2454
|
);
|
|
2468
2455
|
}) });
|
|
2469
2456
|
}
|
|
@@ -2490,18 +2477,18 @@ class ye {
|
|
|
2490
2477
|
KPIs
|
|
2491
2478
|
───────────────────────────────────────────────────────────── */
|
|
2492
2479
|
addKPI(e) {
|
|
2493
|
-
const t = this.generateId(),
|
|
2494
|
-
return this.kpis.set(t,
|
|
2480
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
2481
|
+
return this.kpis.set(t, r), r;
|
|
2495
2482
|
}
|
|
2496
2483
|
updateKPI(e, t) {
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2484
|
+
const r = this.kpis.get(e);
|
|
2485
|
+
r && this.kpis.set(e, { ...r, ...t, id: e });
|
|
2499
2486
|
}
|
|
2500
2487
|
recordKPIValue(e, t) {
|
|
2501
|
-
const
|
|
2502
|
-
if (
|
|
2503
|
-
const
|
|
2504
|
-
|
|
2488
|
+
const r = this.kpis.get(e);
|
|
2489
|
+
if (r) {
|
|
2490
|
+
const n = r.currentValue;
|
|
2491
|
+
r.currentValue = t, r.history.push({ date: /* @__PURE__ */ new Date(), value: t }), r.trend = t > n ? "up" : t < n ? "down" : "stable", this.kpis.set(e, r);
|
|
2505
2492
|
}
|
|
2506
2493
|
}
|
|
2507
2494
|
getAllKPIs() {
|
|
@@ -2517,24 +2504,24 @@ class ye {
|
|
|
2517
2504
|
GOALS
|
|
2518
2505
|
───────────────────────────────────────────────────────────── */
|
|
2519
2506
|
addGoal(e) {
|
|
2520
|
-
const t = this.generateId(),
|
|
2521
|
-
return this.goals.set(t,
|
|
2507
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
2508
|
+
return this.goals.set(t, r), r;
|
|
2522
2509
|
}
|
|
2523
2510
|
updateGoal(e, t) {
|
|
2524
|
-
const
|
|
2525
|
-
|
|
2511
|
+
const r = this.goals.get(e);
|
|
2512
|
+
r && this.goals.set(e, { ...r, ...t, id: e });
|
|
2526
2513
|
}
|
|
2527
2514
|
completeGoalMilestone(e, t) {
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2530
|
-
const
|
|
2531
|
-
|
|
2515
|
+
const r = this.goals.get(e);
|
|
2516
|
+
if (r) {
|
|
2517
|
+
const n = r.milestones.find((o) => o.id === t);
|
|
2518
|
+
n && (n.completed = !0, n.completedDate = /* @__PURE__ */ new Date(), r.progress = this.calculateGoalProgress(r), this.goals.set(e, r));
|
|
2532
2519
|
}
|
|
2533
2520
|
}
|
|
2534
2521
|
calculateGoalProgress(e) {
|
|
2535
2522
|
if (e.milestones.length === 0)
|
|
2536
2523
|
return e.progress;
|
|
2537
|
-
const t = e.milestones.filter((
|
|
2524
|
+
const t = e.milestones.filter((r) => r.completed).length;
|
|
2538
2525
|
return Math.round(t / e.milestones.length * 100);
|
|
2539
2526
|
}
|
|
2540
2527
|
getAllGoals() {
|
|
@@ -2547,14 +2534,14 @@ class ye {
|
|
|
2547
2534
|
return this.getAllGoals().filter((t) => t.category === e);
|
|
2548
2535
|
}
|
|
2549
2536
|
getUpcomingDeadlines(e = 30) {
|
|
2550
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2551
|
-
return this.getActiveGoals().filter((
|
|
2537
|
+
const t = /* @__PURE__ */ new Date(), r = new Date(t.getTime() + e * 24 * 60 * 60 * 1e3);
|
|
2538
|
+
return this.getActiveGoals().filter((n) => n.targetDate <= r).sort((n, o) => n.targetDate.getTime() - o.targetDate.getTime());
|
|
2552
2539
|
}
|
|
2553
2540
|
/* ─────────────────────────────────────────────────────────────
|
|
2554
2541
|
HABITS
|
|
2555
2542
|
───────────────────────────────────────────────────────────── */
|
|
2556
2543
|
addHabit(e) {
|
|
2557
|
-
const t = this.generateId(),
|
|
2544
|
+
const t = this.generateId(), r = {
|
|
2558
2545
|
...e,
|
|
2559
2546
|
id: t,
|
|
2560
2547
|
streak: 0,
|
|
@@ -2562,64 +2549,64 @@ class ye {
|
|
|
2562
2549
|
completions: [],
|
|
2563
2550
|
createdAt: /* @__PURE__ */ new Date()
|
|
2564
2551
|
};
|
|
2565
|
-
return this.habits.set(t,
|
|
2552
|
+
return this.habits.set(t, r), r;
|
|
2566
2553
|
}
|
|
2567
|
-
completeHabit(e, t = 1,
|
|
2568
|
-
const
|
|
2569
|
-
if (
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2572
|
-
const l =
|
|
2573
|
-
(d) => new Date(d.date).toDateString() ===
|
|
2554
|
+
completeHabit(e, t = 1, r) {
|
|
2555
|
+
const n = this.habits.get(e);
|
|
2556
|
+
if (n) {
|
|
2557
|
+
const o = /* @__PURE__ */ new Date();
|
|
2558
|
+
o.setHours(0, 0, 0, 0);
|
|
2559
|
+
const l = n.completions.find(
|
|
2560
|
+
(d) => new Date(d.date).toDateString() === o.toDateString()
|
|
2574
2561
|
);
|
|
2575
|
-
l ? (l.count += t,
|
|
2562
|
+
l ? (l.count += t, r && (l.note = r)) : n.completions.push({ date: o, count: t, note: r }), this.updateStreak(n), this.habits.set(e, n);
|
|
2576
2563
|
}
|
|
2577
2564
|
}
|
|
2578
2565
|
updateStreak(e) {
|
|
2579
2566
|
const t = [...e.completions].sort(
|
|
2580
|
-
(
|
|
2567
|
+
(o, l) => new Date(l.date).getTime() - new Date(o.date).getTime()
|
|
2581
2568
|
);
|
|
2582
2569
|
if (t.length === 0) {
|
|
2583
2570
|
e.streak = 0;
|
|
2584
2571
|
return;
|
|
2585
2572
|
}
|
|
2586
|
-
let
|
|
2587
|
-
const
|
|
2588
|
-
|
|
2589
|
-
for (let
|
|
2590
|
-
const l = new Date(t[
|
|
2573
|
+
let r = 0;
|
|
2574
|
+
const n = /* @__PURE__ */ new Date();
|
|
2575
|
+
n.setHours(0, 0, 0, 0);
|
|
2576
|
+
for (let o = 0; o < t.length; o++) {
|
|
2577
|
+
const l = new Date(t[o].date);
|
|
2591
2578
|
l.setHours(0, 0, 0, 0);
|
|
2592
|
-
const d = new Date(
|
|
2579
|
+
const d = new Date(n.getTime() - o * 24 * 60 * 60 * 1e3);
|
|
2593
2580
|
if (l.getTime() === d.getTime())
|
|
2594
|
-
if (t[
|
|
2595
|
-
|
|
2581
|
+
if (t[o].count >= e.targetPerPeriod)
|
|
2582
|
+
r++;
|
|
2596
2583
|
else
|
|
2597
2584
|
break;
|
|
2598
2585
|
else
|
|
2599
2586
|
break;
|
|
2600
2587
|
}
|
|
2601
|
-
e.streak =
|
|
2588
|
+
e.streak = r, r > e.longestStreak && (e.longestStreak = r);
|
|
2602
2589
|
}
|
|
2603
2590
|
getAllHabits() {
|
|
2604
2591
|
return Array.from(this.habits.values());
|
|
2605
2592
|
}
|
|
2606
2593
|
getHabitCompletionRate(e, t = 30) {
|
|
2607
|
-
const
|
|
2608
|
-
if (!
|
|
2594
|
+
const r = this.habits.get(e);
|
|
2595
|
+
if (!r)
|
|
2609
2596
|
return 0;
|
|
2610
|
-
const
|
|
2611
|
-
(d) => new Date(d.date) >=
|
|
2597
|
+
const n = /* @__PURE__ */ new Date(), o = new Date(n.getTime() - t * 24 * 60 * 60 * 1e3), l = r.completions.filter(
|
|
2598
|
+
(d) => new Date(d.date) >= o && d.count >= r.targetPerPeriod
|
|
2612
2599
|
);
|
|
2613
2600
|
return Math.round(l.length / t * 100);
|
|
2614
2601
|
}
|
|
2615
2602
|
getTodayHabitStatus() {
|
|
2616
2603
|
const e = (/* @__PURE__ */ new Date()).toDateString();
|
|
2617
2604
|
return this.getAllHabits().map((t) => {
|
|
2618
|
-
const
|
|
2605
|
+
const r = t.completions.find((n) => new Date(n.date).toDateString() === e);
|
|
2619
2606
|
return {
|
|
2620
2607
|
habit: t,
|
|
2621
|
-
completed:
|
|
2622
|
-
count: (
|
|
2608
|
+
completed: r ? r.count >= t.targetPerPeriod : !1,
|
|
2609
|
+
count: (r == null ? void 0 : r.count) ?? 0
|
|
2623
2610
|
};
|
|
2624
2611
|
});
|
|
2625
2612
|
}
|
|
@@ -2627,8 +2614,8 @@ class ye {
|
|
|
2627
2614
|
MOOD & HEALTH
|
|
2628
2615
|
───────────────────────────────────────────────────────────── */
|
|
2629
2616
|
addMoodEntry(e) {
|
|
2630
|
-
const t = this.generateId(),
|
|
2631
|
-
return this.moodEntries.set(t,
|
|
2617
|
+
const t = this.generateId(), r = { ...e, id: t };
|
|
2618
|
+
return this.moodEntries.set(t, r), r;
|
|
2632
2619
|
}
|
|
2633
2620
|
getAllMoodEntries() {
|
|
2634
2621
|
return Array.from(this.moodEntries.values()).sort(
|
|
@@ -2637,37 +2624,37 @@ class ye {
|
|
|
2637
2624
|
}
|
|
2638
2625
|
getMoodEntriesForPeriod(e, t) {
|
|
2639
2626
|
return this.getAllMoodEntries().filter(
|
|
2640
|
-
(
|
|
2627
|
+
(r) => new Date(r.date) >= e && new Date(r.date) <= t
|
|
2641
2628
|
);
|
|
2642
2629
|
}
|
|
2643
2630
|
getAverageMood(e = 7) {
|
|
2644
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2645
|
-
return
|
|
2631
|
+
const t = /* @__PURE__ */ new Date(), r = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), n = this.getMoodEntriesForPeriod(r, t);
|
|
2632
|
+
return n.length === 0 ? 0 : n.reduce((o, l) => o + l.mood, 0) / n.length;
|
|
2646
2633
|
}
|
|
2647
2634
|
getAverageSleep(e = 7) {
|
|
2648
|
-
const t = /* @__PURE__ */ new Date(),
|
|
2649
|
-
return
|
|
2635
|
+
const t = /* @__PURE__ */ new Date(), r = new Date(t.getTime() - e * 24 * 60 * 60 * 1e3), n = this.getMoodEntriesForPeriod(r, t);
|
|
2636
|
+
return n.length === 0 ? 0 : n.reduce((o, l) => o + l.sleep, 0) / n.length;
|
|
2650
2637
|
}
|
|
2651
2638
|
getMoodCorrelations() {
|
|
2652
2639
|
const e = this.getAllMoodEntries();
|
|
2653
2640
|
if (e.length < 5)
|
|
2654
2641
|
return [];
|
|
2655
|
-
const t = [],
|
|
2656
|
-
e.map((
|
|
2657
|
-
e.map((
|
|
2642
|
+
const t = [], r = this.calculateCorrelation(
|
|
2643
|
+
e.map((o) => o.sleep),
|
|
2644
|
+
e.map((o) => o.mood)
|
|
2658
2645
|
);
|
|
2659
|
-
t.push({ factor: "Sleep", correlation:
|
|
2660
|
-
const
|
|
2661
|
-
e.map((
|
|
2662
|
-
e.map((
|
|
2646
|
+
t.push({ factor: "Sleep", correlation: r });
|
|
2647
|
+
const n = this.calculateCorrelation(
|
|
2648
|
+
e.map((o) => o.stress),
|
|
2649
|
+
e.map((o) => o.mood)
|
|
2663
2650
|
);
|
|
2664
|
-
return t.push({ factor: "Stress", correlation:
|
|
2651
|
+
return t.push({ factor: "Stress", correlation: n }), t.sort((o, l) => Math.abs(l.correlation) - Math.abs(o.correlation));
|
|
2665
2652
|
}
|
|
2666
2653
|
calculateCorrelation(e, t) {
|
|
2667
|
-
const
|
|
2668
|
-
if (
|
|
2654
|
+
const r = e.length;
|
|
2655
|
+
if (r === 0)
|
|
2669
2656
|
return 0;
|
|
2670
|
-
const
|
|
2657
|
+
const n = e.reduce((p, y) => p + y, 0), o = t.reduce((p, y) => p + y, 0), l = e.reduce((p, y, f) => p + y * t[f], 0), d = e.reduce((p, y) => p + y * y, 0), c = t.reduce((p, y) => p + y * y, 0), g = r * l - n * o, u = Math.sqrt((r * d - n ** 2) * (r * c - o ** 2));
|
|
2671
2658
|
return u === 0 ? 0 : g / u;
|
|
2672
2659
|
}
|
|
2673
2660
|
/* ─────────────────────────────────────────────────────────────
|
|
@@ -2682,13 +2669,13 @@ class ye {
|
|
|
2682
2669
|
calculateFinanceHealth() {
|
|
2683
2670
|
const e = [], t = Math.min(100, this.financeSummary.savingsRate / 20 * 100);
|
|
2684
2671
|
e.push({ name: "Savings Rate", score: t });
|
|
2685
|
-
const
|
|
2672
|
+
const r = this.financeSummary.budgetTotal > 0 ? Math.min(
|
|
2686
2673
|
100,
|
|
2687
2674
|
(1 - this.financeSummary.budgetUsed / this.financeSummary.budgetTotal) * 100 + 50
|
|
2688
2675
|
) : 50;
|
|
2689
|
-
e.push({ name: "Budget Adherence", score:
|
|
2690
|
-
const
|
|
2691
|
-
e.push({ name: "Debt Management", score:
|
|
2676
|
+
e.push({ name: "Budget Adherence", score: r });
|
|
2677
|
+
const n = this.financeSummary.monthlyIncome > 0 ? this.financeSummary.debts / (this.financeSummary.monthlyIncome * 12) : 0, o = Math.max(0, 100 - n * 100);
|
|
2678
|
+
e.push({ name: "Debt Management", score: o });
|
|
2692
2679
|
const l = this.financeSummary.monthlyExpenses > 0 ? this.financeSummary.savings / this.financeSummary.monthlyExpenses : 0, d = Math.min(100, l / 6 * 100);
|
|
2693
2680
|
e.push({ name: "Emergency Fund", score: d });
|
|
2694
2681
|
const c = e.reduce((g, u) => g + u.score, 0) / e.length;
|
|
@@ -2698,10 +2685,10 @@ class ye {
|
|
|
2698
2685
|
INSIGHTS
|
|
2699
2686
|
───────────────────────────────────────────────────────────── */
|
|
2700
2687
|
generateDailyInsights() {
|
|
2701
|
-
const e = [], t = this.getAllKPIs(),
|
|
2702
|
-
|
|
2703
|
-
const
|
|
2704
|
-
|
|
2688
|
+
const e = [], t = this.getAllKPIs(), r = t.filter((g) => g.currentValue >= g.targetValue);
|
|
2689
|
+
r.length > 0 && e.push(`You've achieved ${r.length} of ${t.length} KPI targets!`);
|
|
2690
|
+
const n = this.getTodayHabitStatus(), o = n.filter((g) => g.completed);
|
|
2691
|
+
o.length === n.length && n.length > 0 ? e.push("All habits completed today! Keep it up!") : o.length > 0 && e.push(`${o.length}/${n.length} habits completed today.`);
|
|
2705
2692
|
const l = this.getAllHabits().reduce((g, u) => Math.max(g, u.streak), 0);
|
|
2706
2693
|
l >= 7 && e.push(`Amazing ${l}-day streak! You're building a strong routine.`);
|
|
2707
2694
|
const d = this.getUpcomingDeadlines(7);
|
|
@@ -2722,12 +2709,12 @@ class ye {
|
|
|
2722
2709
|
function qe() {
|
|
2723
2710
|
return new ye();
|
|
2724
2711
|
}
|
|
2725
|
-
const O =
|
|
2712
|
+
const O = W(null);
|
|
2726
2713
|
function Ke() {
|
|
2727
|
-
const
|
|
2728
|
-
if (!
|
|
2714
|
+
const s = F(O);
|
|
2715
|
+
if (!s)
|
|
2729
2716
|
throw new Error("useLifeDashboard must be used within LifeDashboardProvider");
|
|
2730
|
-
return
|
|
2717
|
+
return s;
|
|
2731
2718
|
}
|
|
2732
2719
|
const v = {
|
|
2733
2720
|
dashboard: {
|
|
@@ -2736,6 +2723,8 @@ const v = {
|
|
|
2736
2723
|
height: "100%",
|
|
2737
2724
|
fontFamily: "'Inter', sans-serif",
|
|
2738
2725
|
backgroundColor: "#f5f7fa",
|
|
2726
|
+
// A fixed light design: its text must not inherit a dark host theme's light colour.
|
|
2727
|
+
color: "#1a202c",
|
|
2739
2728
|
padding: "20px",
|
|
2740
2729
|
gap: "20px",
|
|
2741
2730
|
overflow: "auto"
|
|
@@ -2804,7 +2793,8 @@ const v = {
|
|
|
2804
2793
|
justifyContent: "center"
|
|
2805
2794
|
},
|
|
2806
2795
|
moodEmoji: {
|
|
2807
|
-
fontSize: "
|
|
2796
|
+
fontSize: "20px",
|
|
2797
|
+
fontWeight: 600,
|
|
2808
2798
|
textAlign: "center"
|
|
2809
2799
|
},
|
|
2810
2800
|
insight: {
|
|
@@ -2817,15 +2807,15 @@ const v = {
|
|
|
2817
2807
|
}
|
|
2818
2808
|
};
|
|
2819
2809
|
function Qe({
|
|
2820
|
-
service:
|
|
2810
|
+
service: s,
|
|
2821
2811
|
className: e,
|
|
2822
2812
|
style: t
|
|
2823
2813
|
}) {
|
|
2824
|
-
const [,
|
|
2825
|
-
|
|
2826
|
-
}, []),
|
|
2827
|
-
return /* @__PURE__ */ i(O.Provider, { value:
|
|
2828
|
-
/* @__PURE__ */
|
|
2814
|
+
const [, r] = S(0), n = L(() => {
|
|
2815
|
+
r((f) => f + 1);
|
|
2816
|
+
}, []), o = { service: s, refresh: n }, l = s.generateDailyInsights(), d = s.getAllKPIs(), c = s.getTodayHabitStatus(), g = s.getActiveGoals(), u = s.getFinanceSummary(), p = s.calculateFinanceHealth(), y = (f) => new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(f);
|
|
2817
|
+
return /* @__PURE__ */ i(O.Provider, { value: o, children: /* @__PURE__ */ a("div", { className: e, style: { ...v.dashboard, ...t }, children: [
|
|
2818
|
+
/* @__PURE__ */ a("div", { style: v.header, children: [
|
|
2829
2819
|
/* @__PURE__ */ i("div", { style: v.title, children: "Life Dashboard" }),
|
|
2830
2820
|
/* @__PURE__ */ i("div", { style: { color: "#666" }, children: (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
2831
2821
|
weekday: "long",
|
|
@@ -2835,13 +2825,13 @@ function Qe({
|
|
|
2835
2825
|
}) })
|
|
2836
2826
|
] }),
|
|
2837
2827
|
l.length > 0 && /* @__PURE__ */ i("div", { children: l.map((f, b) => /* @__PURE__ */ i("div", { style: v.insight, children: f }, b)) }),
|
|
2838
|
-
/* @__PURE__ */
|
|
2839
|
-
/* @__PURE__ */
|
|
2828
|
+
/* @__PURE__ */ a("div", { style: v.grid, children: [
|
|
2829
|
+
/* @__PURE__ */ a("div", { style: v.card, children: [
|
|
2840
2830
|
/* @__PURE__ */ i("div", { style: v.cardTitle, children: "Personal KPIs" }),
|
|
2841
2831
|
d.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No KPIs defined yet" }) : d.slice(0, 5).map((f) => {
|
|
2842
|
-
const b =
|
|
2843
|
-
return /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2832
|
+
const b = s.calculateKPIProgress(f);
|
|
2833
|
+
return /* @__PURE__ */ a("div", { style: { marginBottom: "16px" }, children: [
|
|
2834
|
+
/* @__PURE__ */ a(
|
|
2845
2835
|
"div",
|
|
2846
2836
|
{
|
|
2847
2837
|
style: {
|
|
@@ -2851,7 +2841,7 @@ function Qe({
|
|
|
2851
2841
|
},
|
|
2852
2842
|
children: [
|
|
2853
2843
|
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: f.name }),
|
|
2854
|
-
/* @__PURE__ */
|
|
2844
|
+
/* @__PURE__ */ a("span", { style: { color: "#666" }, children: [
|
|
2855
2845
|
f.currentValue,
|
|
2856
2846
|
f.unit ? ` ${f.unit}` : "",
|
|
2857
2847
|
" / ",
|
|
@@ -2875,10 +2865,10 @@ function Qe({
|
|
|
2875
2865
|
] }, f.id);
|
|
2876
2866
|
})
|
|
2877
2867
|
] }),
|
|
2878
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ a("div", { style: v.card, children: [
|
|
2879
2869
|
/* @__PURE__ */ i("div", { style: v.cardTitle, children: "Active Goals" }),
|
|
2880
|
-
g.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No active goals" }) : g.slice(0, 4).map((f) => /* @__PURE__ */
|
|
2881
|
-
/* @__PURE__ */
|
|
2870
|
+
g.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No active goals" }) : g.slice(0, 4).map((f) => /* @__PURE__ */ a("div", { style: { marginBottom: "16px" }, children: [
|
|
2871
|
+
/* @__PURE__ */ a(
|
|
2882
2872
|
"div",
|
|
2883
2873
|
{
|
|
2884
2874
|
style: {
|
|
@@ -2888,7 +2878,7 @@ function Qe({
|
|
|
2888
2878
|
},
|
|
2889
2879
|
children: [
|
|
2890
2880
|
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: f.title }),
|
|
2891
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ a("span", { style: { color: "#666" }, children: [
|
|
2892
2882
|
f.progress,
|
|
2893
2883
|
"%"
|
|
2894
2884
|
] })
|
|
@@ -2905,15 +2895,15 @@ function Qe({
|
|
|
2905
2895
|
}
|
|
2906
2896
|
}
|
|
2907
2897
|
) }),
|
|
2908
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#999", marginTop: "4px" }, children: [
|
|
2909
2899
|
"Due: ",
|
|
2910
2900
|
new Date(f.targetDate).toLocaleDateString()
|
|
2911
2901
|
] })
|
|
2912
2902
|
] }, f.id))
|
|
2913
2903
|
] }),
|
|
2914
|
-
/* @__PURE__ */
|
|
2904
|
+
/* @__PURE__ */ a("div", { style: v.card, children: [
|
|
2915
2905
|
/* @__PURE__ */ i("div", { style: v.cardTitle, children: "Today's Habits" }),
|
|
2916
|
-
c.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No habits tracked yet" }) : c.map(({ habit: f, completed: b, count: D }) => /* @__PURE__ */
|
|
2906
|
+
c.length === 0 ? /* @__PURE__ */ i("div", { style: { color: "#999", textAlign: "center", padding: "20px" }, children: "No habits tracked yet" }) : c.map(({ habit: f, completed: b, count: D }) => /* @__PURE__ */ a("div", { style: v.habitItem, children: [
|
|
2917
2907
|
/* @__PURE__ */ i(
|
|
2918
2908
|
"div",
|
|
2919
2909
|
{
|
|
@@ -2923,14 +2913,27 @@ function Qe({
|
|
|
2923
2913
|
borderColor: b ? "#4caf50" : "#ccc"
|
|
2924
2914
|
},
|
|
2925
2915
|
onClick: () => {
|
|
2926
|
-
|
|
2916
|
+
s.completeHabit(f.id), n();
|
|
2927
2917
|
},
|
|
2928
|
-
children: b && /* @__PURE__ */ i(
|
|
2918
|
+
children: b && /* @__PURE__ */ i(
|
|
2919
|
+
"span",
|
|
2920
|
+
{
|
|
2921
|
+
"aria-label": "Done",
|
|
2922
|
+
style: {
|
|
2923
|
+
width: "6px",
|
|
2924
|
+
height: "11px",
|
|
2925
|
+
marginTop: "-2px",
|
|
2926
|
+
borderRight: "2px solid #fff",
|
|
2927
|
+
borderBottom: "2px solid #fff",
|
|
2928
|
+
transform: "rotate(45deg)"
|
|
2929
|
+
}
|
|
2930
|
+
}
|
|
2931
|
+
)
|
|
2929
2932
|
}
|
|
2930
2933
|
),
|
|
2931
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ a("div", { style: { flex: 1 }, children: [
|
|
2932
2935
|
/* @__PURE__ */ i("div", { style: { fontWeight: 500 }, children: f.name }),
|
|
2933
|
-
/* @__PURE__ */
|
|
2936
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "12px", color: "#666" }, children: [
|
|
2934
2937
|
D,
|
|
2935
2938
|
"/",
|
|
2936
2939
|
f.targetPerPeriod,
|
|
@@ -2941,35 +2944,35 @@ function Qe({
|
|
|
2941
2944
|
] })
|
|
2942
2945
|
] }, f.id))
|
|
2943
2946
|
] }),
|
|
2944
|
-
/* @__PURE__ */
|
|
2947
|
+
/* @__PURE__ */ a("div", { style: v.card, children: [
|
|
2945
2948
|
/* @__PURE__ */ i("div", { style: v.cardTitle, children: "Finance Overview" }),
|
|
2946
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ a("div", { style: v.statRow, children: [
|
|
2947
2950
|
/* @__PURE__ */ i("span", { children: "Net Worth" }),
|
|
2948
2951
|
/* @__PURE__ */ i("span", { style: { fontWeight: 600 }, children: y(u.netWorth) })
|
|
2949
2952
|
] }),
|
|
2950
|
-
/* @__PURE__ */
|
|
2953
|
+
/* @__PURE__ */ a("div", { style: v.statRow, children: [
|
|
2951
2954
|
/* @__PURE__ */ i("span", { children: "Monthly Income" }),
|
|
2952
2955
|
/* @__PURE__ */ i("span", { style: { color: "#4caf50" }, children: y(u.monthlyIncome) })
|
|
2953
2956
|
] }),
|
|
2954
|
-
/* @__PURE__ */
|
|
2957
|
+
/* @__PURE__ */ a("div", { style: v.statRow, children: [
|
|
2955
2958
|
/* @__PURE__ */ i("span", { children: "Monthly Expenses" }),
|
|
2956
2959
|
/* @__PURE__ */ i("span", { style: { color: "#f44336" }, children: y(u.monthlyExpenses) })
|
|
2957
2960
|
] }),
|
|
2958
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ a("div", { style: v.statRow, children: [
|
|
2959
2962
|
/* @__PURE__ */ i("span", { children: "Savings Rate" }),
|
|
2960
|
-
/* @__PURE__ */
|
|
2963
|
+
/* @__PURE__ */ a("span", { children: [
|
|
2961
2964
|
u.savingsRate.toFixed(1),
|
|
2962
2965
|
"%"
|
|
2963
2966
|
] })
|
|
2964
2967
|
] }),
|
|
2965
|
-
/* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
2968
|
+
/* @__PURE__ */ a("div", { style: { marginTop: "16px" }, children: [
|
|
2969
|
+
/* @__PURE__ */ a(
|
|
2967
2970
|
"div",
|
|
2968
2971
|
{
|
|
2969
2972
|
style: { display: "flex", justifyContent: "space-between", marginBottom: "8px" },
|
|
2970
2973
|
children: [
|
|
2971
2974
|
/* @__PURE__ */ i("span", { children: "Finance Health" }),
|
|
2972
|
-
/* @__PURE__ */
|
|
2975
|
+
/* @__PURE__ */ a("span", { style: { fontWeight: 600 }, children: [
|
|
2973
2976
|
p.score,
|
|
2974
2977
|
"/100"
|
|
2975
2978
|
] })
|
|
@@ -2988,24 +2991,24 @@ function Qe({
|
|
|
2988
2991
|
) })
|
|
2989
2992
|
] })
|
|
2990
2993
|
] }),
|
|
2991
|
-
/* @__PURE__ */
|
|
2994
|
+
/* @__PURE__ */ a("div", { style: v.card, children: [
|
|
2992
2995
|
/* @__PURE__ */ i("div", { style: v.cardTitle, children: "Mood & Health" }),
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */ i("div", { style: v.moodEmoji, children: xe(Math.round(
|
|
2996
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", justifyContent: "space-around", marginBottom: "20px" }, children: [
|
|
2997
|
+
/* @__PURE__ */ a("div", { style: { textAlign: "center" }, children: [
|
|
2998
|
+
/* @__PURE__ */ i("div", { style: v.moodEmoji, children: xe(Math.round(s.getAverageMood(7))) }),
|
|
2996
2999
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Avg Mood (7d)" })
|
|
2997
3000
|
] }),
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
3000
|
-
|
|
3001
|
+
/* @__PURE__ */ a("div", { style: { textAlign: "center" }, children: [
|
|
3002
|
+
/* @__PURE__ */ a("div", { style: { fontSize: "28px", fontWeight: 600 }, children: [
|
|
3003
|
+
s.getAverageSleep(7).toFixed(1),
|
|
3001
3004
|
"h"
|
|
3002
3005
|
] }),
|
|
3003
3006
|
/* @__PURE__ */ i("div", { style: { fontSize: "12px", color: "#666" }, children: "Avg Sleep (7d)" })
|
|
3004
3007
|
] })
|
|
3005
3008
|
] }),
|
|
3006
|
-
|
|
3009
|
+
s.getMoodCorrelations().slice(0, 2).map((f) => /* @__PURE__ */ a("div", { style: v.statRow, children: [
|
|
3007
3010
|
/* @__PURE__ */ i("span", { children: f.factor }),
|
|
3008
|
-
/* @__PURE__ */
|
|
3011
|
+
/* @__PURE__ */ a("span", { style: { color: f.correlation > 0 ? "#4caf50" : "#f44336" }, children: [
|
|
3009
3012
|
f.correlation > 0 ? "↑" : "↓",
|
|
3010
3013
|
" ",
|
|
3011
3014
|
Math.abs(f.correlation * 100).toFixed(0),
|
|
@@ -3016,14 +3019,14 @@ function Qe({
|
|
|
3016
3019
|
] })
|
|
3017
3020
|
] }) });
|
|
3018
3021
|
}
|
|
3019
|
-
function xe(
|
|
3022
|
+
function xe(s) {
|
|
3020
3023
|
return {
|
|
3021
|
-
1: "
|
|
3022
|
-
2: "
|
|
3023
|
-
3: "
|
|
3024
|
-
4: "
|
|
3025
|
-
5: "
|
|
3026
|
-
}[
|
|
3024
|
+
1: "Very low",
|
|
3025
|
+
2: "Low",
|
|
3026
|
+
3: "Neutral",
|
|
3027
|
+
4: "Good",
|
|
3028
|
+
5: "Great"
|
|
3029
|
+
}[s] || "Neutral";
|
|
3027
3030
|
}
|
|
3028
3031
|
const be = {
|
|
3029
3032
|
colors: {
|
|
@@ -3058,41 +3061,41 @@ const be = {
|
|
|
3058
3061
|
{ id: "uploadSpeed", label: "Up", width: "100px", sortable: !0, visible: !0 },
|
|
3059
3062
|
{ id: "eta", label: "ETA", width: "100px", sortable: !0, visible: !0 },
|
|
3060
3063
|
{ id: "ratio", label: "Ratio", width: "80px", sortable: !0, visible: !0 }
|
|
3061
|
-
], G =
|
|
3064
|
+
], G = W(null);
|
|
3062
3065
|
function C() {
|
|
3063
|
-
const
|
|
3064
|
-
if (!
|
|
3066
|
+
const s = F(G);
|
|
3067
|
+
if (!s)
|
|
3065
3068
|
throw new Error("useTorrentUI must be used within TorrentUIProvider");
|
|
3066
|
-
return
|
|
3069
|
+
return s;
|
|
3067
3070
|
}
|
|
3068
|
-
function R(
|
|
3069
|
-
if (
|
|
3071
|
+
function R(s, e = 2) {
|
|
3072
|
+
if (s === 0)
|
|
3070
3073
|
return "0 B";
|
|
3071
|
-
const t = 1024,
|
|
3072
|
-
return `${parseFloat((
|
|
3074
|
+
const t = 1024, r = ["B", "KB", "MB", "GB", "TB", "PB"], n = Math.floor(Math.log(s) / Math.log(t));
|
|
3075
|
+
return `${parseFloat((s / Math.pow(t, n)).toFixed(e))} ${r[n]}`;
|
|
3073
3076
|
}
|
|
3074
|
-
function U(
|
|
3075
|
-
return `${R(
|
|
3077
|
+
function U(s) {
|
|
3078
|
+
return `${R(s)}/s`;
|
|
3076
3079
|
}
|
|
3077
|
-
function we(
|
|
3078
|
-
if (!
|
|
3080
|
+
function we(s) {
|
|
3081
|
+
if (!s || s <= 0)
|
|
3079
3082
|
return "∞";
|
|
3080
|
-
if (
|
|
3081
|
-
return `${
|
|
3082
|
-
if (
|
|
3083
|
-
return `${Math.floor(
|
|
3084
|
-
if (
|
|
3085
|
-
const
|
|
3086
|
-
return `${
|
|
3087
|
-
}
|
|
3088
|
-
const e = Math.floor(
|
|
3083
|
+
if (s < 60)
|
|
3084
|
+
return `${s}s`;
|
|
3085
|
+
if (s < 3600)
|
|
3086
|
+
return `${Math.floor(s / 60)}m`;
|
|
3087
|
+
if (s < 86400) {
|
|
3088
|
+
const r = Math.floor(s / 3600), n = Math.floor(s % 3600 / 60);
|
|
3089
|
+
return `${r}h ${n}m`;
|
|
3090
|
+
}
|
|
3091
|
+
const e = Math.floor(s / 86400), t = Math.floor(s % 86400 / 3600);
|
|
3089
3092
|
return `${e}d ${t}h`;
|
|
3090
3093
|
}
|
|
3091
|
-
function q(
|
|
3092
|
-
return
|
|
3094
|
+
function q(s) {
|
|
3095
|
+
return s.toFixed(2);
|
|
3093
3096
|
}
|
|
3094
|
-
function K(
|
|
3095
|
-
switch (
|
|
3097
|
+
function K(s, e) {
|
|
3098
|
+
switch (s) {
|
|
3096
3099
|
case "downloading":
|
|
3097
3100
|
return e.colors.primary;
|
|
3098
3101
|
case "seeding":
|
|
@@ -3110,28 +3113,28 @@ function K(a, e) {
|
|
|
3110
3113
|
}
|
|
3111
3114
|
}
|
|
3112
3115
|
function ke({
|
|
3113
|
-
client:
|
|
3116
|
+
client: s,
|
|
3114
3117
|
config: e = {},
|
|
3115
3118
|
children: t
|
|
3116
3119
|
}) {
|
|
3117
|
-
const
|
|
3120
|
+
const r = z(
|
|
3118
3121
|
() => ({ ...be, ...e.theme }),
|
|
3119
3122
|
[e.theme]
|
|
3120
|
-
), [
|
|
3121
|
-
s
|
|
3122
|
-
}, [
|
|
3123
|
+
), [n, o] = S([]), [l, d] = S(null), [c, g] = S("all"), [u, p] = S(""), y = L(() => {
|
|
3124
|
+
o(s.getAllTorrents());
|
|
3125
|
+
}, [s]);
|
|
3123
3126
|
X(() => {
|
|
3124
3127
|
y();
|
|
3125
3128
|
const b = setInterval(y, e.refreshInterval || 1e3), D = () => y(), M = () => y();
|
|
3126
|
-
return
|
|
3127
|
-
clearInterval(b),
|
|
3129
|
+
return s.on("torrent_added", D), s.on("torrent_removed", M), () => {
|
|
3130
|
+
clearInterval(b), s.off("torrent_added", D), s.off("torrent_removed", M);
|
|
3128
3131
|
};
|
|
3129
|
-
}, [
|
|
3132
|
+
}, [s, e.refreshInterval, y]);
|
|
3130
3133
|
const f = {
|
|
3131
|
-
client:
|
|
3134
|
+
client: s,
|
|
3132
3135
|
config: e,
|
|
3133
|
-
theme:
|
|
3134
|
-
torrents:
|
|
3136
|
+
theme: r,
|
|
3137
|
+
torrents: n,
|
|
3135
3138
|
selectedTorrent: l,
|
|
3136
3139
|
setSelectedTorrent: d,
|
|
3137
3140
|
filter: c,
|
|
@@ -3140,26 +3143,26 @@ function ke({
|
|
|
3140
3143
|
setSearchQuery: p,
|
|
3141
3144
|
refresh: y
|
|
3142
3145
|
};
|
|
3143
|
-
return /* @__PURE__ */ i(G.Provider, { value: f, children: /* @__PURE__ */ i("div", { style: { fontFamily:
|
|
3146
|
+
return /* @__PURE__ */ i(G.Provider, { value: f, children: /* @__PURE__ */ i("div", { style: { fontFamily: r.fontFamily, color: r.colors.text }, children: t }) });
|
|
3144
3147
|
}
|
|
3145
3148
|
function Se({
|
|
3146
|
-
progress:
|
|
3149
|
+
progress: s,
|
|
3147
3150
|
status: e,
|
|
3148
3151
|
showLabel: t = !0,
|
|
3149
|
-
height:
|
|
3150
|
-
className:
|
|
3151
|
-
style:
|
|
3152
|
+
height: r = "20px",
|
|
3153
|
+
className: n,
|
|
3154
|
+
style: o
|
|
3152
3155
|
}) {
|
|
3153
|
-
const { theme: l } = C(), d = Math.min(100, Math.max(0,
|
|
3154
|
-
return /* @__PURE__ */
|
|
3156
|
+
const { theme: l } = C(), d = Math.min(100, Math.max(0, s * 100)), c = K(e, l);
|
|
3157
|
+
return /* @__PURE__ */ a(
|
|
3155
3158
|
"div",
|
|
3156
3159
|
{
|
|
3157
|
-
className:
|
|
3160
|
+
className: n,
|
|
3158
3161
|
style: {
|
|
3159
3162
|
display: "flex",
|
|
3160
3163
|
alignItems: "center",
|
|
3161
3164
|
gap: l.spacing.sm,
|
|
3162
|
-
...
|
|
3165
|
+
...o
|
|
3163
3166
|
},
|
|
3164
3167
|
children: [
|
|
3165
3168
|
/* @__PURE__ */ i(
|
|
@@ -3167,7 +3170,7 @@ function Se({
|
|
|
3167
3170
|
{
|
|
3168
3171
|
style: {
|
|
3169
3172
|
flex: 1,
|
|
3170
|
-
height:
|
|
3173
|
+
height: r,
|
|
3171
3174
|
backgroundColor: l.colors.border,
|
|
3172
3175
|
borderRadius: l.borderRadius,
|
|
3173
3176
|
overflow: "hidden"
|
|
@@ -3185,7 +3188,7 @@ function Se({
|
|
|
3185
3188
|
)
|
|
3186
3189
|
}
|
|
3187
3190
|
),
|
|
3188
|
-
t && /* @__PURE__ */
|
|
3191
|
+
t && /* @__PURE__ */ a("span", { style: { fontSize: "12px", minWidth: "45px", textAlign: "right" }, children: [
|
|
3189
3192
|
d.toFixed(1),
|
|
3190
3193
|
"%"
|
|
3191
3194
|
] })
|
|
@@ -3193,8 +3196,8 @@ function Se({
|
|
|
3193
3196
|
}
|
|
3194
3197
|
);
|
|
3195
3198
|
}
|
|
3196
|
-
function Te({ status:
|
|
3197
|
-
const { theme:
|
|
3199
|
+
function Te({ status: s, className: e, style: t }) {
|
|
3200
|
+
const { theme: r } = C(), n = K(s, r), o = {
|
|
3198
3201
|
downloading: "Downloading",
|
|
3199
3202
|
seeding: "Seeding",
|
|
3200
3203
|
paused: "Paused",
|
|
@@ -3202,18 +3205,18 @@ function Te({ status: a, className: e, style: t }) {
|
|
|
3202
3205
|
error: "Error",
|
|
3203
3206
|
queued: "Queued"
|
|
3204
3207
|
};
|
|
3205
|
-
return /* @__PURE__ */
|
|
3208
|
+
return /* @__PURE__ */ a(
|
|
3206
3209
|
"span",
|
|
3207
3210
|
{
|
|
3208
3211
|
className: e,
|
|
3209
3212
|
style: {
|
|
3210
3213
|
display: "inline-flex",
|
|
3211
3214
|
alignItems: "center",
|
|
3212
|
-
gap:
|
|
3213
|
-
padding: `${
|
|
3214
|
-
backgroundColor: `${
|
|
3215
|
-
color:
|
|
3216
|
-
borderRadius:
|
|
3215
|
+
gap: r.spacing.xs,
|
|
3216
|
+
padding: `${r.spacing.xs} ${r.spacing.sm}`,
|
|
3217
|
+
backgroundColor: `${n}20`,
|
|
3218
|
+
color: n,
|
|
3219
|
+
borderRadius: r.borderRadius,
|
|
3217
3220
|
fontSize: "12px",
|
|
3218
3221
|
fontWeight: 500,
|
|
3219
3222
|
textTransform: "capitalize",
|
|
@@ -3227,22 +3230,22 @@ function Te({ status: a, className: e, style: t }) {
|
|
|
3227
3230
|
width: "8px",
|
|
3228
3231
|
height: "8px",
|
|
3229
3232
|
borderRadius: "50%",
|
|
3230
|
-
backgroundColor:
|
|
3233
|
+
backgroundColor: n
|
|
3231
3234
|
}
|
|
3232
3235
|
}
|
|
3233
3236
|
),
|
|
3234
|
-
s
|
|
3237
|
+
o[s]
|
|
3235
3238
|
]
|
|
3236
3239
|
}
|
|
3237
3240
|
);
|
|
3238
3241
|
}
|
|
3239
3242
|
function De({
|
|
3240
|
-
onTorrentSelect:
|
|
3243
|
+
onTorrentSelect: s,
|
|
3241
3244
|
onTorrentDoubleClick: e,
|
|
3242
3245
|
className: t,
|
|
3243
|
-
style:
|
|
3246
|
+
style: r
|
|
3244
3247
|
}) {
|
|
3245
|
-
const { theme:
|
|
3248
|
+
const { theme: n, torrents: o, filter: l, searchQuery: d, selectedTorrent: c, setSelectedTorrent: g, config: u } = C(), [p, y] = S(u.defaultSortBy || "name"), [f, b] = S(u.defaultSortOrder || "asc"), D = u.columns || ve, M = z(() => o.filter((x) => {
|
|
3246
3249
|
if (l !== "all") {
|
|
3247
3250
|
if (l === "completed") {
|
|
3248
3251
|
if (x.stats.progress < 1)
|
|
@@ -3259,7 +3262,7 @@ function De({
|
|
|
3259
3262
|
return !1;
|
|
3260
3263
|
}
|
|
3261
3264
|
return !0;
|
|
3262
|
-
}), [
|
|
3265
|
+
}), [o, l, d]), T = z(() => [...M].sort((x, A) => {
|
|
3263
3266
|
let I, B;
|
|
3264
3267
|
switch (p) {
|
|
3265
3268
|
case "name":
|
|
@@ -3290,17 +3293,17 @@ function De({
|
|
|
3290
3293
|
}), [M, p, f]), P = (x) => {
|
|
3291
3294
|
p === x ? b(f === "asc" ? "desc" : "asc") : (y(x), b("asc"));
|
|
3292
3295
|
}, Q = (x) => {
|
|
3293
|
-
g(x),
|
|
3296
|
+
g(x), s == null || s(x);
|
|
3294
3297
|
};
|
|
3295
|
-
return /* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ a(
|
|
3296
3299
|
"div",
|
|
3297
3300
|
{
|
|
3298
3301
|
className: t,
|
|
3299
3302
|
style: {
|
|
3300
|
-
backgroundColor:
|
|
3301
|
-
borderRadius:
|
|
3303
|
+
backgroundColor: n.colors.surface,
|
|
3304
|
+
borderRadius: n.borderRadius,
|
|
3302
3305
|
overflow: "hidden",
|
|
3303
|
-
...
|
|
3306
|
+
...r
|
|
3304
3307
|
},
|
|
3305
3308
|
children: [
|
|
3306
3309
|
/* @__PURE__ */ i(
|
|
@@ -3309,14 +3312,14 @@ function De({
|
|
|
3309
3312
|
style: {
|
|
3310
3313
|
display: "grid",
|
|
3311
3314
|
gridTemplateColumns: D.filter((x) => x.visible !== !1).map((x) => x.width || "1fr").join(" "),
|
|
3312
|
-
padding: `${
|
|
3313
|
-
backgroundColor:
|
|
3314
|
-
borderBottom: `1px solid ${
|
|
3315
|
+
padding: `${n.spacing.sm} ${n.spacing.md}`,
|
|
3316
|
+
backgroundColor: n.colors.primary,
|
|
3317
|
+
borderBottom: `1px solid ${n.colors.border}`,
|
|
3315
3318
|
fontSize: "12px",
|
|
3316
3319
|
fontWeight: 600,
|
|
3317
3320
|
textTransform: "uppercase"
|
|
3318
3321
|
},
|
|
3319
|
-
children: D.filter((x) => x.visible !== !1).map((x) => /* @__PURE__ */
|
|
3322
|
+
children: D.filter((x) => x.visible !== !1).map((x) => /* @__PURE__ */ a(
|
|
3320
3323
|
"div",
|
|
3321
3324
|
{
|
|
3322
3325
|
onClick: () => x.sortable && P(x.id),
|
|
@@ -3324,7 +3327,7 @@ function De({
|
|
|
3324
3327
|
cursor: x.sortable ? "pointer" : "default",
|
|
3325
3328
|
display: "flex",
|
|
3326
3329
|
alignItems: "center",
|
|
3327
|
-
gap:
|
|
3330
|
+
gap: n.spacing.xs
|
|
3328
3331
|
},
|
|
3329
3332
|
children: [
|
|
3330
3333
|
x.label,
|
|
@@ -3339,9 +3342,9 @@ function De({
|
|
|
3339
3342
|
"div",
|
|
3340
3343
|
{
|
|
3341
3344
|
style: {
|
|
3342
|
-
padding:
|
|
3345
|
+
padding: n.spacing.xl,
|
|
3343
3346
|
textAlign: "center",
|
|
3344
|
-
color:
|
|
3347
|
+
color: n.colors.textSecondary
|
|
3345
3348
|
},
|
|
3346
3349
|
children: "No torrents found"
|
|
3347
3350
|
}
|
|
@@ -3361,18 +3364,18 @@ function De({
|
|
|
3361
3364
|
);
|
|
3362
3365
|
}
|
|
3363
3366
|
function Ce({
|
|
3364
|
-
torrent:
|
|
3367
|
+
torrent: s,
|
|
3365
3368
|
columns: e,
|
|
3366
3369
|
isSelected: t,
|
|
3367
|
-
onClick:
|
|
3368
|
-
onDoubleClick:
|
|
3370
|
+
onClick: r,
|
|
3371
|
+
onDoubleClick: n
|
|
3369
3372
|
}) {
|
|
3370
|
-
const { theme:
|
|
3373
|
+
const { theme: o } = C(), { metadata: l, stats: d, status: c } = s, g = (u) => {
|
|
3371
3374
|
switch (u) {
|
|
3372
3375
|
case "name":
|
|
3373
|
-
return /* @__PURE__ */
|
|
3376
|
+
return /* @__PURE__ */ a("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
3374
3377
|
/* @__PURE__ */ i("span", { style: { fontWeight: 500 }, children: l.name }),
|
|
3375
|
-
/* @__PURE__ */
|
|
3378
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "11px", color: o.colors.textSecondary }, children: [
|
|
3376
3379
|
l.infoHash.substring(0, 8),
|
|
3377
3380
|
"..."
|
|
3378
3381
|
] })
|
|
@@ -3402,14 +3405,14 @@ function Ce({
|
|
|
3402
3405
|
return /* @__PURE__ */ i(
|
|
3403
3406
|
"div",
|
|
3404
3407
|
{
|
|
3405
|
-
onClick:
|
|
3406
|
-
onDoubleClick:
|
|
3408
|
+
onClick: r,
|
|
3409
|
+
onDoubleClick: n,
|
|
3407
3410
|
style: {
|
|
3408
3411
|
display: "grid",
|
|
3409
3412
|
gridTemplateColumns: e.filter((u) => u.visible !== !1).map((u) => u.width || "1fr").join(" "),
|
|
3410
|
-
padding: `${
|
|
3411
|
-
backgroundColor: t ?
|
|
3412
|
-
borderBottom: `1px solid ${
|
|
3413
|
+
padding: `${o.spacing.sm} ${o.spacing.md}`,
|
|
3414
|
+
backgroundColor: t ? o.colors.primary : "transparent",
|
|
3415
|
+
borderBottom: `1px solid ${o.colors.border}`,
|
|
3413
3416
|
cursor: "pointer",
|
|
3414
3417
|
transition: "background-color 0.15s",
|
|
3415
3418
|
fontSize: "13px"
|
|
@@ -3431,8 +3434,8 @@ function Ce({
|
|
|
3431
3434
|
}
|
|
3432
3435
|
);
|
|
3433
3436
|
}
|
|
3434
|
-
function Ae({ className:
|
|
3435
|
-
const { theme: t, filter:
|
|
3437
|
+
function Ae({ className: s, style: e }) {
|
|
3438
|
+
const { theme: t, filter: r, setFilter: n, searchQuery: o, setSearchQuery: l, torrents: d } = C(), c = z(() => {
|
|
3436
3439
|
const u = {
|
|
3437
3440
|
all: d.length,
|
|
3438
3441
|
downloading: 0,
|
|
@@ -3455,10 +3458,10 @@ function Ae({ className: a, style: e }) {
|
|
|
3455
3458
|
{ id: "paused", label: "Paused" },
|
|
3456
3459
|
{ id: "error", label: "Error" }
|
|
3457
3460
|
];
|
|
3458
|
-
return /* @__PURE__ */
|
|
3461
|
+
return /* @__PURE__ */ a(
|
|
3459
3462
|
"div",
|
|
3460
3463
|
{
|
|
3461
|
-
className:
|
|
3464
|
+
className: s,
|
|
3462
3465
|
style: {
|
|
3463
3466
|
display: "flex",
|
|
3464
3467
|
alignItems: "center",
|
|
@@ -3469,14 +3472,14 @@ function Ae({ className: a, style: e }) {
|
|
|
3469
3472
|
...e
|
|
3470
3473
|
},
|
|
3471
3474
|
children: [
|
|
3472
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", gap: t.spacing.xs }, children: g.map((u) => /* @__PURE__ */
|
|
3475
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", gap: t.spacing.xs }, children: g.map((u) => /* @__PURE__ */ a(
|
|
3473
3476
|
"button",
|
|
3474
3477
|
{
|
|
3475
|
-
onClick: () =>
|
|
3478
|
+
onClick: () => n(u.id),
|
|
3476
3479
|
style: {
|
|
3477
3480
|
padding: `${t.spacing.xs} ${t.spacing.sm}`,
|
|
3478
|
-
backgroundColor:
|
|
3479
|
-
color:
|
|
3481
|
+
backgroundColor: r === u.id ? t.colors.primary : "transparent",
|
|
3482
|
+
color: r === u.id ? t.colors.text : t.colors.textSecondary,
|
|
3480
3483
|
border: "none",
|
|
3481
3484
|
borderRadius: t.borderRadius,
|
|
3482
3485
|
cursor: "pointer",
|
|
@@ -3498,7 +3501,7 @@ function Ae({ className: a, style: e }) {
|
|
|
3498
3501
|
{
|
|
3499
3502
|
type: "text",
|
|
3500
3503
|
placeholder: "Search torrents...",
|
|
3501
|
-
value:
|
|
3504
|
+
value: o,
|
|
3502
3505
|
onChange: (u) => l(u.target.value),
|
|
3503
3506
|
style: {
|
|
3504
3507
|
padding: `${t.spacing.sm} ${t.spacing.md}`,
|
|
@@ -3517,11 +3520,11 @@ function Ae({ className: a, style: e }) {
|
|
|
3517
3520
|
);
|
|
3518
3521
|
}
|
|
3519
3522
|
function Ie({
|
|
3520
|
-
infoHash:
|
|
3523
|
+
infoHash: s,
|
|
3521
3524
|
className: e,
|
|
3522
3525
|
style: t
|
|
3523
3526
|
}) {
|
|
3524
|
-
const { theme:
|
|
3527
|
+
const { theme: r, client: n } = C(), [o, l] = S("files"), d = n == null ? void 0 : n.getTorrent(s);
|
|
3525
3528
|
if (!d)
|
|
3526
3529
|
return null;
|
|
3527
3530
|
const { metadata: c, stats: g, files: u, peers: p, trackers: y } = d, f = [
|
|
@@ -3530,13 +3533,13 @@ function Ie({
|
|
|
3530
3533
|
{ id: "trackers", label: `Trackers (${y.length})` },
|
|
3531
3534
|
{ id: "info", label: "Info" }
|
|
3532
3535
|
];
|
|
3533
|
-
return /* @__PURE__ */
|
|
3536
|
+
return /* @__PURE__ */ a(
|
|
3534
3537
|
"div",
|
|
3535
3538
|
{
|
|
3536
3539
|
className: e,
|
|
3537
3540
|
style: {
|
|
3538
|
-
backgroundColor:
|
|
3539
|
-
borderRadius:
|
|
3541
|
+
backgroundColor: r.colors.surface,
|
|
3542
|
+
borderRadius: r.borderRadius,
|
|
3540
3543
|
overflow: "hidden",
|
|
3541
3544
|
...t
|
|
3542
3545
|
},
|
|
@@ -3546,16 +3549,16 @@ function Ie({
|
|
|
3546
3549
|
{
|
|
3547
3550
|
style: {
|
|
3548
3551
|
display: "flex",
|
|
3549
|
-
borderBottom: `1px solid ${
|
|
3552
|
+
borderBottom: `1px solid ${r.colors.border}`
|
|
3550
3553
|
},
|
|
3551
3554
|
children: f.map((b) => /* @__PURE__ */ i(
|
|
3552
3555
|
"button",
|
|
3553
3556
|
{
|
|
3554
3557
|
onClick: () => l(b.id),
|
|
3555
3558
|
style: {
|
|
3556
|
-
padding: `${
|
|
3557
|
-
backgroundColor:
|
|
3558
|
-
color:
|
|
3559
|
+
padding: `${r.spacing.sm} ${r.spacing.md}`,
|
|
3560
|
+
backgroundColor: o === b.id ? r.colors.primary : "transparent",
|
|
3561
|
+
color: o === b.id ? r.colors.text : r.colors.textSecondary,
|
|
3559
3562
|
border: "none",
|
|
3560
3563
|
cursor: "pointer",
|
|
3561
3564
|
fontSize: "13px",
|
|
@@ -3567,19 +3570,19 @@ function Ie({
|
|
|
3567
3570
|
))
|
|
3568
3571
|
}
|
|
3569
3572
|
),
|
|
3570
|
-
/* @__PURE__ */
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3573
|
+
/* @__PURE__ */ a("div", { style: { padding: r.spacing.md, maxHeight: "300px", overflowY: "auto" }, children: [
|
|
3574
|
+
o === "files" && /* @__PURE__ */ i(Be, { files: u }),
|
|
3575
|
+
o === "peers" && /* @__PURE__ */ i(Me, { peers: p }),
|
|
3576
|
+
o === "trackers" && /* @__PURE__ */ i(Re, { trackers: y }),
|
|
3577
|
+
o === "info" && /* @__PURE__ */ i(Pe, { metadata: c, stats: g, addedAt: d.addedAt })
|
|
3575
3578
|
] })
|
|
3576
3579
|
]
|
|
3577
3580
|
}
|
|
3578
3581
|
);
|
|
3579
3582
|
}
|
|
3580
|
-
function Be({ files:
|
|
3583
|
+
function Be({ files: s }) {
|
|
3581
3584
|
const { theme: e } = C();
|
|
3582
|
-
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children:
|
|
3585
|
+
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, r) => /* @__PURE__ */ a(
|
|
3583
3586
|
"div",
|
|
3584
3587
|
{
|
|
3585
3588
|
style: {
|
|
@@ -3594,18 +3597,18 @@ function Be({ files: a }) {
|
|
|
3594
3597
|
children: [
|
|
3595
3598
|
/* @__PURE__ */ i("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.path }),
|
|
3596
3599
|
/* @__PURE__ */ i("span", { style: { color: e.colors.textSecondary }, children: R(t.size) }),
|
|
3597
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ a("span", { style: { width: "50px", textAlign: "right" }, children: [
|
|
3598
3601
|
(t.progress * 100).toFixed(0),
|
|
3599
3602
|
"%"
|
|
3600
3603
|
] })
|
|
3601
3604
|
]
|
|
3602
3605
|
},
|
|
3603
|
-
|
|
3606
|
+
r
|
|
3604
3607
|
)) });
|
|
3605
3608
|
}
|
|
3606
|
-
function Me({ peers:
|
|
3609
|
+
function Me({ peers: s }) {
|
|
3607
3610
|
const { theme: e } = C();
|
|
3608
|
-
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children:
|
|
3611
|
+
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.length === 0 ? /* @__PURE__ */ i("div", { style: { color: e.colors.textSecondary }, children: "No peers connected" }) : s.map((t) => /* @__PURE__ */ a(
|
|
3609
3612
|
"div",
|
|
3610
3613
|
{
|
|
3611
3614
|
style: {
|
|
@@ -3618,23 +3621,23 @@ function Me({ peers: a }) {
|
|
|
3618
3621
|
fontSize: "12px"
|
|
3619
3622
|
},
|
|
3620
3623
|
children: [
|
|
3621
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ a("span", { children: [
|
|
3622
3625
|
t.ip,
|
|
3623
3626
|
":",
|
|
3624
3627
|
t.port,
|
|
3625
3628
|
t.isUTP && /* @__PURE__ */ i("span", { style: { marginLeft: "4px", color: e.colors.secondary }, children: "µTP" }),
|
|
3626
|
-
t.isEncrypted && /* @__PURE__ */ i("span", { style: { marginLeft: "4px" }, children: "
|
|
3629
|
+
t.isEncrypted && /* @__PURE__ */ i("span", { style: { marginLeft: "4px", color: e.colors.secondary }, children: "enc" })
|
|
3627
3630
|
] }),
|
|
3628
3631
|
/* @__PURE__ */ i("span", { style: { color: e.colors.textSecondary }, children: t.client || "Unknown" }),
|
|
3629
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ a("span", { style: { color: e.colors.success }, children: [
|
|
3630
3633
|
"↓ ",
|
|
3631
3634
|
U(t.downloadSpeed)
|
|
3632
3635
|
] }),
|
|
3633
|
-
/* @__PURE__ */
|
|
3636
|
+
/* @__PURE__ */ a("span", { style: { color: e.colors.warning }, children: [
|
|
3634
3637
|
"↑ ",
|
|
3635
3638
|
U(t.uploadSpeed)
|
|
3636
3639
|
] }),
|
|
3637
|
-
/* @__PURE__ */
|
|
3640
|
+
/* @__PURE__ */ a("span", { children: [
|
|
3638
3641
|
(t.progress * 100).toFixed(0),
|
|
3639
3642
|
"%"
|
|
3640
3643
|
] })
|
|
@@ -3643,9 +3646,9 @@ function Me({ peers: a }) {
|
|
|
3643
3646
|
t.id
|
|
3644
3647
|
)) });
|
|
3645
3648
|
}
|
|
3646
|
-
function Re({ trackers:
|
|
3649
|
+
function Re({ trackers: s }) {
|
|
3647
3650
|
const { theme: e } = C();
|
|
3648
|
-
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children:
|
|
3651
|
+
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: e.spacing.xs }, children: s.map((t, r) => /* @__PURE__ */ a(
|
|
3649
3652
|
"div",
|
|
3650
3653
|
{
|
|
3651
3654
|
style: {
|
|
@@ -3670,7 +3673,7 @@ function Re({ trackers: a }) {
|
|
|
3670
3673
|
}
|
|
3671
3674
|
),
|
|
3672
3675
|
/* @__PURE__ */ i("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: t.url }),
|
|
3673
|
-
/* @__PURE__ */
|
|
3676
|
+
/* @__PURE__ */ a("span", { style: { color: e.colors.textSecondary }, children: [
|
|
3674
3677
|
"S: ",
|
|
3675
3678
|
t.seeds,
|
|
3676
3679
|
" | L: ",
|
|
@@ -3678,18 +3681,18 @@ function Re({ trackers: a }) {
|
|
|
3678
3681
|
] })
|
|
3679
3682
|
]
|
|
3680
3683
|
},
|
|
3681
|
-
|
|
3684
|
+
r
|
|
3682
3685
|
)) });
|
|
3683
3686
|
}
|
|
3684
3687
|
function Pe({
|
|
3685
|
-
metadata:
|
|
3688
|
+
metadata: s,
|
|
3686
3689
|
stats: e,
|
|
3687
3690
|
addedAt: t
|
|
3688
3691
|
}) {
|
|
3689
|
-
const { theme:
|
|
3690
|
-
{ label: "Name", value:
|
|
3691
|
-
{ label: "Info Hash", value:
|
|
3692
|
-
{ label: "Size", value: R(
|
|
3692
|
+
const { theme: r } = C(), n = [
|
|
3693
|
+
{ label: "Name", value: s.name },
|
|
3694
|
+
{ label: "Info Hash", value: s.infoHash },
|
|
3695
|
+
{ label: "Size", value: R(s.size) },
|
|
3693
3696
|
{ label: "Pieces", value: `${e.piecesComplete} / ${e.piecesTotal}` },
|
|
3694
3697
|
{ label: "Downloads", value: R(e.downloaded) },
|
|
3695
3698
|
{ label: "Uploaded", value: R(e.uploaded) },
|
|
@@ -3698,34 +3701,34 @@ function Pe({
|
|
|
3698
3701
|
{ label: "Wasted", value: R(e.wastedBytes) },
|
|
3699
3702
|
{ label: "Hash Fails", value: e.hashFailures },
|
|
3700
3703
|
{ label: "Added", value: t.toLocaleString() },
|
|
3701
|
-
{ label: "Comment", value:
|
|
3702
|
-
{ label: "Private", value:
|
|
3704
|
+
{ label: "Comment", value: s.comment || "-" },
|
|
3705
|
+
{ label: "Private", value: s.isPrivate ? "Yes" : "No" }
|
|
3703
3706
|
];
|
|
3704
|
-
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap:
|
|
3707
|
+
return /* @__PURE__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: r.spacing.xs }, children: n.map((o) => /* @__PURE__ */ a(
|
|
3705
3708
|
"div",
|
|
3706
3709
|
{
|
|
3707
3710
|
style: {
|
|
3708
3711
|
display: "flex",
|
|
3709
3712
|
justifyContent: "space-between",
|
|
3710
|
-
padding: `${
|
|
3713
|
+
padding: `${r.spacing.xs} ${r.spacing.sm}`,
|
|
3711
3714
|
fontSize: "13px"
|
|
3712
3715
|
},
|
|
3713
3716
|
children: [
|
|
3714
|
-
/* @__PURE__ */ i("span", { style: { color:
|
|
3715
|
-
/* @__PURE__ */ i("span", { style: { fontFamily: "monospace" }, children:
|
|
3717
|
+
/* @__PURE__ */ i("span", { style: { color: r.colors.textSecondary }, children: o.label }),
|
|
3718
|
+
/* @__PURE__ */ i("span", { style: { fontFamily: "monospace" }, children: o.value })
|
|
3716
3719
|
]
|
|
3717
3720
|
},
|
|
3718
|
-
|
|
3721
|
+
o.label
|
|
3719
3722
|
)) });
|
|
3720
3723
|
}
|
|
3721
3724
|
function ze({
|
|
3722
|
-
isOpen:
|
|
3725
|
+
isOpen: s,
|
|
3723
3726
|
onClose: e,
|
|
3724
3727
|
onAdd: t,
|
|
3725
|
-
className:
|
|
3728
|
+
className: r
|
|
3726
3729
|
}) {
|
|
3727
|
-
const { theme:
|
|
3728
|
-
if (!
|
|
3730
|
+
const { theme: n, config: o, client: l } = C(), [d, c] = S(""), [g, u] = S(""), [p, y] = S(!1);
|
|
3731
|
+
if (!s)
|
|
3729
3732
|
return null;
|
|
3730
3733
|
const f = (b) => {
|
|
3731
3734
|
b.preventDefault(), d.trim() && (t(d.trim(), { path: g || void 0, paused: p }), c(""), u(""), y(!1), e());
|
|
@@ -3733,7 +3736,7 @@ function ze({
|
|
|
3733
3736
|
return /* @__PURE__ */ i(
|
|
3734
3737
|
"div",
|
|
3735
3738
|
{
|
|
3736
|
-
className:
|
|
3739
|
+
className: r,
|
|
3737
3740
|
style: {
|
|
3738
3741
|
position: "fixed",
|
|
3739
3742
|
inset: 0,
|
|
@@ -3744,27 +3747,27 @@ function ze({
|
|
|
3744
3747
|
zIndex: 1e3
|
|
3745
3748
|
},
|
|
3746
3749
|
onClick: e,
|
|
3747
|
-
children: /* @__PURE__ */
|
|
3750
|
+
children: /* @__PURE__ */ a(
|
|
3748
3751
|
"div",
|
|
3749
3752
|
{
|
|
3750
3753
|
style: {
|
|
3751
|
-
backgroundColor:
|
|
3752
|
-
borderRadius:
|
|
3753
|
-
padding:
|
|
3754
|
+
backgroundColor: n.colors.surface,
|
|
3755
|
+
borderRadius: n.borderRadius,
|
|
3756
|
+
padding: n.spacing.lg,
|
|
3754
3757
|
width: "500px",
|
|
3755
3758
|
maxWidth: "90vw"
|
|
3756
3759
|
},
|
|
3757
3760
|
onClick: (b) => b.stopPropagation(),
|
|
3758
3761
|
children: [
|
|
3759
|
-
/* @__PURE__ */ i("h2", { style: { margin: 0, marginBottom:
|
|
3760
|
-
/* @__PURE__ */
|
|
3762
|
+
/* @__PURE__ */ i("h2", { style: { margin: 0, marginBottom: n.spacing.md }, children: "Add Torrent" }),
|
|
3763
|
+
/* @__PURE__ */ a(
|
|
3761
3764
|
"form",
|
|
3762
3765
|
{
|
|
3763
3766
|
onSubmit: f,
|
|
3764
|
-
style: { display: "flex", flexDirection: "column", gap:
|
|
3767
|
+
style: { display: "flex", flexDirection: "column", gap: n.spacing.md },
|
|
3765
3768
|
children: [
|
|
3766
|
-
/* @__PURE__ */
|
|
3767
|
-
/* @__PURE__ */ i("label", { style: { display: "block", marginBottom:
|
|
3769
|
+
/* @__PURE__ */ a("div", { children: [
|
|
3770
|
+
/* @__PURE__ */ i("label", { style: { display: "block", marginBottom: n.spacing.xs, fontSize: "13px" }, children: "Magnet URI or .torrent file path" }),
|
|
3768
3771
|
/* @__PURE__ */ i(
|
|
3769
3772
|
"input",
|
|
3770
3773
|
{
|
|
@@ -3774,19 +3777,19 @@ function ze({
|
|
|
3774
3777
|
placeholder: "magnet:?xt=urn:btih:... or C:\\path\\to\\file.torrent",
|
|
3775
3778
|
style: {
|
|
3776
3779
|
width: "100%",
|
|
3777
|
-
padding:
|
|
3778
|
-
backgroundColor:
|
|
3779
|
-
color:
|
|
3780
|
-
border: `1px solid ${
|
|
3781
|
-
borderRadius:
|
|
3780
|
+
padding: n.spacing.sm,
|
|
3781
|
+
backgroundColor: n.colors.background,
|
|
3782
|
+
color: n.colors.text,
|
|
3783
|
+
border: `1px solid ${n.colors.border}`,
|
|
3784
|
+
borderRadius: n.borderRadius,
|
|
3782
3785
|
outline: "none",
|
|
3783
3786
|
fontSize: "13px"
|
|
3784
3787
|
}
|
|
3785
3788
|
}
|
|
3786
3789
|
)
|
|
3787
3790
|
] }),
|
|
3788
|
-
/* @__PURE__ */
|
|
3789
|
-
/* @__PURE__ */ i("label", { style: { display: "block", marginBottom:
|
|
3791
|
+
/* @__PURE__ */ a("div", { children: [
|
|
3792
|
+
/* @__PURE__ */ i("label", { style: { display: "block", marginBottom: n.spacing.xs, fontSize: "13px" }, children: "Save Location" }),
|
|
3790
3793
|
/* @__PURE__ */ i(
|
|
3791
3794
|
"input",
|
|
3792
3795
|
{
|
|
@@ -3796,24 +3799,24 @@ function ze({
|
|
|
3796
3799
|
placeholder: "Leave empty for default",
|
|
3797
3800
|
style: {
|
|
3798
3801
|
width: "100%",
|
|
3799
|
-
padding:
|
|
3800
|
-
backgroundColor:
|
|
3801
|
-
color:
|
|
3802
|
-
border: `1px solid ${
|
|
3803
|
-
borderRadius:
|
|
3802
|
+
padding: n.spacing.sm,
|
|
3803
|
+
backgroundColor: n.colors.background,
|
|
3804
|
+
color: n.colors.text,
|
|
3805
|
+
border: `1px solid ${n.colors.border}`,
|
|
3806
|
+
borderRadius: n.borderRadius,
|
|
3804
3807
|
outline: "none",
|
|
3805
3808
|
fontSize: "13px"
|
|
3806
3809
|
}
|
|
3807
3810
|
}
|
|
3808
3811
|
)
|
|
3809
3812
|
] }),
|
|
3810
|
-
/* @__PURE__ */
|
|
3813
|
+
/* @__PURE__ */ a(
|
|
3811
3814
|
"label",
|
|
3812
3815
|
{
|
|
3813
3816
|
style: {
|
|
3814
3817
|
display: "flex",
|
|
3815
3818
|
alignItems: "center",
|
|
3816
|
-
gap:
|
|
3819
|
+
gap: n.spacing.sm,
|
|
3817
3820
|
fontSize: "13px"
|
|
3818
3821
|
},
|
|
3819
3822
|
children: [
|
|
@@ -3829,18 +3832,18 @@ function ze({
|
|
|
3829
3832
|
]
|
|
3830
3833
|
}
|
|
3831
3834
|
),
|
|
3832
|
-
/* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: n.spacing.sm, justifyContent: "flex-end" }, children: [
|
|
3833
3836
|
/* @__PURE__ */ i(
|
|
3834
3837
|
"button",
|
|
3835
3838
|
{
|
|
3836
3839
|
type: "button",
|
|
3837
3840
|
onClick: e,
|
|
3838
3841
|
style: {
|
|
3839
|
-
padding: `${
|
|
3842
|
+
padding: `${n.spacing.sm} ${n.spacing.md}`,
|
|
3840
3843
|
backgroundColor: "transparent",
|
|
3841
|
-
color:
|
|
3842
|
-
border: `1px solid ${
|
|
3843
|
-
borderRadius:
|
|
3844
|
+
color: n.colors.text,
|
|
3845
|
+
border: `1px solid ${n.colors.border}`,
|
|
3846
|
+
borderRadius: n.borderRadius,
|
|
3844
3847
|
cursor: "pointer"
|
|
3845
3848
|
},
|
|
3846
3849
|
children: "Cancel"
|
|
@@ -3851,11 +3854,11 @@ function ze({
|
|
|
3851
3854
|
{
|
|
3852
3855
|
type: "submit",
|
|
3853
3856
|
style: {
|
|
3854
|
-
padding: `${
|
|
3855
|
-
backgroundColor:
|
|
3856
|
-
color:
|
|
3857
|
+
padding: `${n.spacing.sm} ${n.spacing.md}`,
|
|
3858
|
+
backgroundColor: n.colors.primary,
|
|
3859
|
+
color: n.colors.text,
|
|
3857
3860
|
border: "none",
|
|
3858
|
-
borderRadius:
|
|
3861
|
+
borderRadius: n.borderRadius,
|
|
3859
3862
|
cursor: "pointer"
|
|
3860
3863
|
},
|
|
3861
3864
|
children: "Add Torrent"
|
|
@@ -3872,13 +3875,13 @@ function ze({
|
|
|
3872
3875
|
);
|
|
3873
3876
|
}
|
|
3874
3877
|
function Ye({
|
|
3875
|
-
client:
|
|
3878
|
+
client: s,
|
|
3876
3879
|
config: e,
|
|
3877
3880
|
className: t,
|
|
3878
|
-
style:
|
|
3881
|
+
style: r
|
|
3879
3882
|
}) {
|
|
3880
|
-
const [
|
|
3881
|
-
return /* @__PURE__ */ i(ke, { client:
|
|
3883
|
+
const [n, o] = S(!1), [l, d] = S(null);
|
|
3884
|
+
return /* @__PURE__ */ i(ke, { client: s, config: e, children: /* @__PURE__ */ a(
|
|
3882
3885
|
"div",
|
|
3883
3886
|
{
|
|
3884
3887
|
className: t,
|
|
@@ -3887,13 +3890,13 @@ function Ye({
|
|
|
3887
3890
|
flexDirection: "column",
|
|
3888
3891
|
gap: "16px",
|
|
3889
3892
|
height: "100%",
|
|
3890
|
-
...
|
|
3893
|
+
...r
|
|
3891
3894
|
},
|
|
3892
3895
|
children: [
|
|
3893
3896
|
/* @__PURE__ */ i("div", { style: { display: "flex", gap: "8px" }, children: /* @__PURE__ */ i(
|
|
3894
3897
|
"button",
|
|
3895
3898
|
{
|
|
3896
|
-
onClick: () =>
|
|
3899
|
+
onClick: () => o(!0),
|
|
3897
3900
|
style: {
|
|
3898
3901
|
padding: "8px 16px",
|
|
3899
3902
|
backgroundColor: "#0f3460",
|
|
@@ -3911,9 +3914,9 @@ function Ye({
|
|
|
3911
3914
|
/* @__PURE__ */ i(
|
|
3912
3915
|
ze,
|
|
3913
3916
|
{
|
|
3914
|
-
isOpen:
|
|
3915
|
-
onClose: () =>
|
|
3916
|
-
onAdd: (c, g) =>
|
|
3917
|
+
isOpen: n,
|
|
3918
|
+
onClose: () => o(!1),
|
|
3919
|
+
onAdd: (c, g) => s.addTorrent(c, g)
|
|
3917
3920
|
}
|
|
3918
3921
|
)
|
|
3919
3922
|
]
|
|
@@ -3939,16 +3942,16 @@ export {
|
|
|
3939
3942
|
ke as TorrentUIProvider,
|
|
3940
3943
|
Ue as createHealthService,
|
|
3941
3944
|
qe as createLifeDashboardService,
|
|
3942
|
-
|
|
3945
|
+
$e as createPersonalFinanceService,
|
|
3943
3946
|
Ve as createTaskManagerService,
|
|
3944
3947
|
R as formatBytes,
|
|
3945
3948
|
we as formatETA,
|
|
3946
3949
|
q as formatRatio,
|
|
3947
3950
|
U as formatSpeed,
|
|
3948
3951
|
K as getStatusColor,
|
|
3949
|
-
|
|
3952
|
+
Ne as useHealth,
|
|
3950
3953
|
Ke as useLifeDashboard,
|
|
3951
|
-
|
|
3954
|
+
je as usePersonalFinance,
|
|
3952
3955
|
Oe as useTaskManager,
|
|
3953
3956
|
C as useTorrentUI
|
|
3954
3957
|
};
|