Skip to content

Commit b630973

Browse files
Made design improvements to About and Acknowledgements windows (#1003)
* Made design improvements to About and Acknowledgements windows * Added line to make title bold * Fixed footer legal text style and improved vibrancy effect to use popover material. * Increased gray opacity for windows * Added divider on scroll in Acknowledgments window * Made small fix to title and background in Contributors window * Merged latest changes in * Broke out AcknowledgementRow into its own file * Added indexedAcknowledgements to view model * Used indexedAcknowledgements in ForEach in AcknowledgmentsView
1 parent 531221c commit b630973

8 files changed

Lines changed: 117 additions & 59 deletions

File tree

CodeEdit.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@
322322
6C97EBCF297876E500302F95 /* AboutWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C97EBCE297876E500302F95 /* AboutWindowController.swift */; };
323323
6CBD1BC62978DE53006639D5 /* Font+Caption3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */; };
324324
6CDA84AD284C1BA000C1CC3A /* TabBarContextMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CDA84AC284C1BA000C1CC3A /* TabBarContextMenu.swift */; };
325+
B60BE8BD297A167600841125 /* AcknowledgementRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */; };
325326
B62617282964924E00E866AB /* CodeEditKit in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 2801BB89290D5A8E00EBF552 /* CodeEditKit */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
326327
B658FB3427DA9E1000EA4DBD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3327DA9E1000EA4DBD /* Assets.xcassets */; };
327328
B658FB3727DA9E1000EA4DBD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3627DA9E1000EA4DBD /* Preview Assets.xcassets */; };
@@ -708,6 +709,7 @@
708709
6C97EBCE297876E500302F95 /* AboutWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutWindowController.swift; sourceTree = "<group>"; };
709710
6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Caption3.swift"; sourceTree = "<group>"; };
710711
6CDA84AC284C1BA000C1CC3A /* TabBarContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarContextMenu.swift; sourceTree = "<group>"; };
712+
B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementRowView.swift; sourceTree = "<group>"; };
711713
B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeEdit.app; sourceTree = BUILT_PRODUCTS_DIR; };
712714
B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceView.swift; sourceTree = "<group>"; tabWidth = 4; };
713715
B658FB3327DA9E1000EA4DBD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -1253,6 +1255,7 @@
12531255
isa = PBXGroup;
12541256
children = (
12551257
5878DA81291863F900DD95A3 /* AcknowledgementsView.swift */,
1258+
B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */,
12561259
6C97EBCB2978760400302F95 /* AcknowledgementsWindowController.swift */,
12571260
5878DA832918642000DD95A3 /* ParsePackagesResolved.swift */,
12581261
);
@@ -2727,6 +2730,7 @@
27272730
5C4BB1E128212B1E00A92FB2 /* World.swift in Sources */,
27282731
D7E201B227E8D50000CB86D0 /* FindNavigatorModeSelector.swift in Sources */,
27292732
287776E927E34BC700D46668 /* TabBarView.swift in Sources */,
2733+
B60BE8BD297A167600841125 /* AcknowledgementRowView.swift in Sources */,
27302734
587B9E6329301D8F00AC7927 /* GitLabAccount.swift in Sources */,
27312735
285FEC7027FE4B9800E57D53 /* OutlineTableViewCell.swift in Sources */,
27322736
58F2EAF8292FB2B0004A9BDE /* AccountListItemView.swift in Sources */,

CodeEdit/Features/About/Views/AboutView.swift

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import SwiftUI
99

1010
public struct AboutView: View {
1111
@Environment(\.openURL) private var openURL
12+
@Environment(\.colorScheme) private var colorScheme
1213

1314
public init() {}
1415

@@ -27,22 +28,26 @@ public struct AboutView: View {
2728
private static var licenseURL = URL(string: "https://github.com/CodeEditApp/CodeEdit/blob/main/LICENSE.md")!
2829

2930
public var body: some View {
30-
VStack(spacing: 0) {
31-
Image(nsImage: NSApp.applicationIconImage)
32-
.resizable()
33-
.frame(width: 64, height: 64)
34-
.padding(.top, 9)
35-
.padding(.bottom, 10)
36-
37-
Text("CodeEdit")
38-
.font(.title)
39-
.fontWeight(.bold)
31+
VStack(spacing: 32) {
32+
VStack(spacing: 0) {
33+
Image(nsImage: NSApp.applicationIconImage)
34+
.resizable()
35+
.frame(width: 128, height: 128)
36+
.padding(.bottom, 8)
37+
38+
VStack(spacing: 4) {
39+
Text("CodeEdit")
40+
.font(.largeTitle)
41+
.fontWeight(.bold)
42+
.foregroundColor(.primary)
4043

41-
Text("Version \(appVersion)\(appVersionPostfix) (\(appBuild))")
42-
.textSelection(.enabled)
43-
.foregroundColor(.secondary)
44-
.font(.caption2)
45-
.padding(.vertical, 3)
44+
Text("Version \(appVersion)\(appVersionPostfix) (\(appBuild))")
45+
.textSelection(.enabled)
46+
.foregroundColor(Color(.tertiaryLabelColor))
47+
.font(.body)
48+
.blendMode(colorScheme == .dark ? .plusLighter : .plusDarker)
49+
}
50+
}
4651

4752
VStack {
4853
Button {
@@ -52,7 +57,6 @@ public struct AboutView: View {
5257
.foregroundColor(.primary)
5358
.frame(maxWidth: .infinity)
5459
}
55-
5660
.controlSize(.large)
5761

5862
Button {
@@ -63,27 +67,30 @@ public struct AboutView: View {
6367
.frame(maxWidth: .infinity)
6468
}
6569
.controlSize(.large)
66-
}
67-
.padding(.vertical)
6870

69-
Link(destination: Self.licenseURL) {
70-
Text("MIT License")
71-
.underline()
72-
.font(.caption3)
73-
.textSelection(.disabled)
74-
.foregroundColor(.secondary)
75-
}
76-
.padding(.vertical, 2)
71+
VStack(spacing: 2) {
72+
Link(destination: Self.licenseURL) {
73+
Text("MIT License")
74+
.underline()
7775

78-
Text(Bundle.copyrightString ?? "")
76+
}
77+
Text(Bundle.copyrightString ?? "")
78+
}
7979
.textSelection(.disabled)
80-
.foregroundColor(.secondary)
81-
.font(.caption3)
80+
.font(.system(size: 11, weight: .regular))
81+
.foregroundColor(Color(.tertiaryLabelColor))
82+
.blendMode(colorScheme == .dark ? .plusLighter : .plusDarker)
83+
.padding(.top, 12)
84+
.padding(.bottom, 8)
85+
}
8286
}
83-
.padding([.horizontal, .bottom], 16)
87+
.padding(16)
8488
.frame(width: 280)
8589
.fixedSize()
86-
.background(.regularMaterial)
90+
// hack required to get buttons appearing correctly in light appearance
91+
// if anyone knows of a better way to do this feel free to refactor
92+
.background(.regularMaterial.opacity(0))
93+
.background(EffectView(.popover, blendingMode: .behindWindow).ignoresSafeArea())
8794
}
8895

8996
public func showWindow(width: CGFloat, height: CGFloat) {

CodeEdit/Features/About/Views/AboutWindowController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class AboutViewWindowController: NSWindowController {
1818
window.standardWindowButton(.zoomButton)?.isHidden = true
1919
window.titlebarAppearsTransparent = true
2020
window.titleVisibility = .hidden
21-
window.backgroundColor = .gray.withAlphaComponent(0.2)
21+
window.backgroundColor = .gray.withAlphaComponent(0.15)
2222
}
2323

2424
override func showWindow(_ sender: Any?) {

CodeEdit/Features/Acknowledgements/ViewModels/AcknowledgementsViewModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ final class AcknowledgementsViewModel: ObservableObject {
1212
@Published
1313
private (set) var acknowledgements: [AcknowledgementDependency]
1414

15+
var indexedAcknowledgements: [(index: Int, acknowledgement: AcknowledgementDependency)] {
16+
return Array(zip(acknowledgements.indices, acknowledgements))
17+
}
18+
1519
init(_ dependencies: [AcknowledgementDependency] = []) {
1620
self.acknowledgements = dependencies
1721

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// AcknowledgementsRowView.swift
3+
// CodeEdit
4+
//
5+
// Created by Austin Condiff on 1/19/23.
6+
//
7+
8+
import SwiftUI
9+
10+
struct AcknowledgementRowView: View {
11+
@Environment(\.openURL) private var openURL
12+
13+
let acknowledgement: AcknowledgementDependency
14+
15+
var body: some View {
16+
HStack {
17+
Text(acknowledgement.name)
18+
.font(.body)
19+
20+
Spacer()
21+
22+
Button {
23+
openURL(acknowledgement.repositoryURL)
24+
} label: {
25+
Image(systemName: "arrow.right.circle.fill")
26+
.foregroundColor(Color(nsColor: .tertiaryLabelColor))
27+
}
28+
.buttonStyle(.plain)
29+
}
30+
.padding(.vertical, 8)
31+
.frame(maxWidth: .infinity)
32+
}
33+
}
34+
35+
struct AcknowledgementsRowView_Previews: PreviewProvider {
36+
static var previews: some View {
37+
AcknowledgementRowView(acknowledgement: AcknowledgementDependency(
38+
name: "Test",
39+
repositoryLink: "https://www.test.com/",
40+
version: "-"
41+
))
42+
}
43+
}

CodeEdit/Features/Acknowledgements/Views/AcknowledgementsView.swift

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,43 @@
88
import SwiftUI
99

1010
struct AcknowledgementsView: View {
11-
12-
@Environment(\.openURL) private var openURL
13-
1411
@ObservedObject
1512
private var model = AcknowledgementsViewModel()
1613

14+
@State private var displayDivider = false
15+
1716
var body: some View {
18-
VStack {
17+
VStack(spacing: 0) {
1918
Image(nsImage: NSApp.applicationIconImage)
2019
.resizable()
21-
.frame(width: 70, height: 70)
20+
.frame(width: 48, height: 48)
2221
Text("Acknowledgements")
23-
.font(.largeTitle)
22+
.font(.title)
2423
.fontWeight(.bold)
25-
ScrollView {
26-
ForEach(model.acknowledgements, id: \.name) { acknowledgement in
27-
HStack {
28-
Text(acknowledgement.name)
29-
.font(.title3)
30-
.fontWeight(.semibold)
31-
32-
Spacer()
33-
34-
Button {
35-
openURL(acknowledgement.repositoryURL)
36-
} label: {
37-
Image(systemName: "arrow.right.circle.fill")
38-
.foregroundColor(Color(nsColor: .tertiaryLabelColor))
24+
.padding(.vertical, 8)
25+
Divider()
26+
.opacity(displayDivider ? 1 : 0)
27+
OffsettableScrollView(showsIndicator: false) { offset in
28+
displayDivider = offset.y < 0
29+
} content: {
30+
LazyVStack(spacing: 0) {
31+
ForEach(
32+
model.indexedAcknowledgements,
33+
id: \.acknowledgement.name
34+
) { (index, acknowledgement) in
35+
if index != 0 {
36+
Divider()
37+
.frame(height: 0.5)
38+
.opacity(0.5)
3939
}
40-
.buttonStyle(.plain)
40+
AcknowledgementRowView(acknowledgement: acknowledgement)
4141
}
42-
.frame(width: 200)
43-
.padding(.vertical, 2)
4442
}
4543
}
44+
.padding(.horizontal, 16)
4645
}
47-
.frame(width: 350, height: 420)
48-
.background(.regularMaterial)
46+
.frame(width: 280, height: 400)
47+
.background(EffectView(.popover, blendingMode: .behindWindow).ignoresSafeArea())
4948
}
5049

5150
func showWindow(width: CGFloat, height: CGFloat) {

CodeEdit/Features/Acknowledgements/Views/AcknowledgementsWindowController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class AcknowledgementsViewWindowController: NSWindowController {
1919
window.standardWindowButton(.zoomButton)?.isHidden = true
2020
window.titlebarAppearsTransparent = true
2121
window.titleVisibility = .hidden
22-
window.backgroundColor = .gray.withAlphaComponent(0.2)
22+
window.backgroundColor = .gray.withAlphaComponent(0.15)
2323
}
2424

2525
override func showWindow(_ sender: Any?) {

CodeEdit/Features/Contributors/ContributorsView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ struct ContributorsView: View {
1919
.frame(width: 48, height: 48)
2020
Text("Contributors")
2121
.font(.title)
22+
.fontWeight(.bold)
2223
.padding(.vertical, 8)
2324
Divider()
2425
.opacity(displayDivider ? 1 : 0)
@@ -37,7 +38,7 @@ struct ContributorsView: View {
3738
}
3839
}
3940
.frame(width: 280, height: 400)
40-
.background(.regularMaterial)
41+
.background(EffectView(.popover, blendingMode: .behindWindow).ignoresSafeArea())
4142
.task {
4243
viewModel.loadContributors()
4344
}

0 commit comments

Comments
 (0)