Skip to content

feat: update the support tab's design. #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Mythic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3293;
CURRENT_PROJECT_VERSION = 3878;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
Expand Down Expand Up @@ -852,7 +852,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3293;
CURRENT_PROJECT_VERSION = 3878;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_ASSET_PATHS = "\"Mythic/Preview Content\"";
Expand Down
36 changes: 33 additions & 3 deletions Mythic/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2587,13 +2587,13 @@
"value" : "%1$@ \"%2$@\"..."
}
},
"nl" : {
"nb" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@ \"%2$@\"..."
}
},
"no" : {
"nl" : {
"stringUnit" : {
"state" : "new",
"value" : "%1$@ \"%2$@\"..."
Expand Down Expand Up @@ -10127,6 +10127,9 @@
},
"Discord" : {

},
"Discord Server" : {

},
"Disk Speed:" : {
"localizations" : {
Expand Down Expand Up @@ -14518,6 +14521,9 @@
},
"Force Quit Running Windows® Applications" : {

},
"Game Compatibility list" : {

},
"Game Location:" : {
"localizations" : {
Expand Down Expand Up @@ -15097,6 +15103,12 @@
}
}
}
},
"Get the help you need" : {

},
"GitHub Repository" : {

},
"Grid" : {
"localizations" : {
Expand Down Expand Up @@ -19280,6 +19292,9 @@
}
}
}
},
"Join the Discord Server" : {

},
"Launch Arguments" : {
"localizations" : {
Expand Down Expand Up @@ -22329,6 +22344,9 @@
},
"Mythic %@" : {

},
"Mythic Documentation" : {

},
"Mythic Engine" : {
"localizations" : {
Expand Down Expand Up @@ -26141,6 +26159,9 @@
}
}
}
},
"Please consider donating!" : {

},
"Preview" : {
"comment" : "Within the context of Mythic Engine",
Expand Down Expand Up @@ -26908,6 +26929,9 @@
},
"Quit games running in this container?" : {

},
"Read the documentation" : {

},
"Remove" : {
"localizations" : {
Expand Down Expand Up @@ -27668,6 +27692,9 @@
}
}
}
},
"Report an issue on GitHub" : {

},
"Reset" : {
"localizations" : {
Expand Down Expand Up @@ -38719,6 +38746,9 @@
}
}
}
},
"What's new in Mythic" : {

},
"Where do you want the container's base path to be located?" : {
"localizations" : {
Expand Down Expand Up @@ -40432,4 +40462,4 @@
}
},
"version" : "1.0"
}
}
33 changes: 32 additions & 1 deletion Mythic/MythicApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct MythicApp: App {
}
}
}

.handlesExternalEvents(matching: ["open"])
.environment(
\.whatsNew,
Expand All @@ -77,9 +78,39 @@ struct MythicApp: App {
Button("Restart Onboarding...") {
withAnimation(.easeInOut(duration: 2)) {
isOnboardingPresented = true
}
}
.disabled(isOnboardingPresented)
}

CommandGroup(replacing: .help){
Button("Mythic Documentation") {
if let docUrl = URL(string: "https://docs.getmythic.app/") {
NSWorkspace.shared.open(docUrl)
}
}
Button("Discord Server") {
if let discordInviteUrl = URL(string: "https://discord.com/invite/58NZ7fFqPy") {
NSWorkspace.shared.open(discordInviteUrl)
}
}
Button("GitHub Repository") {
if let githubUrl = URL(string: "https://github.com/MythicApp/Mythic") {
NSWorkspace.shared.open(githubUrl)
}
}
Divider()
Button("What's new in Mythic") {
if let whatsNewUrl = URL(string: "https://github.com/MythicApp/Mythic/releases") {
NSWorkspace.shared.open(whatsNewUrl)
}
}
Divider()
Button("Please consider donating!") {
if let donationUrl = URL(string: "https://ko-fi.com/vapidinfinity") {
NSWorkspace.shared.open(donationUrl)
}
}
.disabled(isOnboardingPresented)
}
}

Expand Down
161 changes: 130 additions & 31 deletions Mythic/Views/Navigation/SupportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,23 @@
// You can fold these comments by pressing [⌃ ⇧ ⌘ ◀︎], unfold with [⌃ ⇧ ⌘ ▶︎]

import SwiftUI
import Shimmer
import SwordRPC
import ColorfulX

