mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 08:32:00 +00:00
improved library layout and design
Some checks failed
Build and Release IPA / Build IPA (push) Has been cancelled
Some checks failed
Build and Release IPA / Build IPA (push) Has been cancelled
This commit is contained in:
parent
570aa596c5
commit
8cd40687ff
1 changed files with 77 additions and 77 deletions
|
|
@ -21,89 +21,91 @@ struct LibraryView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(alignment: .leading, spacing: 16) {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
Group {
|
Text("Continue Watching")
|
||||||
Text("Continue Watching")
|
.font(.title2)
|
||||||
.font(.title2)
|
.bold()
|
||||||
.bold()
|
.padding(.horizontal, 20)
|
||||||
.padding(.horizontal, 20)
|
|
||||||
|
if continueWatchingItems.isEmpty {
|
||||||
if continueWatchingItems.isEmpty {
|
VStack(spacing: 8) {
|
||||||
Text("No items to continue watching")
|
Image(systemName: "play.circle")
|
||||||
|
.font(.largeTitle)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
Text("No items to continue watching")
|
||||||
|
.font(.headline)
|
||||||
|
Text("Recently watched content will appear here")
|
||||||
|
.font(.caption)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.padding(.horizontal, 20)
|
|
||||||
} else {
|
|
||||||
ContinueWatchingSection(items: $continueWatchingItems, markAsWatched: { item in
|
|
||||||
markContinueWatchingItemAsWatched(item: item)
|
|
||||||
}, removeItem: { item in
|
|
||||||
removeContinueWatchingItem(item: item)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
} else {
|
||||||
|
ContinueWatchingSection(items: $continueWatchingItems, markAsWatched: { item in
|
||||||
|
markContinueWatchingItemAsWatched(item: item)
|
||||||
|
}, removeItem: { item in
|
||||||
|
removeContinueWatchingItem(item: item)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Group {
|
Text("Bookmarks")
|
||||||
Text("Bookmarks")
|
.font(.title2)
|
||||||
.font(.title2)
|
.bold()
|
||||||
.bold()
|
.padding(.horizontal, 20)
|
||||||
.padding(.horizontal, 20)
|
|
||||||
|
if libraryManager.bookmarks.isEmpty {
|
||||||
if libraryManager.bookmarks.isEmpty {
|
VStack(spacing: 8) {
|
||||||
VStack(spacing: 8) {
|
Image(systemName: "magazine")
|
||||||
Image(systemName: "magazine")
|
.font(.largeTitle)
|
||||||
.font(.largeTitle)
|
.foregroundColor(.secondary)
|
||||||
.foregroundColor(.secondary)
|
Text("No Items saved")
|
||||||
Text("No Items saved")
|
.font(.headline)
|
||||||
.font(.headline)
|
Text("Bookmark items for easy access later")
|
||||||
Text("Bookmark items for easy access later")
|
.font(.caption)
|
||||||
.font(.caption)
|
.foregroundColor(.secondary)
|
||||||
.foregroundColor(.secondary)
|
}
|
||||||
}
|
.padding()
|
||||||
.padding()
|
.frame(maxWidth: .infinity)
|
||||||
.frame(maxWidth: .infinity)
|
} else {
|
||||||
} else {
|
LazyVGrid(columns: columns, spacing: 12) {
|
||||||
LazyVGrid(columns: columns, spacing: 12) {
|
ForEach(libraryManager.bookmarks) { item in
|
||||||
ForEach(libraryManager.bookmarks) { item in
|
if let module = moduleManager.modules.first(where: { $0.id.uuidString == item.moduleId }) {
|
||||||
if let module = moduleManager.modules.first(where: { $0.id.uuidString == item.moduleId }) {
|
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: module)) {
|
||||||
NavigationLink(destination: MediaInfoView(title: item.title, imageUrl: item.imageUrl, href: item.href, module: module)) {
|
VStack {
|
||||||
VStack {
|
ZStack {
|
||||||
ZStack(alignment: .bottomTrailing) {
|
KFImage(URL(string: item.imageUrl))
|
||||||
KFImage(URL(string: item.imageUrl))
|
.placeholder {
|
||||||
.placeholder {
|
RoundedRectangle(cornerRadius: 10)
|
||||||
RoundedRectangle(cornerRadius: 10)
|
.fill(Color.gray.opacity(0.3))
|
||||||
.fill(Color.gray.opacity(0.3))
|
.frame(width: 150, height: 225)
|
||||||
.frame(width: 150, height: 225)
|
.shimmering()
|
||||||
.shimmering()
|
}
|
||||||
}
|
.resizable()
|
||||||
.resizable()
|
.aspectRatio(2/3, contentMode: .fill)
|
||||||
.aspectRatio(2/3, contentMode: .fill)
|
.frame(width: 150, height: 225)
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.frame(width: 150, height: 225)
|
.clipped()
|
||||||
|
.overlay(
|
||||||
KFImage(URL(string: module.metadata.iconUrl))
|
KFImage(URL(string: module.metadata.iconUrl))
|
||||||
.placeholder {
|
.resizable()
|
||||||
Circle()
|
.frame(width: 24, height: 24)
|
||||||
.fill(Color.gray.opacity(0.3))
|
.cornerRadius(4)
|
||||||
.frame(width: 35, height: 35)
|
.padding(4),
|
||||||
.shimmering()
|
alignment: .topLeading
|
||||||
}
|
)
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
|
||||||
.frame(width: 35, height: 35)
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(item.title)
|
|
||||||
.font(.subheadline)
|
|
||||||
.foregroundColor(.primary)
|
|
||||||
.lineLimit(2)
|
|
||||||
.multilineTextAlignment(.leading)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text(item.title)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
.lineLimit(2)
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal, 20)
|
|
||||||
}
|
}
|
||||||
|
.padding(.horizontal, 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.vertical, 20)
|
.padding(.vertical, 20)
|
||||||
|
|
@ -145,11 +147,9 @@ struct ContinueWatchingSection: View {
|
||||||
ScrollView(.horizontal, showsIndicators: false) {
|
ScrollView(.horizontal, showsIndicators: false) {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
ForEach(Array(items.reversed())) { item in
|
ForEach(Array(items.reversed())) { item in
|
||||||
ContinueWatchingCell(item: item,
|
ContinueWatchingCell(item: item,markAsWatched: {
|
||||||
markAsWatched: {
|
|
||||||
markAsWatched(item)
|
markAsWatched(item)
|
||||||
},
|
}, removeItem: {
|
||||||
removeItem: {
|
|
||||||
removeItem(item)
|
removeItem(item)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue