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
@@ -8,6 +8,7 @@ import {
|
||||
} from 'recharts'
|
||||
import { ChevronRight, Brain, ChevronDown, ChevronUp, Trash2 } from 'lucide-react'
|
||||
import { api } from '../utils/api'
|
||||
import { photoMonthKey, photoSortKey, formatPhotoCaption } from '../utils/photoDisplay'
|
||||
import { getBfCategory } from '../utils/calc'
|
||||
import { getInterpretation, getStatusColor, getStatusBg } from '../utils/interpret'
|
||||
import Markdown from '../utils/Markdown'
|
||||
@@ -897,15 +898,6 @@ function CorrelationSection({ corrData, insights, profile, onRequest, loadingSlu
|
||||
}
|
||||
|
||||
// ── Photo Grid ────────────────────────────────────────────────────────────────
|
||||
function monthKeyFromPhoto(p) {
|
||||
if (p.date) return p.date.slice(0, 7)
|
||||
return (p.created || '').slice(0, 7) || '0000-00'
|
||||
}
|
||||
|
||||
function sortPhotoDateKey(p) {
|
||||
return (p.date || p.created || '').slice(0, 10)
|
||||
}
|
||||
|
||||
function PhotoGrid() {
|
||||
const [photos, setPhotos] = useState([])
|
||||
const [big, setBig] = useState(null)
|
||||
@@ -931,10 +923,10 @@ function PhotoGrid() {
|
||||
return <EmptySection text="Noch keine Fotos." to="/photos" toLabel="Fotos erfassen" />
|
||||
}
|
||||
|
||||
const sorted = [...photos].sort((a, b) => sortPhotoDateKey(b).localeCompare(sortPhotoDateKey(a)))
|
||||
const sorted = [...photos].sort((a, b) => photoSortKey(b).localeCompare(photoSortKey(a)))
|
||||
const byMonth = new Map()
|
||||
for (const p of sorted) {
|
||||
const mk = monthKeyFromPhoto(p)
|
||||
const mk = photoMonthKey(p)
|
||||
if (!byMonth.has(mk)) byMonth.set(mk, [])
|
||||
byMonth.get(mk).push(p)
|
||||
}
|
||||
@@ -993,7 +985,7 @@ function PhotoGrid() {
|
||||
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