mirror of
https://github.com/cranci1/Sora.git
synced 2026-05-02 21:54:30 +00:00
little UI thing
This commit is contained in:
parent
ac66da899c
commit
4ae5517cb8
1 changed files with 41 additions and 9 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import Kingfisher
|
import Kingfisher
|
||||||
|
import SafariServices
|
||||||
|
|
||||||
struct MediaItem: Identifiable {
|
struct MediaItem: Identifiable {
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
@ -63,21 +64,40 @@ struct MediaInfoView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
HStack(alignment: .center, spacing: 12) {
|
HStack(alignment: .center, spacing: 12) {
|
||||||
Text(module.metadata.sourceName)
|
HStack(spacing: 4) {
|
||||||
.font(.system(size: 13))
|
Image(systemName: "calendar")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 15, height: 15)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
|
Text(airdate)
|
||||||
|
.font(.system(size: 12))
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.padding(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
HStack(alignment: .center, spacing: 12) {
|
||||||
|
Button(action: {
|
||||||
|
openSafariViewController(with: href)
|
||||||
|
}) {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
Text(module.metadata.sourceName)
|
||||||
|
.font(.system(size: 13))
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
|
||||||
|
Image(systemName: "safari")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 20, height: 20)
|
||||||
|
.foregroundColor(.primary)
|
||||||
|
}
|
||||||
.padding(4)
|
.padding(4)
|
||||||
.background(Capsule().fill(Color.accentColor.opacity(0.4)))
|
.background(Capsule().fill(Color.accentColor.opacity(0.4)))
|
||||||
|
|
||||||
Button(action: {
|
|
||||||
}) {
|
|
||||||
Image(systemName: "ellipsis.circle")
|
|
||||||
.resizable()
|
|
||||||
.frame(width: 20, height: 20)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
}) {
|
}) {
|
||||||
Image(systemName: "safari")
|
Image(systemName: "ellipsis.circle")
|
||||||
.resizable()
|
.resizable()
|
||||||
.frame(width: 20, height: 20)
|
.frame(width: 20, height: 20)
|
||||||
}
|
}
|
||||||
|
|
@ -192,6 +212,18 @@ struct MediaInfoView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func openSafariViewController(with urlString: String) {
|
||||||
|
guard let url = URL(string: urlString) else {
|
||||||
|
print("Unable to open the webpage")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let safariViewController = SFSafariViewController(url: url)
|
||||||
|
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
||||||
|
let rootVC = windowScene.windows.first?.rootViewController {
|
||||||
|
rootVC.present(safariViewController, animated: true, completion: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func fetchItemID(byTitle title: String, completion: @escaping (Result<Int, Error>) -> Void) {
|
private func fetchItemID(byTitle title: String, completion: @escaping (Result<Int, Error>) -> Void) {
|
||||||
let query = """
|
let query = """
|
||||||
query {
|
query {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue