Skip to content

Commit

Permalink
Update What’s New panel
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Aug 8, 2024
1 parent 6d4817c commit be5579c
Showing 1 changed file with 18 additions and 44 deletions.
62 changes: 18 additions & 44 deletions CotEditor/Sources/WhatsNewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ struct WhatsNewView: View {
.accessibilityAddTraits(.isHeader)
.accessibilityHeading(.h1)

Grid(alignment: .leading, verticalSpacing: 12) {
VStack(alignment: .leading, spacing: 16) {
ForEach(NewFeature.allCases, id: \.self) { feature in
GridRow {
HStack {
feature.image
.font(.system(size: 48, weight: .thin))
.foregroundStyle(.tint)
.gridColumnAlignment(.center)
.frame(width: 64, alignment: .center)

VStack(alignment: .leading) {
Text(feature.label)
Expand All @@ -57,6 +57,7 @@ struct WhatsNewView: View {
.accessibilityHeading(.h2)

Text(feature.description)
.fixedSize(horizontal: false, vertical: true)
.opacity(0.75)

feature.supplementalView
Expand Down Expand Up @@ -86,44 +87,17 @@ struct WhatsNewView: View {
.keyboardShortcut(.cancelAction)
.buttonStyle(.borderedProminent)
}
.scenePadding()
.frame(maxWidth: 580)
.padding(.horizontal)
.padding(.top, 30) // for balancing with window titlebar space
.ignoresSafeArea()
.scenePadding()
.frame(width: 580)
.ignoresSafeArea(edges: .top)
.background {
Image(systemName: "gearshape.2")
.font(.system(size: 750, weight: .ultraLight))
.rotationEffect(.degrees(180))
.opacity(0.02)
}
.background()
}
}


private struct SectionView<Content: View>: View {

var title: String
var image: Image
@ViewBuilder var content: () -> Content

var body: some View {

VStack {
self.image
.font(.system(size: 56, weight: .thin))
.foregroundStyle(.tint)
.frame(height: 64)

Text(self.title)
.font(.title3)
.fontWeight(.medium)
.accessibilityAddTraits(.isHeader)
.accessibilityHeading(.h2)
.padding(.vertical, 2)

self.content()
.fixedSize(horizontal: false, vertical: true)
.background()
}
}
}
Expand All @@ -133,18 +107,18 @@ private enum NewFeature: CaseIterable {

static let version = "5.0"

case macOSSupport
case folderNavigation
case macOSSupport
case donation


var image: Image {

switch self {
case .macOSSupport:
Image(systemName: "sparkles")
case .folderNavigation:
Image(systemName: "folder")
case .macOSSupport:
Image(systemName: "sparkles")
case .donation:
Image(.bagCoffee)
}
Expand All @@ -154,12 +128,12 @@ private enum NewFeature: CaseIterable {
var label: String {

switch self {
case .macOSSupport:
String(localized: "NewFeature.macOSSupport.label",
defaultValue: "macOS 15 Sequoia Support", table: "WhatsNew")
case .folderNavigation:
String(localized: "NewFeature.folderNavigation.label",
defaultValue: "Folder Navigation", table: "WhatsNew")
case .macOSSupport:
String(localized: "NewFeature.macOSSupport.label",
defaultValue: "macOS 15 Sequoia Support", table: "WhatsNew")
case .donation:
String(localized: "NewFeature.donation.label",
defaultValue: "Donation", table: "WhatsNew")
Expand All @@ -170,12 +144,12 @@ private enum NewFeature: CaseIterable {
var description: String {

switch self {
case .macOSSupport:
String(localized: "NewFeature.macOSSupport.description",
defaultValue: "Work perfectly with new macOS 15.", table: "WhatsNew")
case .folderNavigation:
String(localized: "NewFeature.folderNavigation.description",
defaultValue: "Open a folder in CotEditor to navigate its contents in the new sidebar.", table: "WhatsNew")
case .macOSSupport:
String(localized: "NewFeature.macOSSupport.description",
defaultValue: "Work perfectly with new macOS 15.", table: "WhatsNew")
case .donation:
String(localized: "NewFeature.donation.description",
defaultValue: "Support the CotEditor project by offering coffee to the developer.", table: "WhatsNew")
Expand Down

0 comments on commit be5579c

Please sign in to comment.