fix: clear demo data button, seed user ID bug, duplicate endpoint (v0.23.4)
- DataPage: removed 'coming soon' placeholder, made Clear Demo Data button accessible from seeded state - seedDemoData.js: fixed userId -> targetUserId bug - settings.js: removed duplicate /api/settings/seed-demo-data endpoint - Version bumped to 0.23.4
This commit is contained in:
parent
6d488aa8bd
commit
5537ab2bd5
|
|
@ -3,7 +3,7 @@
|
|||
**This document tracks potential future enhancements for Bill Tracker.**
|
||||
|
||||
**Last Updated:** 2026-05-10
|
||||
**Current Version:** v0.23.3
|
||||
**Current Version:** v0.23.4
|
||||
|
||||
## How to Use This Document
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
# Bill Tracker — Changelog
|
||||
|
||||
## v0.23.4
|
||||
|
||||
### Fixed
|
||||
- **Clear Demo Data button now works** — Removed misleading "coming soon" placeholder text. The Clear Demo Data button with AlertDialog confirmation is now accessible from the seeded state view.
|
||||
- **Seed script user ID bug** — Fixed `seedDemoData.js` creating bills with wrong user ID (`userId` instead of `targetUserId`).
|
||||
- **Removed duplicate seed endpoint** — Deleted redundant `/api/settings/seed-demo-data` route (canonical endpoint is `/api/user/seed-demo-data`).
|
||||
|
||||
## v0.23.3
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
export const APP_VERSION = '0.23.3';
|
||||
export const APP_VERSION = '0.23.4';
|
||||
export const APP_NAME = 'BillTracker';
|
||||
|
||||
export const RELEASE_NOTES = {
|
||||
version: '0.23.3',
|
||||
version: '0.23.4',
|
||||
date: '2026-05-10',
|
||||
highlights: [
|
||||
{ icon: '✅', title: 'AlertDialog Integration', desc: 'Replaced native confirm() calls with shadcn/ui AlertDialog for consistent UI across tracker and data pages.' },
|
||||
{ icon: '🧹', title: 'Clear Demo Data Fix', desc: 'Fixed Clear Demo Data button — removed misleading placeholder, made button accessible from seeded state, fixed seed script user ID bug, and removed duplicate endpoint.' },
|
||||
],
|
||||
};
|
||||
|
|
@ -1509,49 +1509,6 @@ function SeedDemoDataSection({ onSeeded }) {
|
|||
<Button size="sm" variant="outline" onClick={() => { setSeeded(false); setResult(null); }}>
|
||||
Reset
|
||||
</Button>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Temp demo data removal coming soon ✨
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionCard>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SectionCard title="Demo Data" subtitle="Seed your database with demo data for testing" icon={Sparkles}>
|
||||
<div className="rounded-lg border border-border/60 bg-background/50 p-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Create 20 realistic demo bills and 8 demo categories for testing purposes.
|
||||
The data will be associated with your account.
|
||||
</p>
|
||||
|
||||
{/* Temp Data Deletion Placeholder */}
|
||||
<div className="mt-4 rounded-md bg-muted/40 border border-border/60 p-3">
|
||||
<div className="flex items-start gap-2.5">
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 text-amber-600 dark:text-amber-500 shrink-0" />
|
||||
<div className="space-y-1">
|
||||
<p className="text-xs font-semibold text-amber-700 dark:text-amber-500">Temp Demo Data Removal</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Demo data removal functionality is coming soon. Once fixed, you'll be able to clear all seeded demo bills and categories with one click.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 space-y-4">
|
||||
<div className="border-t border-border pt-4">
|
||||
<Button size="sm" variant="outline" onClick={handleSeed} disabled={loading}>
|
||||
{loading ? <><Loader2 className="h-3.5 w-3.5 mr-1.5 animate-spin" />Seeding…</> : 'Seed Demo Data'}
|
||||
</Button>
|
||||
</div>
|
||||
{seeded && (
|
||||
<div className="border-t border-border pt-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-xs text-muted-foreground">
|
||||
This will remove only seeded demo bills and categories from your account.
|
||||
</p>
|
||||
<AlertDialog open={showClearConfirm} onOpenChange={setShowClearConfirm}>
|
||||
<AlertDialogTrigger asChild>
|
||||
<Button size="sm" variant="destructive" disabled={clearing}>
|
||||
|
|
@ -1575,7 +1532,25 @@ function SeedDemoDataSection({ onSeeded }) {
|
|||
</AlertDialog>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</SectionCard>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SectionCard title="Demo Data" subtitle="Seed your database with demo data for testing" icon={Sparkles}>
|
||||
<div className="rounded-lg border border-border/60 bg-background/50 p-4">
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Create 20 realistic demo bills and 8 demo categories for testing purposes.
|
||||
The data will be associated with your account.
|
||||
</p>
|
||||
|
||||
<div className="mt-4 space-y-4">
|
||||
<div className="border-t border-border pt-4">
|
||||
<Button size="sm" variant="outline" onClick={handleSeed} disabled={loading}>
|
||||
{loading ? <><Loader2 className="h-3.5 w-3.5 mr-1.5 animate-spin" />Seeding…</> : 'Seed Demo Data'}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SectionCard>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bill-tracker",
|
||||
"version": "0.23.3",
|
||||
"version": "0.23.4",
|
||||
"description": "Monthly bill tracking system",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const { getDb, getSetting, setSetting } = require('../db/database');
|
||||
const { seedDemoData } = require('../scripts/seedDemoData');
|
||||
|
||||
// Keys a regular user is allowed to read and write.
|
||||
// Admin/SMTP/backup/auth settings are excluded — they are only readable through
|
||||
|
|
@ -38,20 +37,4 @@ router.put('/', (req, res) => {
|
|||
res.json(settings);
|
||||
});
|
||||
|
||||
// POST /api/settings/seed-demo-data — seeds 20 demo bills for the requesting user
|
||||
router.post('/seed-demo-data', (req, res) => {
|
||||
try {
|
||||
const result = seedDemoData(req.user.id);
|
||||
res.json({
|
||||
success: true,
|
||||
message: `Created ${result.billsCreated} demo bills and ${result.categoriesCreated} demo categories`,
|
||||
billsCreated: result.billsCreated,
|
||||
categoriesCreated: result.categoriesCreated,
|
||||
});
|
||||
} catch (err) {
|
||||
const status = err.status || 500;
|
||||
res.status(status).json({ error: status === 500 ? 'Seed operation failed' : err.message });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ function seedDemoData(userId = null) {
|
|||
|
||||
try {
|
||||
insertBill.run(
|
||||
userId,
|
||||
targetUserId,
|
||||
billData.name,
|
||||
category,
|
||||
billData.dueDay || Math.floor(Math.random() * 28) + 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue