Enlarge Mac UI density for readable desktop layouts.

Bump typography, controls, path-map nodes, and window size so macOS no longer feels phone-scaled.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
pepaskopec-blip 2026-09-22 12:48:28 +02:00
commit cc4415a8a6
6 changed files with 376 additions and 98 deletions

View file

@ -8,6 +8,10 @@ struct MaturitaApp: App {
WindowGroup { WindowGroup {
NativeRoot(vm: vm) NativeRoot(vm: vm)
} }
#if os(macOS)
.defaultSize(width: 1280, height: 840)
.windowResizability(.contentMinSize)
#endif
} }
} }
@ -25,6 +29,9 @@ struct NativeRoot: View {
.tint(vm.palette.tint) .tint(vm.palette.tint)
.preferredColorScheme(vm.mode == .dark ? .dark : .light) .preferredColorScheme(vm.mode == .dark ? .dark : .light)
.onAppear { vm.checkUpdate(false) } .onAppear { vm.checkUpdate(false) }
#if os(macOS)
.frame(minWidth: 980, minHeight: 640)
#endif
} }
private var showsUpdateAccessory: Bool { private var showsUpdateAccessory: Bool {
@ -68,11 +75,18 @@ private struct UpdateAccessory: View {
var body: some View { var body: some View {
HStack { HStack {
Text(bannerText) Text(bannerText)
#if os(macOS)
.font(.body)
#else
.font(.subheadline) .font(.subheadline)
#endif
Spacer() Spacer()
if vm.update.canInstall { if vm.update.canInstall {
Button(vm.tr("update_install")) { vm.installUpdate() } Button(vm.tr("update_install")) { vm.installUpdate() }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
#if os(macOS)
.controlSize(.large)
#endif
} }
} }
.padding(.horizontal, 4) .padding(.horizontal, 4)

View file

@ -1,5 +1,17 @@
import SwiftUI import SwiftUI
#if os(macOS)
enum MacChrome {
static let contentMaxWidth: CGFloat = 1080
static let exerciseMaxWidth: CGFloat = 900
static let cardPadding: CGFloat = 24
static let listRowMinHeight: CGFloat = 52
static let homeTileMin: CGFloat = 260
static let homeTileHeight: CGFloat = 176
static let pathNode: CGFloat = 84
}
#endif
struct FlowLayout: Layout { struct FlowLayout: Layout {
var spacing: CGFloat = 6 var spacing: CGFloat = 6
@ -48,6 +60,9 @@ struct PrimaryButton: View {
Text(label) Text(label)
.font(.body.weight(.semibold)) .font(.body.weight(.semibold))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
#if os(macOS)
.padding(.vertical, 4)
#endif
} }
#if os(macOS) #if os(macOS)
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
@ -66,6 +81,9 @@ struct PillButton: View {
var body: some View { var body: some View {
Button(label, action: action) Button(label, action: action)
.buttonStyle(.bordered) .buttonStyle(.bordered)
#if os(macOS)
.controlSize(.large)
#endif
} }
} }
@ -74,7 +92,11 @@ struct GlassCard<Content: View>: View {
var body: some View { var body: some View {
content() content()
#if os(macOS)
.padding(MacChrome.cardPadding)
#else
.padding(16) .padding(16)
#endif
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
.softSurface(cornerRadius: 22) .softSurface(cornerRadius: 22)
} }
@ -107,7 +129,11 @@ struct FeedbackLine: View {
} icon: { } icon: {
Image(systemName: kind == "ok" ? "checkmark.circle.fill" : kind == "warn" ? "exclamationmark.triangle.fill" : "xmark.circle.fill") Image(systemName: kind == "ok" ? "checkmark.circle.fill" : kind == "warn" ? "exclamationmark.triangle.fill" : "xmark.circle.fill")
} }
#if os(macOS)
.font(.body.weight(.semibold))
#else
.font(.subheadline.weight(.semibold)) .font(.subheadline.weight(.semibold))
#endif
.foregroundStyle(kind == "ok" ? palette.success : kind == "warn" ? palette.warning : palette.error) .foregroundStyle(kind == "ok" ? palette.success : kind == "warn" ? palette.warning : palette.error)
} }
} }
@ -121,7 +147,11 @@ struct Meaning: View {
var body: some View { var body: some View {
if visible && !text.isEmpty { if visible && !text.isEmpty {
Text(text) Text(text)
#if os(macOS)
.font(.body)
#else
.font(.footnote) .font(.footnote)
#endif
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.padding(.bottom, 4) .padding(.bottom, 4)
} }
@ -139,13 +169,20 @@ struct WordField: View {
TextField(placeholder, text: $value) TextField(placeholder, text: $value)
.textInputAutocapitalization(.never) .textInputAutocapitalization(.never)
.autocorrectionDisabled() .autocorrectionDisabled()
#if os(macOS)
.font(.title3)
#endif
if let mark { if let mark {
Image(systemName: mark ? "checkmark.circle.fill" : "xmark.circle.fill") Image(systemName: mark ? "checkmark.circle.fill" : "xmark.circle.fill")
.foregroundStyle(mark ? (palette?.success ?? .green) : (palette?.error ?? .red)) .foregroundStyle(mark ? (palette?.success ?? .green) : (palette?.error ?? .red))
} }
} }
.padding(.horizontal, 12) .padding(.horizontal, 12)
#if os(macOS)
.padding(.vertical, 14)
#else
.padding(.vertical, 10) .padding(.vertical, 10)
#endif
.background(Color(.secondarySystemGroupedBackground), in: RoundedRectangle(cornerRadius: 12, style: .continuous)) .background(Color(.secondarySystemGroupedBackground), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
.overlay( .overlay(
RoundedRectangle(cornerRadius: 12, style: .continuous) RoundedRectangle(cornerRadius: 12, style: .continuous)
@ -169,20 +206,35 @@ struct SegChip: View {
Button(label, action: action) Button(label, action: action)
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(selected ? .accentColor : .secondary) .tint(selected ? .accentColor : .secondary)
#if os(macOS)
.controlSize(.large)
#endif
} }
} }
struct Hint: View { struct Hint: View {
let text: String let text: String
var body: some View { var body: some View {
Text(text).font(.footnote).foregroundStyle(.secondary).padding(.bottom, 6) Text(text)
#if os(macOS)
.font(.body)
#else
.font(.footnote)
#endif
.foregroundStyle(.secondary)
.padding(.bottom, 6)
} }
} }
struct Prompt: View { struct Prompt: View {
let text: String let text: String
var body: some View { var body: some View {
Text(text).font(.body.weight(.medium)) Text(text)
#if os(macOS)
.font(.title3.weight(.medium))
#else
.font(.body.weight(.medium))
#endif
} }
} }
@ -194,7 +246,11 @@ struct WordChip: View {
Button(text, action: action) Button(text, action: action)
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(.primary) .tint(.primary)
#if os(macOS)
.controlSize(.large)
#else
.controlSize(.small) .controlSize(.small)
#endif
} }
} }
@ -205,8 +261,13 @@ struct WordSlot<Content: View>: View {
var body: some View { var body: some View {
content() content()
#if os(macOS)
.frame(maxWidth: .infinity, minHeight: 56, alignment: .leading)
.padding(12)
#else
.frame(maxWidth: .infinity, minHeight: 44, alignment: .leading) .frame(maxWidth: .infinity, minHeight: 44, alignment: .leading)
.padding(8) .padding(8)
#endif
.background(Color(.tertiarySystemFill), in: RoundedRectangle(cornerRadius: 14, style: .continuous)) .background(Color(.tertiarySystemFill), in: RoundedRectangle(cornerRadius: 14, style: .continuous))
.overlay( .overlay(
RoundedRectangle(cornerRadius: 14, style: .continuous) RoundedRectangle(cornerRadius: 14, style: .continuous)
@ -224,18 +285,29 @@ struct OptionChip: View {
var body: some View { var body: some View {
Button(action: action) { Button(action: action) {
HStack { HStack(spacing: 10) {
Image(systemName: symbol) Image(systemName: symbol)
.font(.title3)
.foregroundStyle(symbolColor) .foregroundStyle(symbolColor)
Text(text) Text(text)
#if os(macOS)
.font(.title3)
#endif
.foregroundStyle(.primary) .foregroundStyle(.primary)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
} }
#if os(macOS)
.padding(.vertical, 8)
#else
.padding(.vertical, 4) .padding(.vertical, 4)
#endif
} }
.buttonStyle(.bordered) .buttonStyle(.bordered)
.tint(tint) .tint(tint)
#if os(macOS)
.controlSize(.large)
#endif
.padding(.bottom, 4) .padding(.bottom, 4)
} }
@ -296,8 +368,8 @@ extension View {
/// Full-width, leading-aligned content for exercise screens. /// Full-width, leading-aligned content for exercise screens.
func exerciseContent() -> some View { func exerciseContent() -> some View {
#if os(macOS) #if os(macOS)
frame(maxWidth: 720, alignment: .leading) frame(maxWidth: MacChrome.exerciseMaxWidth, alignment: .leading)
.padding(20) .padding(28)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
#else #else
frame(maxWidth: .infinity, alignment: .leading) frame(maxWidth: .infinity, alignment: .leading)
@ -311,6 +383,9 @@ extension View {
func appListStyle() -> some View { func appListStyle() -> some View {
#if os(macOS) #if os(macOS)
listStyle(.inset) listStyle(.inset)
.environment(\.defaultMinListRowHeight, MacChrome.listRowMinHeight)
.scrollContentBackground(.hidden)
.padding(.horizontal, 8)
#else #else
self self
#endif #endif
@ -345,8 +420,39 @@ struct BottomAction<Extra: View>: View {
PrimaryButton(label: label, action: action) PrimaryButton(label: label, action: action)
} }
.padding(.horizontal) .padding(.horizontal)
#if os(macOS)
.padding(.top, 12)
.padding(.bottom, 10)
.frame(maxWidth: MacChrome.exerciseMaxWidth)
.frame(maxWidth: .infinity)
#else
.padding(.top, 8) .padding(.top, 8)
.padding(.bottom, 4) .padding(.bottom, 4)
#endif
}
}
/// Primary + secondary text sized for desktop lists.
struct ListRowLabel: View {
let title: String
var subtitle: String? = nil
var body: some View {
VStack(alignment: .leading, spacing: 3) {
Text(title)
#if os(macOS)
.font(.title3)
#endif
if let subtitle, !subtitle.isEmpty {
Text(subtitle)
#if os(macOS)
.font(.body)
#else
.font(.caption)
#endif
.foregroundStyle(.secondary)
}
}
} }
} }

View file

@ -384,7 +384,14 @@ private struct AssignEx: View {
SegChip(label: groups[i], selected: active == i) { active = i } SegChip(label: groups[i], selected: active == i) { active = i }
} }
} }
Text(vm.tr("wordbank")).font(.caption).foregroundStyle(.secondary).padding(.top, 10) Text(vm.tr("wordbank"))
#if os(macOS)
.font(.body)
#else
.font(.caption)
#endif
.foregroundStyle(.secondary)
.padding(.top, 10)
FlowLayout(spacing: 6) { FlowLayout(spacing: 6) {
ForEach(items.indices, id: \.self) { i in ForEach(items.indices, id: \.self) { i in
if loc[i] == -1 { if loc[i] == -1 {

View file

@ -24,7 +24,11 @@ private struct Serpentine {
} }
/// Keep enough room under/above each node for a two-line caption. /// Keep enough room under/above each node for a two-line caption.
#if os(macOS)
private let labelBand: CGFloat = 56
#else
private let labelBand: CGFloat = 44 private let labelBand: CGFloat = 44
#endif
private func serpentine( private func serpentine(
count n: Int, count n: Int,
@ -138,7 +142,7 @@ struct PathMap: View {
nodeSize: nodeSize, nodeSize: nodeSize,
lift: branch == nil ? 0 : 56 lift: branch == nil ? 0 : 56
) )
let labelWidth = min(118, max(72, layout.spacing - 16)) let labelWidth = min(140, max(88, layout.spacing - 16))
let canvasH = layout.height + labelBand + 24 let canvasH = layout.height + labelBand + 24
ScrollView([.horizontal, .vertical]) { ScrollView([.horizontal, .vertical]) {
ZStack(alignment: .topLeading) { ZStack(alignment: .topLeading) {
@ -151,7 +155,11 @@ struct PathMap: View {
nodeView(node, index: i) nodeView(node, index: i)
.position(x: pt.x, y: pt.y) .position(x: pt.x, y: pt.y)
Text(node.label) Text(node.label)
#if os(macOS)
.font(.callout.weight(.semibold))
#else
.font(.caption2.weight(.semibold)) .font(.caption2.weight(.semibold))
#endif
.foregroundStyle(node.locked ? palette.overlay : palette.text) .foregroundStyle(node.locked ? palette.overlay : palette.text)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.lineLimit(2) .lineLimit(2)
@ -167,19 +175,23 @@ struct PathMap: View {
if let branch, branch.index < layout.points.count { if let branch, branch.index < layout.points.count {
let base = layout.points[branch.index] let base = layout.points[branch.index]
let tip = NodePos(x: base.x + 52, y: base.y - 110, row: base.row) let tip = NodePos(x: base.x + 64, y: base.y - 128, row: base.row)
Path { p in Path { p in
p.move(to: CGPoint(x: base.x, y: base.y - nodeSize / 2)) p.move(to: CGPoint(x: base.x, y: base.y - nodeSize / 2))
p.addQuadCurve( p.addQuadCurve(
to: CGPoint(x: tip.x, y: tip.y + nodeSize / 2), to: CGPoint(x: tip.x, y: tip.y + nodeSize / 2),
control: CGPoint(x: base.x + 12, y: tip.y + 24) control: CGPoint(x: base.x + 14, y: tip.y + 28)
) )
} }
.stroke(palette.rail, style: StrokeStyle(lineWidth: 8, lineCap: .round)) .stroke(palette.rail, style: StrokeStyle(lineWidth: 10, lineCap: .round))
nodeView(branch.node, index: nil) nodeView(branch.node, index: nil)
.position(x: tip.x, y: tip.y) .position(x: tip.x, y: tip.y)
Text(branch.node.label) Text(branch.node.label)
#if os(macOS)
.font(.callout.weight(.semibold))
#else
.font(.caption2.weight(.semibold)) .font(.caption2.weight(.semibold))
#endif
.foregroundStyle(palette.text) .foregroundStyle(palette.text)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.lineLimit(2) .lineLimit(2)
@ -195,7 +207,11 @@ struct PathMap: View {
.padding(.horizontal, 12) .padding(.horizontal, 12)
} }
} }
#if os(macOS)
.frame(minHeight: 520)
#else
.frame(minHeight: 420) .frame(minHeight: 420)
#endif
} }
@ViewBuilder @ViewBuilder
@ -240,25 +256,60 @@ struct PathMap: View {
} }
if node.finish { if node.finish {
VStack(spacing: 2) { VStack(spacing: 2) {
if let index { Text("\(index + 1)").font(.headline.weight(.black)) } if let index {
Text("\(index + 1)")
#if os(macOS)
.font(.title2.weight(.black))
#else
.font(.headline.weight(.black))
#endif
}
FinishFlagBadge(palette: palette) FinishFlagBadge(palette: palette)
} }
.foregroundStyle(palette.overlay) .foregroundStyle(palette.overlay)
} else if node.locked { } else if node.locked {
VStack(spacing: 2) { VStack(spacing: 2) {
if let index { Text("\(index + 1)").font(.headline.weight(.black)) } if let index {
Image(systemName: "lock.fill").font(.caption2.weight(.bold)) Text("\(index + 1)")
#if os(macOS)
.font(.title2.weight(.black))
#else
.font(.headline.weight(.black))
#endif
}
Image(systemName: "lock.fill")
#if os(macOS)
.font(.caption.weight(.bold))
#else
.font(.caption2.weight(.bold))
#endif
} }
.foregroundStyle(palette.overlay) .foregroundStyle(palette.overlay)
} else if node.done { } else if node.done {
VStack(spacing: 2) { VStack(spacing: 2) {
if let index { Text("\(index + 1)").font(.headline.weight(.black)) } if let index {
Image(systemName: "checkmark").font(.caption2.weight(.bold)) Text("\(index + 1)")
#if os(macOS)
.font(.title2.weight(.black))
#else
.font(.headline.weight(.black))
#endif
}
Image(systemName: "checkmark")
#if os(macOS)
.font(.caption.weight(.bold))
#else
.font(.caption2.weight(.bold))
#endif
} }
.foregroundStyle(palette.onAccent) .foregroundStyle(palette.onAccent)
} else if let index { } else if let index {
Text("\(index + 1)") Text("\(index + 1)")
#if os(macOS)
.font(.title2.weight(.black))
#else
.font(.headline.weight(.black)) .font(.headline.weight(.black))
#endif
.foregroundStyle(node.current ? palette.onAccent : palette.text) .foregroundStyle(node.current ? palette.onAccent : palette.text)
} }
} }

View file

@ -37,15 +37,15 @@ struct PracticeHome: View {
VStack(alignment: .leading, spacing: 16) { VStack(alignment: .leading, spacing: 16) {
Text(vm.tr("subjects_title")) Text(vm.tr("subjects_title"))
.font(.title2.weight(.semibold)) .font(.title2.weight(.semibold))
LazyVGrid(columns: [GridItem(.adaptive(minimum: 220), spacing: 16)], spacing: 16) { LazyVGrid(columns: [GridItem(.adaptive(minimum: MacChrome.homeTileMin), spacing: 18)], spacing: 18) {
ForEach(Array(vm.content.subjects.enumerated()), id: \.offset) { _, s in ForEach(Array(vm.content.subjects.enumerated()), id: \.offset) { _, s in
subjectTile(s) subjectTile(s)
} }
} }
} }
} }
.padding(28) .padding(32)
.frame(maxWidth: 920, alignment: .leading) .frame(maxWidth: MacChrome.contentMaxWidth, alignment: .leading)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
} }
.navigationTitle("Maturita") .navigationTitle("Maturita")
@ -70,28 +70,28 @@ struct PracticeHome: View {
} }
private func subjectTileBody(_ s: J, open: Bool, progress: Double, part: ProgressSum) -> some View { private func subjectTileBody(_ s: J, open: Bool, progress: Double, part: ProgressSum) -> some View {
VStack(alignment: .leading, spacing: 14) { VStack(alignment: .leading, spacing: 16) {
SubjectIcon(icon: s.str("icon"), open: open, size: 36) SubjectIcon(icon: s.str("icon"), open: open, size: 44)
Text(vm.tr(s.str("key"))) Text(vm.tr(s.str("key")))
.font(.headline) .font(.title3.weight(.semibold))
.foregroundStyle(open ? .primary : .secondary) .foregroundStyle(open ? .primary : .secondary)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
Spacer(minLength: 0) Spacer(minLength: 0)
if open && part.totalEx > 0 { if open && part.totalEx > 0 {
ProgressView(value: progress) ProgressView(value: progress)
Text(vm.fmt("stats_ex_fmt", part.doneEx, part.totalEx)) Text(vm.fmt("stats_ex_fmt", part.doneEx, part.totalEx))
.font(.caption) .font(.subheadline)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.monospacedDigit() .monospacedDigit()
} else if !open { } else if !open {
Text(vm.tr("stats_locked")) Text(vm.tr("stats_locked"))
.font(.caption) .font(.subheadline)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
} }
} }
.padding(18) .padding(22)
.frame(maxWidth: .infinity, minHeight: 148, alignment: .topLeading) .frame(maxWidth: .infinity, minHeight: MacChrome.homeTileHeight, alignment: .topLeading)
.softSurface(cornerRadius: 20) .softSurface(cornerRadius: 22)
} }
#endif #endif
@ -193,10 +193,11 @@ struct ChangelogCard: View {
Button(vm.tr("changelog_dismiss")) { vm.dismissChangelog() } Button(vm.tr("changelog_dismiss")) { vm.dismissChangelog() }
#if os(macOS) #if os(macOS)
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.controlSize(.large)
#else #else
.buttonStyle(.glassProminent) .buttonStyle(.glassProminent)
#endif
.controlSize(.small) .controlSize(.small)
#endif
} }
} }
} }
@ -233,20 +234,43 @@ struct SettingsScreen: View {
Text(vm.tr("mode_light")).tag(ColorMode.light) Text(vm.tr("mode_light")).tag(ColorMode.light)
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
#if os(macOS)
.controlSize(.large)
#endif
} }
Section(vm.tr("theme")) { Section(vm.tr("theme")) {
ForEach(Array(ThemeId.allCases), id: \.self) { id in ForEach(Array(ThemeId.allCases), id: \.self) { id in
Button { Button {
vm.setTheme(id) vm.setTheme(id)
} label: { } label: {
HStack { HStack(spacing: 12) {
Circle().fill(themePalette(id, vm.mode).tint).frame(width: 14, height: 14) Circle().fill(themePalette(id, vm.mode).tint)
Text(themeNames[id.rawValue]).foregroundStyle(.primary) .frame(width: {
#if os(macOS)
18
#else
14
#endif
}(), height: {
#if os(macOS)
18
#else
14
#endif
}())
Text(themeNames[id.rawValue])
#if os(macOS)
.font(.title3)
#endif
.foregroundStyle(.primary)
Spacer() Spacer()
if vm.themeId == id { if vm.themeId == id {
Image(systemName: "checkmark").fontWeight(.semibold) Image(systemName: "checkmark").fontWeight(.semibold)
} }
} }
#if os(macOS)
.padding(.vertical, 4)
#endif
} }
} }
} }
@ -256,12 +280,25 @@ struct SettingsScreen: View {
Text("English").tag(UiLang.en) Text("English").tag(UiLang.en)
} }
.pickerStyle(.segmented) .pickerStyle(.segmented)
#if os(macOS)
.controlSize(.large)
#endif
} }
Section(vm.tr("updates")) { Section(vm.tr("updates")) {
Text(updateText).foregroundStyle(.secondary) Text(updateText)
#if os(macOS)
.font(.body)
#endif
.foregroundStyle(.secondary)
Button(vm.tr("update_check")) { vm.checkUpdate(true) } Button(vm.tr("update_check")) { vm.checkUpdate(true) }
#if os(macOS)
.controlSize(.large)
#endif
if vm.update.canInstall { if vm.update.canInstall {
Button(vm.tr("update_install")) { vm.installUpdate() } Button(vm.tr("update_install")) { vm.installUpdate() }
#if os(macOS)
.controlSize(.large)
#endif
} }
LabeledContent("Build", value: "\(AppConfig.versionName) · \(String(AppConfig.commit.prefix(7)))") LabeledContent("Build", value: "\(AppConfig.versionName) · \(String(AppConfig.commit.prefix(7)))")
} }
@ -316,9 +353,16 @@ struct StatsScreen: View {
VStack(alignment: .leading, spacing: 6) { VStack(alignment: .leading, spacing: 6) {
HStack { HStack {
Text(vm.tr(s.str("key"))) Text(vm.tr(s.str("key")))
#if os(macOS)
.font(.title3)
#endif
Spacer() Spacer()
Text(open ? vm.fmt("stats_ex_fmt", part.doneEx, part.totalEx) : vm.tr("stats_locked")) Text(open ? vm.fmt("stats_ex_fmt", part.doneEx, part.totalEx) : vm.tr("stats_locked"))
#if os(macOS)
.font(.body)
#else
.font(.caption) .font(.caption)
#endif
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
.monospacedDigit() .monospacedDigit()
} }
@ -327,7 +371,13 @@ struct StatsScreen: View {
} }
} }
} icon: { } icon: {
SubjectIcon(icon: s.str("icon"), open: open) SubjectIcon(icon: s.str("icon"), open: open, size: {
#if os(macOS)
32
#else
26
#endif
}())
} }
.foregroundStyle(open ? .primary : .secondary) .foregroundStyle(open ? .primary : .secondary)
} }
@ -339,8 +389,20 @@ struct StatsScreen: View {
private func stat(_ label: String, _ value: String) -> some View { private func stat(_ label: String, _ value: String) -> some View {
VStack(alignment: .leading, spacing: 2) { VStack(alignment: .leading, spacing: 2) {
Text(label).font(.caption).foregroundStyle(.secondary) Text(label)
Text(value).font(.title3.bold()).monospacedDigit() #if os(macOS)
.font(.subheadline)
#else
.font(.caption)
#endif
.foregroundStyle(.secondary)
Text(value)
#if os(macOS)
.font(.title2.bold())
#else
.font(.title3.bold())
#endif
.monospacedDigit()
} }
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
} }
@ -393,10 +455,7 @@ struct SearchScreen: View {
#endif #endif
if !hit.locked { vm.openFromSearch(hit.target) } if !hit.locked { vm.openFromSearch(hit.target) }
} label: { } label: {
VStack(alignment: .leading, spacing: 2) { ListRowLabel(title: hit.title, subtitle: hit.sub)
Text(hit.title)
Text(hit.sub).font(.caption).foregroundStyle(.secondary)
}
} }
.disabled(hit.locked) .disabled(hit.locked)
.foregroundStyle(hit.locked ? .secondary : .primary) .foregroundStyle(hit.locked ? .secondary : .primary)
@ -542,14 +601,14 @@ struct RoadmapScreen: View {
}, },
palette: vm.palette, palette: vm.palette,
litUntil: lit, litUntil: lit,
nodeSize: 68, nodeSize: MacChrome.pathNode,
mx: 88, mx: 100,
my: 120, my: 140,
spac: 168, spac: 196,
gap: 240, gap: 280,
wave: 16 wave: 18
) )
.padding(20) .padding(28)
.navigationTitle(vm.tr("roadmap_title")) .navigationTitle(vm.tr("roadmap_title"))
.navigationSubtitle(vm.tr("roadmap_sub")) .navigationSubtitle(vm.tr("roadmap_sub"))
} }
@ -628,15 +687,15 @@ struct UnitMapScreen: View {
}, },
palette: vm.palette, palette: vm.palette,
litUntil: lit, litUntil: lit,
nodeSize: 64, nodeSize: MacChrome.pathNode,
mx: 88, mx: 100,
my: 118, my: 136,
spac: 164, spac: 190,
gap: 230, gap: 268,
wave: 14, wave: 16,
branch: branch branch: branch
) )
.padding(20) .padding(28)
.navigationTitle(u.str("title")) .navigationTitle(u.str("title"))
.navigationSubtitle(vm.tr(u.str("sub"))) .navigationSubtitle(vm.tr(u.str("sub")))
} }
@ -674,17 +733,11 @@ struct NetYearsScreen: View {
var body: some View { var body: some View {
List { List {
NavigationLink(value: Route.netMap) { NavigationLink(value: Route.netMap) {
VStack(alignment: .leading) { ListRowLabel(title: vm.tr("net_year1"), subtitle: vm.tr("net_sub"))
Text(vm.tr("net_year1"))
Text(vm.tr("net_sub")).font(.caption).foregroundStyle(.secondary)
}
} }
ForEach(["net_year2", "net_year3", "net_year4"], id: \.self) { key in ForEach(["net_year2", "net_year3", "net_year4"], id: \.self) { key in
Label { Label {
VStack(alignment: .leading) { ListRowLabel(title: vm.tr(key), subtitle: vm.tr("net_year_locked_sub"))
Text(vm.tr(key))
Text(vm.tr("net_year_locked_sub")).font(.caption)
}
} icon: { } icon: {
Image(systemName: "lock.fill") Image(systemName: "lock.fill")
} }
@ -734,14 +787,14 @@ struct LessonListScreen: View {
}, },
palette: vm.palette, palette: vm.palette,
litUntil: CGFloat(next ?? rows.count), litUntil: CGFloat(next ?? rows.count),
nodeSize: 64, nodeSize: MacChrome.pathNode,
mx: 86, mx: 98,
my: 116, my: 134,
spac: 160, spac: 186,
gap: 236, gap: 272,
wave: 14 wave: 16
) )
.padding(20) .padding(28)
.navigationTitle(title) .navigationTitle(title)
.navigationSubtitle(subtitle) .navigationSubtitle(subtitle)
} }
@ -833,25 +886,39 @@ struct SlidesScreen: View {
private func slidePage(_ slide: J) -> some View { private func slidePage(_ slide: J) -> some View {
ScrollView { ScrollView {
VStack(alignment: .leading, spacing: 12) { VStack(alignment: .leading, spacing: 14) {
Text(slide.str("kicker")) Text(slide.str("kicker"))
#if os(macOS)
.font(.subheadline.weight(.semibold))
#else
.font(.caption.weight(.semibold)) .font(.caption.weight(.semibold))
#endif
.foregroundStyle(.secondary) .foregroundStyle(.secondary)
Text(slide.str("title")).font(.title2.bold()) Text(slide.str("title"))
#if os(macOS)
.font(.title.bold())
#else
.font(.title2.bold())
#endif
if let tip = slide.strOrNull("tip") { if let tip = slide.strOrNull("tip") {
GlassCard { GlassCard {
Label(tip, systemImage: "lightbulb.fill") Label(tip, systemImage: "lightbulb.fill")
} }
} }
ForEach(Array(slide.strs("lines").enumerated()), id: \.offset) { _, line in ForEach(Array(slide.strs("lines").enumerated()), id: \.offset) { _, line in
Text(line).padding(.vertical, 4) Text(line)
#if os(macOS)
.font(.title3)
#endif
.padding(.vertical, 4)
} }
} }
.padding() .padding()
.padding(.bottom, 24) .padding(.bottom, 24)
.frame(maxWidth: .infinity, alignment: .leading) .frame(maxWidth: .infinity, alignment: .leading)
#if os(macOS) #if os(macOS)
.frame(maxWidth: 720, alignment: .leading) .frame(maxWidth: MacChrome.exerciseMaxWidth, alignment: .leading)
.padding(12)
#endif #endif
} }
} }
@ -862,13 +929,34 @@ struct CzechMapScreen: View {
var body: some View { var body: some View {
List { List {
Label(vm.tr("Literatura"), systemImage: "lock.fill") Label {
.foregroundStyle(.secondary) Text(vm.tr("Literatura"))
#if os(macOS)
.font(.title3)
#endif
} icon: {
Image(systemName: "lock.fill")
}
.foregroundStyle(.secondary)
NavigationLink(value: Route.mluvnice) { NavigationLink(value: Route.mluvnice) {
Label(vm.tr("Mluvnice"), systemImage: "textformat") Label {
Text(vm.tr("Mluvnice"))
#if os(macOS)
.font(.title3)
#endif
} icon: {
Image(systemName: "textformat")
}
} }
NavigationLink(value: Route.readingList) { NavigationLink(value: Route.readingList) {
Label(vm.tr("Maturitní četba"), systemImage: "books.vertical") Label {
Text(vm.tr("Maturitní četba"))
#if os(macOS)
.font(.title3)
#endif
} icon: {
Image(systemName: "books.vertical")
}
} }
} }
.navigationTitle(vm.tr("Český jazyk a literatura")) .navigationTitle(vm.tr("Český jazyk a literatura"))
@ -885,15 +973,18 @@ struct BookListScreen: View {
ForEach(Array(vm.content.books.enumerated()), id: \.offset) { _, b in ForEach(Array(vm.content.books.enumerated()), id: \.offset) { _, b in
NavigationLink(value: Route.book(b.str("id"))) { NavigationLink(value: Route.book(b.str("id"))) {
Label { Label {
VStack(alignment: .leading) { ListRowLabel(
Text(b.str("title")) title: b.str("title"),
let genre = b.str("genre") subtitle: {
Text(genre.isEmpty ? vm.tr(b.str("subKey")) : genre) let genre = b.str("genre")
.font(.caption) return genre.isEmpty ? vm.tr(b.str("subKey")) : genre
.foregroundStyle(.secondary) }()
} )
} icon: { } icon: {
Image(systemName: "book.fill") Image(systemName: "book.fill")
#if os(macOS)
.font(.title3)
#endif
} }
} }
} }
@ -916,24 +1007,24 @@ struct BookScreen: View {
if hasQuiz { if hasQuiz {
NavigationLink(value: Route.bookQuiz(id)) { NavigationLink(value: Route.bookQuiz(id)) {
Label { Label {
VStack(alignment: .leading) { ListRowLabel(title: vm.tr(b.str("quizTitle")), subtitle: vm.tr(b.str("quizSub")))
Text(vm.tr(b.str("quizTitle")))
Text(vm.tr(b.str("quizSub"))).font(.caption).foregroundStyle(.secondary)
}
} icon: { } icon: {
Image(systemName: "questionmark.circle") Image(systemName: "questionmark.circle")
#if os(macOS)
.font(.title3)
#endif
} }
} }
} }
if hasPlot { if hasPlot {
NavigationLink(value: Route.bookPlot(id)) { NavigationLink(value: Route.bookPlot(id)) {
Label { Label {
VStack(alignment: .leading) { ListRowLabel(title: vm.tr(b.str("plotTitle")), subtitle: vm.tr(b.str("plotSub")))
Text(vm.tr(b.str("plotTitle")))
Text(vm.tr(b.str("plotSub"))).font(.caption).foregroundStyle(.secondary)
}
} icon: { } icon: {
Image(systemName: "list.number") Image(systemName: "list.number")
#if os(macOS)
.font(.title3)
#endif
} }
} }
} }
@ -941,6 +1032,10 @@ struct BookScreen: View {
Section(note.str("title")) { Section(note.str("title")) {
ForEach(Array(note.strs("lines").enumerated()), id: \.offset) { _, line in ForEach(Array(note.strs("lines").enumerated()), id: \.offset) { _, line in
Text(line) Text(line)
#if os(macOS)
.font(.title3)
.padding(.vertical, 4)
#endif
} }
} }
} }

View file

@ -8,7 +8,8 @@ struct MaturitaApp: App {
WindowGroup { WindowGroup {
MacRoot(vm: vm) MacRoot(vm: vm)
} }
.defaultSize(width: 1100, height: 720) .defaultSize(width: 1280, height: 840)
.windowResizability(.contentMinSize)
.windowToolbarStyle(.unified) .windowToolbarStyle(.unified)
.windowStyle(.automatic) .windowStyle(.automatic)
.commands { .commands {
@ -37,7 +38,7 @@ struct MaturitaApp: App {
Settings { Settings {
SettingsScreen(vm: vm) SettingsScreen(vm: vm)
.formStyle(.grouped) .formStyle(.grouped)
.frame(minWidth: 420, minHeight: 460) .frame(minWidth: 480, minHeight: 520)
.tint(vm.palette.tint) .tint(vm.palette.tint)
.preferredColorScheme(vm.mode == .dark ? .dark : .light) .preferredColorScheme(vm.mode == .dark ? .dark : .light)
} }
@ -58,7 +59,7 @@ struct MacRoot: View {
} }
} }
.onAppear { vm.checkUpdate(false) } .onAppear { vm.checkUpdate(false) }
.frame(minWidth: 880, minHeight: 540) .frame(minWidth: 980, minHeight: 640)
} }
private var showsUpdateAccessory: Bool { private var showsUpdateAccessory: Bool {
@ -108,6 +109,7 @@ private struct MacWindowToolbar: ToolbarContent {
} label: { } label: {
Label(vm.tr("search"), systemImage: "magnifyingglass") Label(vm.tr("search"), systemImage: "magnifyingglass")
} }
.controlSize(.large)
.help(vm.tr("search")) .help(vm.tr("search"))
Button { Button {
@ -115,6 +117,7 @@ private struct MacWindowToolbar: ToolbarContent {
} label: { } label: {
Label(vm.tr("stats"), systemImage: "chart.bar.fill") Label(vm.tr("stats"), systemImage: "chart.bar.fill")
} }
.controlSize(.large)
.help(vm.tr("stats")) .help(vm.tr("stats"))
} }
@ -126,6 +129,7 @@ private struct MacWindowToolbar: ToolbarContent {
} label: { } label: {
Label(vm.tr("settings"), systemImage: "gearshape") Label(vm.tr("settings"), systemImage: "gearshape")
} }
.controlSize(.large)
.help(vm.tr("settings")) .help(vm.tr("settings"))
} }
} }
@ -137,19 +141,20 @@ private struct UpdateBanner: View {
var body: some View { var body: some View {
HStack(spacing: 12) { HStack(spacing: 12) {
Image(systemName: "arrow.down.app.fill") Image(systemName: "arrow.down.app.fill")
.font(.title3)
Text(bannerText) Text(bannerText)
.font(.subheadline) .font(.body)
Spacer() Spacer()
if vm.update.canInstall { if vm.update.canInstall {
Button(vm.tr("update_install")) { vm.installUpdate() } Button(vm.tr("update_install")) { vm.installUpdate() }
.buttonStyle(.borderedProminent) .buttonStyle(.borderedProminent)
.controlSize(.small) .controlSize(.large)
} }
} }
.padding(.horizontal, 16) .padding(.horizontal, 18)
.padding(.vertical, 12) .padding(.vertical, 14)
.softSurface(cornerRadius: 16) .softSurface(cornerRadius: 16)
.frame(maxWidth: 560) .frame(maxWidth: 640)
} }
private var bannerText: String { private var bannerText: String {