Presenting all source results can be annoying to a user. Add filtering to filter by a specific source. Signed-off-by: kingbri <bdashore3@gmail.com>
49 lines
1.3 KiB
Swift
49 lines
1.3 KiB
Swift
//
|
|
// SearchResultRDView.swift
|
|
// Ferrite
|
|
//
|
|
// Created by Brian Dashore on 7/26/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SearchResultRDView: View {
|
|
@EnvironmentObject var debridManager: DebridManager
|
|
|
|
@AppStorage("RealDebrid.Enabled") var realDebridEnabled = false
|
|
|
|
var result: SearchResult
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Text(result.source)
|
|
|
|
Spacer()
|
|
|
|
Text(result.size)
|
|
|
|
if realDebridEnabled {
|
|
Text("RD")
|
|
.fontWeight(.bold)
|
|
.padding(2)
|
|
.background {
|
|
switch debridManager.matchSearchResult(result: result) {
|
|
case .full:
|
|
Color.green
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
case .partial:
|
|
Color.orange
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
case .none:
|
|
Color.red
|
|
.cornerRadius(4)
|
|
.opacity(0.5)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.font(.caption)
|
|
}
|
|
}
|