Skip to content
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

Redesigned About Window #1000

Merged
merged 9 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
92 changes: 42 additions & 50 deletions CodeEdit/Features/About/Views/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,60 @@ public struct AboutView: View {
Bundle.versionPostfix ?? ""
}

public var body: some View {
HStack(spacing: 0) {
logo
VStack(alignment: .leading, spacing: 0) {
topMetaData
Spacer()
bottomMetaData
actionButtons
}
.padding([.trailing, .vertical])
}
.background(.regularMaterial)
.edgesIgnoringSafeArea(.top)
}
private static var licenseURL = URL(string: "https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md")!

// MARK: Sub-Views
public var body: some View {
VStack(spacing: 0) {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 70, height: 70)

private var logo: some View {
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 128, height: 128)
.padding(32)
}
Text("CodeEdit")
.font(.largeTitle)
.fontWeight(.bold)

private var topMetaData: some View {
VStack(alignment: .leading, spacing: 5) {
Text("CodeEdit").font(.system(size: 38, weight: .regular))
Text("Version \(appVersion)\(appVersionPostfix) (\(appBuild))")
.textSelection(.enabled)
.foregroundColor(.secondary)
.font(.system(size: 13, weight: .light))
}
}
.font(.caption)
.padding(.vertical, 2)

private var bottomMetaData: some View {
VStack(alignment: .leading, spacing: 5) {
if let copyright = Bundle.copyrightString {
Text(copyright)
}
Text("MIT License")
}
.foregroundColor(.secondary)
.font(.system(size: 9, weight: .light))
.padding(.bottom, 10)
}
VStack {
Button {

} label: {
Text("Contributors")
.foregroundColor(.primary)
}

private var actionButtons: some View {
HStack {
Button {
AcknowledgementsView().showWindow(width: 300, height: 400)
} label: {
Text("Acknowledgements")
.foregroundColor(.primary)
Button {
AcknowledgementsView().showWindow(width: 300, height: 400)
} label: {
Text("Acknowledgements")
.foregroundColor(.primary)
}
}
.padding(.vertical)

Link(destination: Self.licenseURL) {
Text("MIT License")
.underline()
.font(.caption)
.textSelection(.disabled)
.foregroundColor(.secondary)

Button {
openURL(URL(string: "https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md")!)
} label: {
Text("License Agreement")
.foregroundColor(.primary)
}

Text(Bundle.copyrightString ?? "")
.textSelection(.disabled)
.foregroundColor(.secondary)
.font(.caption)
}
.padding(.horizontal, 50)
.padding(.bottom, 20)
.padding(.top, 10)
.fixedSize()
.background(.regularMaterial)
}

public func showWindow(width: CGFloat, height: CGFloat) {
Expand Down
1 change: 0 additions & 1 deletion CodeEdit/Features/About/Views/AboutWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ final class AboutViewWindowController: NSWindowController {
// New window holding our SwiftUI view
let window = NSWindow(contentViewController: hostingController)
self.init(window: window)
window.setContentSize(size)
window.styleMask = [.closable, .fullSizeContentView, .titled, .nonactivatingPanel]
window.standardWindowButton(.miniaturizeButton)?.isHidden = true
window.standardWindowButton(.zoomButton)?.isHidden = true
Expand Down