diff --git a/FUTURE.md b/FUTURE.md index a8d7962..ffbb672 100644 --- a/FUTURE.md +++ b/FUTURE.md @@ -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 diff --git a/HISTORY.md b/HISTORY.md index 255154b..e9ada5f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/client/lib/version.js b/client/lib/version.js index 6c49a50..a6d8f5a 100644 --- a/client/lib/version.js +++ b/client/lib/version.js @@ -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.' }, ], }; \ No newline at end of file diff --git a/client/pages/DataPage.jsx b/client/pages/DataPage.jsx index 88b45c3..ddb3288 100644 --- a/client/pages/DataPage.jsx +++ b/client/pages/DataPage.jsx @@ -1509,9 +1509,27 @@ function SeedDemoDataSection({ onSeeded }) { -

- Temp demo data removal coming soon ✨ -

+ + + + + + + Clear Demo Data + + This action will remove {result?.billsCreated || 0} demo bills and {result?.categoriesCreated || 0} demo categories from your account. This action cannot be undone. + + + + Cancel + + {clearing ? <>Clearing… : 'Clear Data'} + + + + @@ -1527,55 +1545,12 @@ function SeedDemoDataSection({ onSeeded }) { The data will be associated with your account.

- {/* Temp Data Deletion Placeholder */} -
-
- -
-

Temp Demo Data Removal

-

- Demo data removal functionality is coming soon. Once fixed, you'll be able to clear all seeded demo bills and categories with one click. -

-
-
-
-
- {seeded && ( -
-
-

- This will remove only seeded demo bills and categories from your account. -

- - - - - - - Clear Demo Data - - This action will remove {result?.billsCreated || 0} demo bills and {result?.categoriesCreated || 0} demo categories from your account. This action cannot be undone. - - - - Cancel - - {clearing ? <>Clearing… : 'Clear Data'} - - - - -
-
- )}
diff --git a/package.json b/package.json index cd31ed9..12f38a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bill-tracker", - "version": "0.23.3", + "version": "0.23.4", "description": "Monthly bill tracking system", "main": "server.js", "scripts": { diff --git a/routes/settings.js b/routes/settings.js index fe07142..6192120 100644 --- a/routes/settings.js +++ b/routes/settings.js @@ -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; diff --git a/scripts/seedDemoData.js b/scripts/seedDemoData.js index 506b10f..9d0e7d5 100644 --- a/scripts/seedDemoData.js +++ b/scripts/seedDemoData.js @@ -138,7 +138,7 @@ function seedDemoData(userId = null) { try { insertBill.run( - userId, + targetUserId, billData.name, category, billData.dueDay || Math.floor(Math.random() * 28) + 1,