Refactoring + make itemInfo more visible
This commit is contained in:
parent
7aa602f19d
commit
b7a1bd1d55
@ -12,23 +12,23 @@ struct DashboardView: View {
|
||||
@State var showingSettingsSheet: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack {
|
||||
VStack {
|
||||
NavigationStack {
|
||||
DashboardLibraryView()
|
||||
.navigationTitle("Home")
|
||||
}
|
||||
.navigationTitle("Home")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button {
|
||||
showingSettingsSheet.toggle()
|
||||
} label: {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button {
|
||||
showingSettingsSheet.toggle()
|
||||
} label: {
|
||||
Label("Settings", systemImage: "gear")
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingSettingsSheet) {
|
||||
SettingsView(showingSettingsView: $showingSettingsSheet)
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showingSettingsSheet) {
|
||||
SettingsView(showingSettingsView: $showingSettingsSheet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,10 @@ struct ItemHeaderView: View {
|
||||
ZStack(alignment: .bottom) {
|
||||
StickyHeaderView(minHeight: 300) {
|
||||
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
||||
.hideCaption()
|
||||
.setCornerRadius(0)
|
||||
.mask(overlayGradient)
|
||||
.background {
|
||||
LibraryIconView(library: item, imageType: "Backdrop", contentMode: .fill)
|
||||
.hideCaption()
|
||||
.setCornerRadius(0)
|
||||
.blur(radius: 50)
|
||||
}
|
||||
@ -35,7 +33,6 @@ struct ItemHeaderView: View {
|
||||
|
||||
HStack {
|
||||
LibraryIconView(library: item, imageType: "Logo", width: 200, height: 100, placeHolder: AnyView(Text(item.name ?? "Unknown").font(.title).bold().truncationMode(.middle)))
|
||||
.hideCaption()
|
||||
.setCornerRadius(0)
|
||||
.shadow(radius: 10)
|
||||
.frame(alignment: .leading)
|
||||
|
@ -15,10 +15,14 @@ struct ItemInfoView: View {
|
||||
VStack(alignment: .leading) {
|
||||
HStack {
|
||||
Text((item.productionYear != nil) ? String(item.productionYear!) : "---")
|
||||
.shadow(color: .black, radius: 1)
|
||||
Text("•")
|
||||
.shadow(color: .black, radius: 1)
|
||||
Text(item.genres?.first ?? "---")
|
||||
.shadow(color: .black, radius: 1)
|
||||
}
|
||||
Text(item.getRuntime() ?? "-:--")
|
||||
.shadow(color: .black, radius: 1)
|
||||
}
|
||||
.font(.caption)
|
||||
}
|
||||
|
@ -46,7 +46,9 @@ struct ItemMediaView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(.bottom)
|
||||
|
||||
Text(item.overview ?? "---")
|
||||
ForEach(item.overview?.components(separatedBy: "<br>") ?? [], id: \.self) {overview in
|
||||
Text(overview)
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ struct ItemView: View {
|
||||
case .movie:
|
||||
ItemMovieView(item: item)
|
||||
default:
|
||||
Text("Unkown media")
|
||||
ItemMediaView(item: item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ struct LibraryDetailView: View {
|
||||
NavigationLink {
|
||||
ItemView(item: item)
|
||||
} label: {
|
||||
LibraryIconView(library: item, imageType: "Primary", width: 170)
|
||||
LibraryIconView(library: item, imageType: "Primary", width: 150)
|
||||
.showCaption()
|
||||
.setAspectRatio(item.primaryImageAspectRatio ?? 0.6)
|
||||
.padding()
|
||||
|
||||
|
@ -24,10 +24,10 @@ struct LibraryIconView: View {
|
||||
|
||||
@State var placeHolder: AnyView?
|
||||
|
||||
var shouldShowCaption: Bool = true
|
||||
var shouldShowCaption: Bool = false
|
||||
var imageCornerRadius: CGFloat = 5
|
||||
var body: some View {
|
||||
VStack {
|
||||
VStack(alignment: .leading) {
|
||||
LazyImage(url: imageUrl) {state in
|
||||
if let image = state.image {
|
||||
image
|
||||
@ -60,9 +60,9 @@ struct LibraryIconView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
func hideCaption(_ isHidden: Bool = true) -> Self {
|
||||
func showCaption(_ showCaption: Bool = true) -> Self {
|
||||
var copy = self
|
||||
copy.shouldShowCaption = !isHidden
|
||||
copy.shouldShowCaption = showCaption
|
||||
return copy
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user