fix(ui): hide Comic/Manga editor section for non-comics media
The metadata editor's Comic/Manga section (Manga Type, Reading Direction, Age Rating, Story Arc, Imprint, Scan Info, Metadata Notes, B&W) rendered for every item — an audiobook showed a manga dropdown, which is nonsense. MediaDetail now carries LibraryTypeName (resolved via GetLibraryType in the /media/:uuid handler) and a ShowComicMetadata() gate: comics and manga libraries always show the section; other media only when the scanner recorded comic-style values (fixed-layout manga-style EPUBs get those scanner defaults deliberately — when present they stay editable).
This commit is contained in:
1 parent
ab2a5568ae
commit
d41c3e4774
4 files changed
+249
-217
No files matched your search
@@ -12,6 +12,11 @@ import (
|
||||
type MediaDetail struct {
|
||||
database.MediaItems // Embedded - ALL book fields available
|
||||
|
||||
// Display type of the owning library ("audiobooks", "comics", "ebooks",
|
||||
// "manga"); "" when it could not be resolved. Drives media-type-aware
|
||||
// UI gating (e.g. hiding the Comic/Manga editor section).
|
||||
LibraryTypeName string
|
||||
|
||||
// Audio editorial/tech surfaces (A2a): duration parsed out of the
|
||||
// audio_metadata JSONB the scanner wrote (display-only).
|
||||
audioDurationSeconds float64
|
||||
@@ -44,6 +49,18 @@ type MediaDetail struct {
|
||||
DeletedAnnotations []DeletedAnnotationResponse `json:"deleted_annotations"`
|
||||
}
|
||||
|
||||
// ShowComicMetadata reports whether the Comic/Manga section belongs on
|
||||
// this item's edit modal: comics and manga libraries always; other media
|
||||
// only when the scanner actually recorded comic-style values (fixed-layout
|
||||
// manga-style EPUBs get scanner defaults).
|
||||
func (md *MediaDetail) ShowComicMetadata() bool {
|
||||
if md.LibraryTypeName == "comics" || md.LibraryTypeName == "manga" {
|
||||
return true
|
||||
}
|
||||
return (md.MangaType.Valid && md.MangaType.String != "") ||
|
||||
(md.ReadingDirection.Valid && md.ReadingDirection.String != "")
|
||||
}
|
||||
|
||||
// BookStatsData is the per-book reading-stats card payload.
|
||||
type BookStatsData struct {
|
||||
TotalMinutes int
|
||||
|
||||
Reference in new issue
Block a user