feat: enhance photo upload and management features
- Added `taken_at` timestamp to the photos table for improved photo metadata. - Updated the photo upload API to support optional EXIF data extraction and file last modified timestamp. - Enhanced the photo upload process to allow skipping EXIF data, defaulting to today's date if no other date is provided. - Improved the photo display in various components to utilize a unified caption format. - Refactored photo sorting and grouping logic for better organization in the UI.
This commit is contained in:
1 parent
c91317df8e
commit
0035d08149
12 files changed
+225
-36
No files matched your search
@@ -3,6 +3,7 @@ import { Camera, Trash2 } from 'lucide-react'
|
||||
import dayjs from 'dayjs'
|
||||
import { api } from '../utils/api'
|
||||
import UsageBadge from '../components/UsageBadge'
|
||||
import { formatPhotoCaption } from '../utils/photoDisplay'
|
||||
|
||||
export default function PhotosCapturePage() {
|
||||
const [date, setDate] = useState(() => dayjs().format('YYYY-MM-DD'))
|
||||
@@ -11,6 +12,7 @@ export default function PhotosCapturePage() {
|
||||
const [uploading, setUploading] = useState(false)
|
||||
const [error, setError] = useState(null)
|
||||
const [big, setBig] = useState(null)
|
||||
const [skipExif, setSkipExif] = useState(false)
|
||||
const fileRef = useRef(null)
|
||||
|
||||
const load = () => api.listPhotos().then(setPhotos).catch(() => setPhotos([]))
|
||||
@@ -38,7 +40,7 @@ export default function PhotosCapturePage() {
|
||||
setUploading(true)
|
||||
try {
|
||||
for (const file of files) {
|
||||
await api.uploadPhoto(file, date)
|
||||
await api.uploadPhoto(file, date, { skipExif })
|
||||
}
|
||||
await load()
|
||||
await loadUsage()
|
||||
@@ -74,11 +76,12 @@ export default function PhotosCapturePage() {
|
||||
{photoUsage && <UsageBadge {...photoUsage} />}
|
||||
</div>
|
||||
<p style={{ fontSize: 13, color: 'var(--text2)', marginTop: 0, marginBottom: 14, lineHeight: 1.5 }}>
|
||||
Fortschrittsfotos unabhängig von Umfängen. Pro Tag beliebig viele Aufnahmen möglich — Datum ist das
|
||||
Zuordnungsdatum (z. B. Aufnahmezeitpunkt).
|
||||
Reihenfolge: zuerst <strong>EXIF</strong> (Aufnahme aus dem Bild), sonst die{' '}
|
||||
<strong>Datei-Zeit</strong> (Letzte Änderung der Datei, wie vom Browser übermittelt), sonst das
|
||||
Fallback-Datum unten (Standard: heute).
|
||||
</p>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Zuordnungsdatum</label>
|
||||
<label className="form-label">Datum (Fallback ohne EXIF)</label>
|
||||
<input
|
||||
type="date"
|
||||
className="form-input"
|
||||
@@ -88,6 +91,20 @@ export default function PhotosCapturePage() {
|
||||
/>
|
||||
<span className="form-unit" />
|
||||
</div>
|
||||
<label
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: 8,
|
||||
fontSize: 13,
|
||||
color: 'var(--text2)',
|
||||
marginBottom: 12,
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
<input type="checkbox" checked={skipExif} onChange={(e) => setSkipExif(e.target.checked)} />
|
||||
EXIF und Datei-Zeit ignorieren — nur das Fallback-Datum verwenden
|
||||
</label>
|
||||
<input
|
||||
ref={fileRef}
|
||||
type="file"
|
||||
@@ -171,7 +188,7 @@ export default function PhotosCapturePage() {
|
||||
borderRadius: 3,
|
||||
}}
|
||||
>
|
||||
{p.date?.slice(0, 10) || p.created?.slice(0, 10)}
|
||||
{formatPhotoCaption(p)}
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
Reference in new issue
Block a user