Photo lightbox, timeline photo previews, subtle edit/delete footer
- Photos open in a full-screen lightbox overlay instead of navigating to a new tab (fixes PWA back-button issue) - DB migration adds photo_id to task_events; photo upload logs the reference so activity timeline can show a clickable thumbnail for each 'Photo added' event - Edit and Delete buttons moved to a quiet ghost-button footer at the bottom-right of the modal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4ab9eb4035
commit
5d62050745
6 changed files with 94 additions and 27 deletions
|
|
@ -162,6 +162,11 @@ export async function initDb() {
|
|||
CREATE INDEX IF NOT EXISTS push_subs_email_idx ON push_subscriptions (user_email);
|
||||
`)
|
||||
|
||||
// Incremental migrations — idempotent
|
||||
await pool.query(`
|
||||
ALTER TABLE task_events ADD COLUMN IF NOT EXISTS photo_id INT REFERENCES task_photos(id) ON DELETE SET NULL
|
||||
`)
|
||||
|
||||
await seedDefaults()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ export const TRANSITIONS = {
|
|||
fixed: ['submitted'], // reopen only
|
||||
}
|
||||
|
||||
export async function logEvent(taskId, eventType, { fromStatus = null, toStatus = null, note = null, userName = null } = {}) {
|
||||
export async function logEvent(taskId, eventType, { fromStatus = null, toStatus = null, note = null, userName = null, photoId = null } = {}) {
|
||||
await pool.query(
|
||||
`INSERT INTO task_events (task_id, event_type, from_status, to_status, note, user_name)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)`,
|
||||
[taskId, eventType, fromStatus, toStatus, note, userName]
|
||||
`INSERT INTO task_events (task_id, event_type, from_status, to_status, note, user_name, photo_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)`,
|
||||
[taskId, eventType, fromStatus, toStatus, note, userName, photoId]
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export async function photoRoutes(app, opts) {
|
|||
VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING *`,
|
||||
[taskId, fileData.originalName, filePath, 'image/jpeg', fileData.size, stage, req.user.email]
|
||||
)
|
||||
await logEvent(taskId, 'photo', { note: `Photo added (${stage})`, userName: req.user.name })
|
||||
await logEvent(taskId, 'photo', { note: `Photo added (${stage})`, userName: req.user.name, photoId: ins[0].id })
|
||||
return ins[0]
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue