fix(logs): repair journal entry cards and avoid duplicate days
Match dashboard card DOM so entry tiles get correct height, remove nested form-card chrome, and open today’s entry instead of creating a second one. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1825,6 +1825,16 @@ html.scheme-dark .themed-select-option.is-selected {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logbook-card-chevron {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
flex-shrink: 0;
|
||||||
|
align-self: center;
|
||||||
|
margin-left: auto;
|
||||||
|
color: #475569;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.logbook-card .logbook-title-editable,
|
.logbook-card .logbook-title-editable,
|
||||||
.logbook-card .logbook-title-inline-edit,
|
.logbook-card .logbook-title-inline-edit,
|
||||||
.logbook-card .card-title-row {
|
.logbook-card .card-title-row {
|
||||||
@@ -3349,7 +3359,14 @@ html.theme-cupertino .events-scroll-container {
|
|||||||
color: var(--app-accent-light, #93c5fd);
|
color: var(--app-accent-light, #93c5fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logs-journal {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.live-log-card {
|
.live-log-card {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 0;
|
||||||
min-height: 420px;
|
min-height: 420px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -823,7 +823,7 @@ export default function LiveLogView({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="form-card live-log-card">
|
<div className="live-log-card">
|
||||||
<div className="section-title-bar mb-4">
|
<div className="section-title-bar mb-4">
|
||||||
<div className="form-header" style={{ margin: 0 }}>
|
<div className="form-header" style={{ margin: 0 }}>
|
||||||
<Radio size={24} className="form-icon" />
|
<Radio size={24} className="form-icon" />
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { downloadCsv, shareCsv } from '../services/csvExport.js'
|
|||||||
import { downloadLogbookPagePdf } from '../services/pdfExport.js'
|
import { downloadLogbookPagePdf } from '../services/pdfExport.js'
|
||||||
import { PlausibleEvents, trackPlausibleEvent } from '../services/analytics.js'
|
import { PlausibleEvents, trackPlausibleEvent } from '../services/analytics.js'
|
||||||
import { getErrorMessage } from '../utils/errors.js'
|
import { getErrorMessage } from '../utils/errors.js'
|
||||||
|
import { findTodayEntryId } from '../services/quickEventLog.js'
|
||||||
import LogEntryEditor from './LogEntryEditor.tsx'
|
import LogEntryEditor from './LogEntryEditor.tsx'
|
||||||
import LiveLogView from './LiveLogView.tsx'
|
import LiveLogView from './LiveLogView.tsx'
|
||||||
import EntrySkipperSignBadge from './EntrySkipperSignBadge.tsx'
|
import EntrySkipperSignBadge from './EntrySkipperSignBadge.tsx'
|
||||||
@@ -239,6 +240,12 @@ export default function LogEntriesList({
|
|||||||
const masterKey = await getLogbookKey(logbookId) || getActiveMasterKey()
|
const masterKey = await getLogbookKey(logbookId) || getActiveMasterKey()
|
||||||
if (!masterKey) throw new Error('Encryption key not found. Please log in.')
|
if (!masterKey) throw new Error('Encryption key not found. Please log in.')
|
||||||
|
|
||||||
|
const existingTodayId = await findTodayEntryId(logbookId)
|
||||||
|
if (existingTodayId) {
|
||||||
|
setSelectedEntryId(existingTodayId)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const localEntries = await db.entries.where({ logbookId }).toArray()
|
const localEntries = await db.entries.where({ logbookId }).toArray()
|
||||||
const decryptedEntries: Array<LogEntryTankSource & TravelDaySortable> = []
|
const decryptedEntries: Array<LogEntryTankSource & TravelDaySortable> = []
|
||||||
|
|
||||||
@@ -390,7 +397,10 @@ export default function LogEntriesList({
|
|||||||
setReturnToLiveAfterEditor(true)
|
setReturnToLiveAfterEditor(true)
|
||||||
setSelectedEntryId(entryId)
|
setSelectedEntryId(entryId)
|
||||||
}}
|
}}
|
||||||
onSwitchToList={() => setViewMode('list')}
|
onSwitchToList={() => {
|
||||||
|
setViewMode('list')
|
||||||
|
void loadEntries()
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -410,7 +420,7 @@ export default function LogEntriesList({
|
|||||||
: entries[0]?.id ?? null
|
: entries[0]?.id ?? null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="form-card">
|
<div className="logs-journal">
|
||||||
<div className="section-title-bar mb-6">
|
<div className="section-title-bar mb-6">
|
||||||
<div className="form-header" style={{ margin: 0 }}>
|
<div className="form-header" style={{ margin: 0 }}>
|
||||||
<Calendar size={24} className="form-icon" />
|
<Calendar size={24} className="form-icon" />
|
||||||
@@ -475,8 +485,14 @@ export default function LogEntriesList({
|
|||||||
type="button"
|
type="button"
|
||||||
className="logbook-card-select"
|
className="logbook-card-select"
|
||||||
onClick={() => setSelectedEntryId(item.id)}
|
onClick={() => setSelectedEntryId(item.id)}
|
||||||
>
|
aria-label={
|
||||||
<div className="card-icon">
|
item.departure && item.destination
|
||||||
|
? `${item.departure} → ${item.destination}, ${t('logs.travel_day_number', { number: item.dayOfTravel })}`
|
||||||
|
: `${t('logs.new_entry')}, ${t('logs.travel_day_number', { number: item.dayOfTravel })}`
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div className="card-icon" aria-hidden>
|
||||||
<FileText size={24} />
|
<FileText size={24} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -497,8 +513,7 @@ export default function LogEntriesList({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ChevronRight size={18} style={{ color: '#475569', marginLeft: 'auto' }} aria-hidden />
|
<ChevronRight size={18} className="logbook-card-chevron" aria-hidden />
|
||||||
</button>
|
|
||||||
|
|
||||||
<button className="btn-pdf" onClick={(e) => handleDownloadPdf(item.id, item.date, e)} title={t('logs.export_pdf')} disabled={exporting}>
|
<button className="btn-pdf" onClick={(e) => handleDownloadPdf(item.id, item.date, e)} title={t('logs.export_pdf')} disabled={exporting}>
|
||||||
<Download size={18} />
|
<Download size={18} />
|
||||||
|
|||||||
Reference in New Issue
Block a user