mirror of
https://github.com/pawelorzech/MacTorn.git
synced 2026-01-30 04:04:27 +00:00
feat: Populate Credits page with real data
- Add bombel as developer/creator with highlighted section - Add Special Thanks: kaszmir, dylanwishop, constanziagatta - Add faction link: The Masters - Add company link: Glory Holes Productions - All entries link to respective Torn pages
This commit is contained in:
parent
14439f50ff
commit
bab929df98
1 changed files with 141 additions and 39 deletions
|
|
@ -3,23 +3,23 @@ import SwiftUI
|
||||||
struct CreditsView: View {
|
struct CreditsView: View {
|
||||||
@Binding var showCredits: Bool
|
@Binding var showCredits: Bool
|
||||||
|
|
||||||
// MARK: - Contributors Data
|
// MARK: - Developer
|
||||||
// Format: (name: "Username", tornID: 123456)
|
private let developer = TornContributor(name: "bombel", tornID: 2362436)
|
||||||
// The tornID will automatically link to the Torn profile
|
|
||||||
|
|
||||||
|
// MARK: - Special Thanks
|
||||||
private let specialThanks: [TornContributor] = [
|
private let specialThanks: [TornContributor] = [
|
||||||
// TODO: Add contributors here
|
TornContributor(name: "kaszmir", tornID: 3913934),
|
||||||
// Example: TornContributor(name: "bombel", tornID: 2362436),
|
TornContributor(name: "dylanwishop", tornID: 3918903),
|
||||||
TornContributor(name: "Placeholder1", tornID: nil),
|
TornContributor(name: "constanziagatta", tornID: 3961012),
|
||||||
TornContributor(name: "Placeholder2", tornID: nil),
|
|
||||||
TornContributor(name: "Placeholder3", tornID: nil),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
private let testers: [TornContributor] = [
|
// MARK: - Faction
|
||||||
// TODO: Add testers here
|
private let factionName = "The Masters"
|
||||||
TornContributor(name: "TesterPlaceholder1", tornID: nil),
|
private let factionID = 11559
|
||||||
TornContributor(name: "TesterPlaceholder2", tornID: nil),
|
|
||||||
]
|
// MARK: - Company
|
||||||
|
private let companyName = "Glory Holes Productions"
|
||||||
|
private let companyOwnerID = 2362436
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 16) {
|
||||||
|
|
@ -37,39 +37,31 @@ struct CreditsView: View {
|
||||||
|
|
||||||
Text("Credits")
|
Text("Credits")
|
||||||
.font(.title2.bold())
|
.font(.title2.bold())
|
||||||
|
|
||||||
Text("Thank you for your support!")
|
|
||||||
.font(.caption)
|
|
||||||
.foregroundColor(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(spacing: 16) {
|
VStack(spacing: 14) {
|
||||||
// Special Thanks Section
|
// Developer Section
|
||||||
if !specialThanks.isEmpty {
|
developerSection
|
||||||
contributorSection(
|
|
||||||
title: "Special Thanks",
|
|
||||||
icon: "star.fill",
|
|
||||||
iconColor: .yellow,
|
|
||||||
contributors: specialThanks
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Testers Section
|
// Special Thanks Section
|
||||||
if !testers.isEmpty {
|
contributorSection(
|
||||||
contributorSection(
|
title: "Special Thanks",
|
||||||
title: "Beta Testers",
|
icon: "star.fill",
|
||||||
icon: "checkmark.seal.fill",
|
iconColor: .yellow,
|
||||||
iconColor: .green,
|
contributors: specialThanks
|
||||||
contributors: testers
|
)
|
||||||
)
|
|
||||||
}
|
// Faction Section
|
||||||
|
factionSection
|
||||||
|
|
||||||
|
// Company Section
|
||||||
|
companySection
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
}
|
}
|
||||||
.frame(maxHeight: 200)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
|
|
@ -90,7 +82,103 @@ struct CreditsView: View {
|
||||||
.frame(width: 320)
|
.frame(width: 320)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Section View
|
// MARK: - Developer Section
|
||||||
|
private var developerSection: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "hammer.fill")
|
||||||
|
.foregroundColor(.orange)
|
||||||
|
Text("Created by")
|
||||||
|
.font(.subheadline.bold())
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
openTornProfile(developer.tornID!)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Text(developer.name)
|
||||||
|
.font(.caption.bold())
|
||||||
|
Spacer()
|
||||||
|
Image(systemName: "arrow.up.right.square")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
.padding(10)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.background(Color.orange.opacity(0.1))
|
||||||
|
.cornerRadius(8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Faction Section
|
||||||
|
private var factionSection: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "shield.fill")
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
Text("Faction")
|
||||||
|
.font(.subheadline.bold())
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
openFaction(factionID)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Text(factionName)
|
||||||
|
.font(.caption)
|
||||||
|
Spacer()
|
||||||
|
Image(systemName: "arrow.up.right.square")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
.padding(10)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.background(Color.secondary.opacity(0.1))
|
||||||
|
.cornerRadius(8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Company Section
|
||||||
|
private var companySection: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
HStack(spacing: 6) {
|
||||||
|
Image(systemName: "building.2.fill")
|
||||||
|
.foregroundColor(.purple)
|
||||||
|
Text("Company")
|
||||||
|
.font(.subheadline.bold())
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
openCompany(companyOwnerID)
|
||||||
|
} label: {
|
||||||
|
HStack {
|
||||||
|
Text(companyName)
|
||||||
|
.font(.caption)
|
||||||
|
Spacer()
|
||||||
|
Image(systemName: "arrow.up.right.square")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
}
|
||||||
|
.contentShape(Rectangle())
|
||||||
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
|
.padding(10)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.background(Color.secondary.opacity(0.1))
|
||||||
|
.cornerRadius(8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Contributors Section
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func contributorSection(
|
private func contributorSection(
|
||||||
title: String,
|
title: String,
|
||||||
|
|
@ -147,13 +235,27 @@ struct CreditsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Helper
|
// MARK: - URL Helpers
|
||||||
private func openTornProfile(_ tornID: Int) {
|
private func openTornProfile(_ tornID: Int) {
|
||||||
let urlString = "https://www.torn.com/profiles.php?XID=\(tornID)"
|
let urlString = "https://www.torn.com/profiles.php?XID=\(tornID)"
|
||||||
if let url = URL(string: urlString) {
|
if let url = URL(string: urlString) {
|
||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func openFaction(_ factionID: Int) {
|
||||||
|
let urlString = "https://www.torn.com/factions.php?step=profile&ID=\(factionID)"
|
||||||
|
if let url = URL(string: urlString) {
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func openCompany(_ ownerID: Int) {
|
||||||
|
let urlString = "https://www.torn.com/joblist.php#/p=corpinfo&userID=\(ownerID)"
|
||||||
|
if let url = URL(string: urlString) {
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Contributor Model
|
// MARK: - Contributor Model
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue