feat: increment version to 0.8.50 and enhance media asset features
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 24s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 30s
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 24s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 30s
- Updated APP_VERSION to 0.8.50 and DB_SCHEMA_VERSION to 20260507046. - Enhanced media assets with new tagging functionality, allowing users to filter and search by tags. - Improved media library UI with new filters for media kind and uploader, enhancing user experience. - Updated changelog to reflect the latest changes and improvements in media management.
This commit is contained in:
1 parent
3d321857ec
commit
1bc7ea95fb
7 files changed
+637
-52
No files matched your search
+76
-5
@@ -5461,8 +5461,10 @@ a.analysis-split__nav-item {
|
||||
max(24px, env(safe-area-inset-bottom, 0px) + 8px) max(16px, env(safe-area-inset-left, 0px));
|
||||
}
|
||||
.media-library__container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.media-library__hero {
|
||||
margin-bottom: 1.25rem;
|
||||
@@ -5531,6 +5533,74 @@ a.analysis-split__nav-item {
|
||||
gap: 12px;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
.media-library__filters-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.media-library__filters-row .form-input,
|
||||
.media-library__filters-row select.form-input {
|
||||
min-width: 0;
|
||||
flex: 1 1 140px;
|
||||
max-width: 240px;
|
||||
}
|
||||
.media-library__card-copyright {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
z-index: 2;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
color: var(--text2);
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
|
||||
pointer-events: none;
|
||||
}
|
||||
.media-library__card-footer-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.media-library__tag-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.media-library__tag-chip {
|
||||
font-size: 0.65rem;
|
||||
padding: 2px 6px;
|
||||
border-radius: 6px;
|
||||
background: var(--surface2);
|
||||
color: var(--text2);
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.media-library__usage-links {
|
||||
font-size: 0.72rem;
|
||||
line-height: 1.45;
|
||||
margin-top: 8px;
|
||||
color: var(--text2);
|
||||
}
|
||||
.media-library__usage-links a {
|
||||
color: var(--accent-dark, #2563eb);
|
||||
text-decoration: none;
|
||||
margin-right: 8px;
|
||||
}
|
||||
.media-library__usage-links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.media-library__check-all {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -5765,9 +5835,10 @@ a.analysis-split__nav-item {
|
||||
max-width: 160px;
|
||||
}
|
||||
@media (max-width: 639px) {
|
||||
.media-library__table .media-library__td-sub,
|
||||
.media-library__table th:nth-child(5),
|
||||
.media-library__table td:nth-child(5) {
|
||||
.media-library__th-tags,
|
||||
.media-library__td-tags,
|
||||
.media-library__th-usage,
|
||||
.media-library__td-usage {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,14 @@ import {
|
||||
List,
|
||||
MoreVertical,
|
||||
X,
|
||||
Globe,
|
||||
Users,
|
||||
Lock,
|
||||
CheckCircle2,
|
||||
Archive,
|
||||
CircleDot,
|
||||
FilePenLine,
|
||||
Copyright,
|
||||
} from 'lucide-react'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import api from '../utils/api'
|
||||
@@ -24,11 +32,110 @@ const VIS_OPTIONS = [
|
||||
{ value: 'official', label: 'Offiziell' },
|
||||
]
|
||||
|
||||
function lcLabel(code) {
|
||||
const MEDIA_KIND_OPTIONS = [
|
||||
{ value: 'all', label: 'Alle Typen' },
|
||||
{ value: 'image', label: 'Bild' },
|
||||
{ value: 'video', label: 'Video' },
|
||||
{ value: 'pdf', label: 'PDF' },
|
||||
{ value: 'other', label: 'Sonstiges' },
|
||||
]
|
||||
|
||||
const LC_STATUS_LABELS = {
|
||||
active: 'Aktiv',
|
||||
trash_soft: 'Papierkorb (1)',
|
||||
trash_hidden: 'Ausgeblendet (2)',
|
||||
}
|
||||
|
||||
function visibilityUiLabel(v) {
|
||||
const o = VIS_OPTIONS.find((x) => x.value === (v || '').toLowerCase())
|
||||
return o ? o.label : v || '—'
|
||||
}
|
||||
|
||||
function MediaCardScopeStatus({ visibility, lifecycleState }) {
|
||||
const v = (visibility || 'private').toLowerCase()
|
||||
const lc = (lifecycleState || 'active').toLowerCase()
|
||||
const visLabel = visibilityUiLabel(v)
|
||||
const lcLabel = LC_STATUS_LABELS[lc] || lcLabelFromOptions(lc)
|
||||
const tip = `${visLabel} · ${lcLabel}`
|
||||
let VisIcon = Lock
|
||||
if (v === 'official') VisIcon = Globe
|
||||
else if (v === 'club') VisIcon = Users
|
||||
let LcIcon = FilePenLine
|
||||
if (lc === 'active') LcIcon = CheckCircle2
|
||||
else if (lc === 'archived' || lc === 'trash_hidden') LcIcon = Archive
|
||||
else if (lc === 'in_review' || lc === 'trash_soft') LcIcon = CircleDot
|
||||
return (
|
||||
<div
|
||||
className="exercise-card__meta-compact"
|
||||
title={tip}
|
||||
aria-label={`Sichtbarkeit: ${visLabel}. Lebenszyklus: ${lcLabel}.`}
|
||||
>
|
||||
<span className="exercise-card__meta-glyph">
|
||||
<VisIcon size={15} strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
<span className="exercise-card__meta-sep" aria-hidden>
|
||||
·
|
||||
</span>
|
||||
<span className="exercise-card__meta-glyph">
|
||||
<LcIcon size={15} strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function lcLabelFromOptions(code) {
|
||||
const o = LC_OPTIONS.find((x) => x.value === code)
|
||||
return o ? o.label : code
|
||||
}
|
||||
|
||||
function lcLabel(code) {
|
||||
return lcLabelFromOptions(code)
|
||||
}
|
||||
|
||||
function parseTagsInput(s) {
|
||||
return String(s || '')
|
||||
.split(/[,;\n]+/)
|
||||
.map((x) => x.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function MediaUsageBlock({ usage, compact }) {
|
||||
const u = usage || { exercises: [], training_units: [] }
|
||||
const ex = u.exercises || []
|
||||
const tus = u.training_units || []
|
||||
if (!ex.length && !tus.length)
|
||||
return <span className="media-library__hint">{compact ? '—' : 'Noch in keiner Übung / Einheit verknüpft.'}</span>
|
||||
return (
|
||||
<div className="media-library__usage-links">
|
||||
{ex.length ? (
|
||||
<div>
|
||||
<strong>Übungen</strong>{' '}
|
||||
{ex.map((e) => (
|
||||
<Link key={e.id} to={`/exercises/${e.id}`} title={e.title}>
|
||||
{e.title.length > (compact ? 18 : 40) ? `${e.title.slice(0, compact ? 18 : 40)}…` : e.title}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
{tus.length ? (
|
||||
<div style={{ marginTop: ex.length ? 6 : 0 }}>
|
||||
<strong>Trainingseinheiten</strong>{' '}
|
||||
{tus.map((t) => {
|
||||
const label =
|
||||
[t.planned_date, (t.group_name || '').trim()].filter(Boolean).join(' · ') || `Einheit #${t.id}`
|
||||
const short = label.length > (compact ? 20 : 36) ? `${label.slice(0, compact ? 20 : 36)}…` : label
|
||||
return (
|
||||
<Link key={t.id} to={`/planning?unit=${t.id}`} title={label}>
|
||||
{short}
|
||||
</Link>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function uploaderLabel(it, viewer) {
|
||||
if (!viewer?.show_uploader_meta) return null
|
||||
const n = (it.uploader_name || '').trim()
|
||||
@@ -111,6 +218,10 @@ export default function MediaLibraryPage() {
|
||||
const [bulkApplyVis, setBulkApplyVis] = useState(false)
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [preview, setPreview] = useState(null)
|
||||
const [mediaKind, setMediaKind] = useState('all')
|
||||
const [filterClubId, setFilterClubId] = useState('')
|
||||
const [filterUploaderId, setFilterUploaderId] = useState('')
|
||||
const [uploaderFilterOptions, setUploaderFilterOptions] = useState([])
|
||||
|
||||
const loadClubs = useCallback(async () => {
|
||||
try {
|
||||
@@ -134,23 +245,34 @@ export default function MediaLibraryPage() {
|
||||
q: q.trim(),
|
||||
limit: 100,
|
||||
offset: 0,
|
||||
media_kind: mediaKind,
|
||||
include_filter_meta: true,
|
||||
...(isSuperadmin && filterClubId
|
||||
? { club_id: Number(filterClubId) }
|
||||
: {}),
|
||||
...(filterUploaderId && viewer?.show_uploader_meta
|
||||
? { uploaded_by: Number(filterUploaderId) }
|
||||
: {}),
|
||||
})
|
||||
setItems(res.items || [])
|
||||
setViewer(res.viewer || null)
|
||||
if (res.filter_meta?.uploaders?.length) {
|
||||
setUploaderFilterOptions(res.filter_meta.uploaders)
|
||||
}
|
||||
setSelected(new Set())
|
||||
} catch (e) {
|
||||
setError(e.message || String(e))
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, [lifecycle, q])
|
||||
}, [lifecycle, q, mediaKind, filterClubId, filterUploaderId, isSuperadmin, viewer?.show_uploader_meta])
|
||||
|
||||
useEffect(() => {
|
||||
const t = setTimeout(() => {
|
||||
loadItems()
|
||||
}, 320)
|
||||
return () => clearTimeout(t)
|
||||
}, [lifecycle, q, loadItems])
|
||||
}, [lifecycle, q, mediaKind, filterClubId, filterUploaderId, loadItems])
|
||||
|
||||
useEffect(() => {
|
||||
if (!preview) return
|
||||
@@ -182,6 +304,7 @@ export default function MediaLibraryPage() {
|
||||
setModalDraft({
|
||||
display_name: it.original_filename != null ? String(it.original_filename) : '',
|
||||
copyright_notice: it.copyright_notice != null ? String(it.copyright_notice) : '',
|
||||
tags_input: Array.isArray(it.tags) ? it.tags.join(', ') : '',
|
||||
visibility: (it.visibility || 'private').toLowerCase(),
|
||||
club_id: it.club_id != null ? String(it.club_id) : '',
|
||||
superTarget: 'active',
|
||||
@@ -202,6 +325,7 @@ export default function MediaLibraryPage() {
|
||||
if (p.edit_metadata) {
|
||||
body.original_filename = modalDraft.display_name
|
||||
body.copyright_notice = modalDraft.copyright_notice
|
||||
body.tags = parseTagsInput(modalDraft.tags_input)
|
||||
}
|
||||
if (p.change_visibility) {
|
||||
body.visibility = modalDraft.visibility
|
||||
@@ -318,8 +442,9 @@ export default function MediaLibraryPage() {
|
||||
</div>
|
||||
</div>
|
||||
<p className="media-library__intro">
|
||||
Veröffentlichte Medien (Verein/Plattform) und eigene Uploads. Vorschau: Bild oder Video groß
|
||||
anklicken. Bearbeiten und Papierkorb über das Menü pro Medium — Bulk unten in der Leiste.
|
||||
Veröffentlichte Medien (Verein/Plattform) und eigene Uploads. Suche durchsucht Bezeichner,
|
||||
technischen Speicherpfad, Copyright-Text und Schlagwörter. Vorschau: Vorschaubild antippen.
|
||||
Bearbeiten über das Menü — Bulk in der unteren Leiste.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
@@ -328,7 +453,7 @@ export default function MediaLibraryPage() {
|
||||
<input
|
||||
type="search"
|
||||
className="form-input media-library__search"
|
||||
placeholder="Suche Dateiname …"
|
||||
placeholder="Suche Bezeichner, Pfade, Copyright, Tags …"
|
||||
value={q}
|
||||
onChange={(e) => setQ(e.target.value)}
|
||||
aria-label="Suche"
|
||||
@@ -372,6 +497,50 @@ export default function MediaLibraryPage() {
|
||||
Aktualisieren
|
||||
</button>
|
||||
</div>
|
||||
<div className="media-library__filters-row" aria-label="Filter">
|
||||
<select
|
||||
className="form-input"
|
||||
value={mediaKind}
|
||||
onChange={(e) => setMediaKind(e.target.value)}
|
||||
aria-label="Medientyp"
|
||||
>
|
||||
{MEDIA_KIND_OPTIONS.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{isSuperadmin ? (
|
||||
<select
|
||||
className="form-input"
|
||||
value={filterClubId}
|
||||
onChange={(e) => setFilterClubId(e.target.value)}
|
||||
aria-label="Verein (Filter)"
|
||||
>
|
||||
<option value="">Alle Vereine</option>
|
||||
{clubs.map((c) => (
|
||||
<option key={c.id} value={String(c.id)}>
|
||||
{c.name || c.id}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : null}
|
||||
{viewer?.show_uploader_meta ? (
|
||||
<select
|
||||
className="form-input"
|
||||
value={filterUploaderId}
|
||||
onChange={(e) => setFilterUploaderId(e.target.value)}
|
||||
aria-label="Uploader"
|
||||
>
|
||||
<option value="">Alle Uploader</option>
|
||||
{uploaderFilterOptions.map((u) => (
|
||||
<option key={u.id} value={String(u.id)}>
|
||||
{u.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="media-library__toolbar-meta">
|
||||
<label className="media-library__check-all">
|
||||
<input type="checkbox" checked={items.length > 0 && selCount === items.length} onChange={selectAll} />
|
||||
@@ -400,7 +569,6 @@ export default function MediaLibraryPage() {
|
||||
{viewMode === 'grid' && items.length > 0 ? (
|
||||
<div className="media-library__grid">
|
||||
{items.map((it) => {
|
||||
const lc = (it.lifecycle_state || '').toLowerCase()
|
||||
const chk = selected.has(it.id)
|
||||
return (
|
||||
<div key={it.id} className="media-library__card">
|
||||
@@ -424,16 +592,34 @@ export default function MediaLibraryPage() {
|
||||
>
|
||||
<div className="media-library__card-thumb-wrap">
|
||||
<MediaThumb mediaId={it.id} mimeType={it.mime_type} />
|
||||
{(it.copyright_notice || '').trim() ? (
|
||||
<span
|
||||
className="media-library__card-copyright"
|
||||
title={(it.copyright_notice || '').trim()}
|
||||
aria-label="Copyright-Eintrag vorhanden"
|
||||
>
|
||||
<Copyright size={14} strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
</button>
|
||||
<div className="media-library__card-footer">
|
||||
<div className="media-library__card-name" title={it.original_filename || `#${it.id}`}>
|
||||
{it.original_filename || `Medium #${it.id}`}
|
||||
</div>
|
||||
<div className="media-library__card-tags">
|
||||
<span>{it.visibility}</span>
|
||||
<span>{lcLabel(lc)}</span>
|
||||
<div className="media-library__card-footer-row">
|
||||
<MediaCardScopeStatus visibility={it.visibility} lifecycleState={it.lifecycle_state} />
|
||||
</div>
|
||||
{(it.tags || []).length ? (
|
||||
<div className="media-library__tag-chips">
|
||||
{(it.tags || []).slice(0, 6).map((tg) => (
|
||||
<span key={tg} className="media-library__tag-chip">
|
||||
{tg}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
<MediaUsageBlock usage={it.usage} compact />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -449,8 +635,9 @@ export default function MediaLibraryPage() {
|
||||
<th className="media-library__th-check" />
|
||||
<th>Vorschau</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Sichtbarkeit</th>
|
||||
<th>Status</th>
|
||||
<th>Kennzeichen</th>
|
||||
<th className="media-library__th-tags">Tags</th>
|
||||
<th className="media-library__th-usage">Verwendung</th>
|
||||
{viewer?.show_club_meta ? <th>Verein</th> : null}
|
||||
{viewer?.show_uploader_meta ? <th>Uploader</th> : null}
|
||||
<th className="media-library__th-act" />
|
||||
@@ -458,7 +645,6 @@ export default function MediaLibraryPage() {
|
||||
</thead>
|
||||
<tbody>
|
||||
{items.map((it) => {
|
||||
const lc = (it.lifecycle_state || '').toLowerCase()
|
||||
return (
|
||||
<tr key={it.id}>
|
||||
<td>
|
||||
@@ -477,8 +663,15 @@ export default function MediaLibraryPage() {
|
||||
</button>
|
||||
</td>
|
||||
<td className="media-library__td-name">{it.original_filename || `#${it.id}`}</td>
|
||||
<td>{it.visibility}</td>
|
||||
<td>{lcLabel(lc)}</td>
|
||||
<td className="media-library__td-glyphs">
|
||||
<MediaCardScopeStatus visibility={it.visibility} lifecycleState={it.lifecycle_state} />
|
||||
</td>
|
||||
<td className="media-library__td-tags media-library__td-sub">
|
||||
{(it.tags || []).length ? (it.tags || []).join(', ') : '—'}
|
||||
</td>
|
||||
<td className="media-library__td-usage media-library__td-sub">
|
||||
<MediaUsageBlock usage={it.usage} compact />
|
||||
</td>
|
||||
{viewer?.show_club_meta ? (
|
||||
<td className="media-library__td-sub">{it.club_name || it.club_id || '—'}</td>
|
||||
) : null}
|
||||
@@ -727,6 +920,13 @@ export default function MediaLibraryPage() {
|
||||
value={modalDraft.copyright_notice}
|
||||
onChange={(e) => setModalDraft((d) => ({ ...d, copyright_notice: e.target.value }))}
|
||||
/>
|
||||
<label className="form-label">Schlagwörter (kommagetrennt)</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={modalDraft.tags_input}
|
||||
onChange={(e) => setModalDraft((d) => ({ ...d, tags_input: e.target.value }))}
|
||||
placeholder="z. B. Technik, Wurf"
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<p className="media-library__hint">Keine Berechtigung für Metadaten — nur Verwaltende dieser Stufe.</p>
|
||||
@@ -766,6 +966,20 @@ export default function MediaLibraryPage() {
|
||||
</>
|
||||
) : null}
|
||||
|
||||
<div className="media-library__meta-block">
|
||||
<span className="media-library__meta-k">Sichtbarkeit / Lebenszyklus</span>
|
||||
<div className="media-library__meta-v" style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
<MediaCardScopeStatus visibility={modal.visibility} lifecycleState={modal.lifecycle_state} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="media-library__meta-block">
|
||||
<span className="media-library__meta-k">Verwendung</span>
|
||||
<div className="media-library__meta-v">
|
||||
<MediaUsageBlock usage={modal.usage} compact={false} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="media-library__modal-actions">
|
||||
<button type="button" className="btn btn-secondary" disabled={busy} onClick={saveModal}>
|
||||
Speichern
|
||||
|
||||
@@ -535,6 +535,10 @@ export async function listMediaAssets(params = {}) {
|
||||
if (params.limit != null) sp.set('limit', String(params.limit))
|
||||
if (params.offset != null) sp.set('offset', String(params.offset))
|
||||
if (params.lifecycle) sp.set('lifecycle', String(params.lifecycle))
|
||||
if (params.media_kind) sp.set('media_kind', String(params.media_kind))
|
||||
if (params.club_id != null && params.club_id !== '') sp.set('club_id', String(params.club_id))
|
||||
if (params.uploaded_by != null && params.uploaded_by !== '') sp.set('uploaded_by', String(params.uploaded_by))
|
||||
if (params.include_filter_meta) sp.set('include_filter_meta', 'true')
|
||||
const qs = sp.toString()
|
||||
return request(`/api/media-assets${qs ? `?${qs}` : ''}`)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user