mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-20 08:02:16 +00:00
53 lines
No EOL
1.4 KiB
Swift
53 lines
No EOL
1.4 KiB
Swift
//
|
|
// MediaInfoView.swift
|
|
// Sora-JS
|
|
//
|
|
// Created by Francesco on 05/01/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Kingfisher
|
|
|
|
struct MediaInfoView: View {
|
|
let title: String
|
|
let imageUrl: String
|
|
let href: String
|
|
let module: ScrapingModule
|
|
|
|
var body: some View {
|
|
VStack {
|
|
KFImage(URL(string: imageUrl))
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(maxWidth: .infinity)
|
|
.padding()
|
|
|
|
Text(title)
|
|
.font(.largeTitle)
|
|
.padding()
|
|
|
|
Button(action: {
|
|
var finalHref = href
|
|
if !href.starts(with: "http") {
|
|
var baseUrl = module.metadata.baseUrl
|
|
if !baseUrl.hasSuffix("/") && !href.hasPrefix("/") {
|
|
baseUrl += "/"
|
|
}
|
|
finalHref = baseUrl + href
|
|
}
|
|
if let url = URL(string: finalHref) {
|
|
UIApplication.shared.open(url)
|
|
}
|
|
}) {
|
|
Text("Open Link")
|
|
.font(.headline)
|
|
.foregroundColor(.blue)
|
|
}
|
|
.padding()
|
|
|
|
Spacer()
|
|
}
|
|
.navigationTitle("Media Info")
|
|
.navigationBarTitleDisplayMode(.inline)
|
|
}
|
|
} |