struct SupportView: View {

@Environment(\.colorScheme) var colorScheme

@State private var colorfulAnimationColors: [Color] = [
.init(hex: "#5412F6"),
.init(hex: "#7E1ED8"),
.init(hex: "#2C2C2C")
]
@State private var colorfulAnimationSpeed: Double = 1
@State private var colorfulAnimationNoise: Double = 0

@State private var expandedItemIDs = Set<UUID>()

private var colorSchemeValue: String {
switch colorScheme {
case .light: return "light"
Expand All @@ -29,56 +40,144 @@ struct SupportView: View {
}
}

private enum Constants {
static let documentationURL = "https://docs.getmythic.app/"
static let discordInviteURL = "https://discord.gg/kQKdvjTVqh"
static let githubIssuesURL = "https://github.com/MythicApp/Mythic/issues" // https://github.com/MythicApp/Mythic/issues/new/choose
static let compatibilityListURL = "https://docs.google.com/spreadsheets/d/1W_1UexC1VOcbP2CHhoZBR5-8koH-ZPxJBDWntwH-tsc/edit?gid=0#gid=0"
static let kofiURL = "https://ko-fi.com/vapidinfinity"
}

// TODO: implement dynamic FAQ endpoint at getmythic.app, and FAQItem decoder
private let faqItems: [FAQItem] = []

var body: some View {
HStack {
VStack {
WebView(
url: .init(string: "https://discord.com/widget?id=1154998702650425397&theme=\(colorSchemeValue)")!,
error: .constant(nil),
isLoading: .constant(nil)
)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.background)
.clipShape(.rect(cornerRadius: 10))

VStack {
if let patreonURL: URL = .init(string: /* temp comment "https://patreon.com/mythicapp" */ "https://ko-fi.com/vapidinfinity") {
WebView(url: patreonURL, error: .constant(nil), isLoading: .constant(nil))
.overlay(alignment: .bottomTrailing) {
Button {
workspace.open(patreonURL)
} label: {
Image(systemName: "arrow.up.forward")
.padding(5)
ZStack {
ColorfulView(
color: $colorfulAnimationColors,
speed: $colorfulAnimationSpeed,
noise: $colorfulAnimationNoise
)
.ignoresSafeArea()

ScrollView {
VStack {
HStack {
Button {
if let url = URL(string: Constants.documentationURL) {
NSWorkspace.shared.open(url)
}
} label: {
VStack(alignment: .leading, spacing: 4) {
Text("Get the help you need")
.font(.largeTitle)
.foregroundColor(.white)
.fontWeight(.bold)

Label("Read the documentation", systemImage: "link")
}
.clipShape(.circle)
}
.buttonStyle(DocsButton())

Spacer()

Image(nsImage: NSImage(named: "MythicIcon") ?? NSImage())
.resizable()
.aspectRatio(1, contentMode: .fit)
.padding()
}
.frame(maxHeight: 300)
.padding()

Spacer()

Divider()
.padding(.horizontal)

HStack {
Button {
if let url = URL(string: Constants.discordInviteURL) {
NSWorkspace.shared.open(url)
}
} label: {
Label("Join the Discord Server", systemImage: "link")
.fontWeight(.semibold)
}
.buttonStyle(DocsButton())

Button {
if let url = URL(string: Constants.githubIssuesURL) {
NSWorkspace.shared.open(url)
}
} label: {
Label("Report an issue on GitHub", systemImage: "link")
.fontWeight(.semibold)
}
.buttonStyle(DocsButton())

Button {
if let url = URL(string: Constants.compatibilityListURL) {
NSWorkspace.shared.open(url)
}
} label: {
Label("Game Compatibility list", systemImage: "link")
.fontWeight(.semibold)
}
.buttonStyle(DocsButton())

Button {
if let url = URL(string: Constants.kofiURL) {
NSWorkspace.shared.open(url)
}
} label: {
Label("Please consider donating!", systemImage: "link")
.fontWeight(.semibold)
}
.buttonStyle(DocsButton())
}
.padding()
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.background)
.clipShape(.rect(cornerRadius: 10))
}
.padding()

.task(priority: .background) {
// Set rich presence using SwordRPC
discordRPC.setPresence({
var presence: RichPresence = .init()
var presence = RichPresence()
presence.details = "Looking for help"
presence.state = "Viewing Support"
presence.timestamps.start = .now
presence.assets.largeImage = "macos_512x512_2x"

return presence
}())
}

.navigationTitle("Support")
}
}

struct DocsButton: ButtonStyle {
@State private var isHovering = false

func makeBody(configuration: Configuration) -> some View {
configuration.label
.padding()
.buttonStyle(.bordered)
.background(.fill)
.clipShape(.rect(cornerRadius: 20))
.shadow(color: .accent.opacity(isHovering ? 1 : 0), radius: isHovering ? 12 : 0)
.scaleEffect(isHovering ? 1.05 : 1)
.animation(.spring, value: isHovering)
.onHover { hovering in
isHovering = hovering
}
}
}

struct FAQItem: Identifiable {
let id = UUID()
let question: String
let answer: String
}

#Preview {
SupportView()
}
1 change: 1 addition & 0 deletions Mythic/Views/Unified/Modules/GameListCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct GameListCard: View {
.blur(radius: 20.0)
.clipShape(.rect(cornerRadius: 20))
.modifier(FadeInModifier())
.opacity(0.5)
.onAppear {
withAnimation { isImageEmpty = false }
}
Expand Down