Skip to content

Commit 7b18a05

Browse files
committed
feat: promote contextual titles into panel headers
1 parent 9b20bf1 commit 7b18a05

10 files changed

Lines changed: 116 additions & 138 deletions

File tree

‎EdgeMark/Core/Settings/AppSettings.swift‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ final class AppSettings {
198198
didSet { UserDefaults.standard.set(liquidGlassEnabled, forKey: "liquidGlassEnabled") }
199199
}
200200

201+
/// Whether note creation and modification dates remain visible below the title.
202+
/// Defaults off; hidden dates remain available from the title's hover details.
203+
var showNoteDatesInHeader: Bool = false {
204+
didSet { UserDefaults.standard.set(showNoteDatesInHeader, forKey: "showNoteDatesInHeader") }
205+
}
206+
201207
var usesLiquidGlass: Bool {
202208
if #available(macOS 26.0, *) {
203209
liquidGlassEnabled
@@ -324,6 +330,7 @@ final class AppSettings {
324330
panelStyle = value
325331
}
326332
liquidGlassEnabled = UserDefaults.standard.object(forKey: "liquidGlassEnabled") as? Bool ?? true
333+
showNoteDatesInHeader = UserDefaults.standard.object(forKey: "showNoteDatesInHeader") as? Bool ?? false
327334
// If the saved font is no longer installed (e.g. user uninstalled it),
328335
// drop it silently so the editor falls back to the system font.
329336
if let saved = UserDefaults.standard.string(forKey: "editorFontName"),

‎EdgeMark/Resources/Locales/de.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"settings.editor.grammarChecking": "Grammatik prüfen",
156156
"settings.editor.autocorrect": "Rechtschreibung auto-korrigieren",
157157
"settings.editor.smartQuotes": "Intelligente Anführungszeichen",
158+
"settings.editor.showNoteDates": "Notizdaten im Kopfbereich anzeigen",
158159
"settings.editor.hoverPeek": "Drüberfahren zum Vorschauen",
159160
"settings.editor.hoverDelay": "Hover-Verzögerung",
160161
"settings.editor.spacePreview": "Leertaste zum Vorschauen",

‎EdgeMark/Resources/Locales/en.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"settings.editor.grammarChecking": "Check grammar",
156156
"settings.editor.autocorrect": "Auto-correct spelling",
157157
"settings.editor.smartQuotes": "Smart quotes",
158+
"settings.editor.showNoteDates": "Show note dates in header",
158159
"settings.editor.hoverPeek": "Hover to preview",
159160
"settings.editor.hoverDelay": "Hover delay",
160161
"settings.editor.spacePreview": "Space to preview",

‎EdgeMark/Resources/Locales/es.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"settings.editor.grammarChecking": "Corrección gramatical",
156156
"settings.editor.autocorrect": "Autocorrección ortográfica",
157157
"settings.editor.smartQuotes": "Comillas tipográficas",
158+
"settings.editor.showNoteDates": "Mostrar fechas de la nota en el encabezado",
158159
"settings.editor.hoverPeek": "Vista previa al pasar el cursor",
159160
"settings.editor.hoverDelay": "Retraso al pasar el cursor",
160161
"settings.editor.spacePreview": "Espacio para vista previa",

‎EdgeMark/Resources/Locales/hi.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"settings.editor.grammarChecking": "व्याकरण जांचें",
156156
"settings.editor.autocorrect": "स्पेलिंग ऑटो-करेक्ट",
157157
"settings.editor.smartQuotes": "स्मार्ट उद्धरण चिह्न",
158+
"settings.editor.showNoteDates": "हेडर में नोट की तारीखें दिखाएँ",
158159
"settings.editor.hoverPeek": "हॉवर करके पूर्वावलोकन",
159160
"settings.editor.hoverDelay": "हॉवर विलंब",
160161
"settings.editor.spacePreview": "स्पेस से पूर्वावलोकन",

‎EdgeMark/Resources/Locales/zh-Hans.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"settings.editor.grammarChecking": "语法检查",
156156
"settings.editor.autocorrect": "自动更正拼写",
157157
"settings.editor.smartQuotes": "智能引号",
158+
"settings.editor.showNoteDates": "在标题栏显示笔记日期",
158159
"settings.editor.hoverPeek": "悬停预览",
159160
"settings.editor.hoverDelay": "悬停延时",
160161
"settings.editor.spacePreview": "空格键预览",
Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import SwiftUI
22

3-
/// Keeps the open note's title visible while editor content scrolls beneath it.
4-
/// The reserved editor inset matches the overlay's occupied height, so content
5-
/// begins below the title but can move behind its translucent surface.
6-
struct StickyNoteTitleBar: View {
7-
static let editorContentInset: CGFloat = surfaceHeight + topInset
8-
9-
private static let surfaceHeight: CGFloat = 44
10-
private static let topInset: CGFloat = 8
11-
private static let horizontalInset: CGFloat = 8
12-
3+
/// Editable note title used as the primary content in the editor header.
4+
/// Its tooltip carries the path and, when hidden from the header, note dates.
5+
struct NoteHeaderTitle: View {
136
@Environment(AppSettings.self) private var appSettings
147

158
let title: String
9+
let path: String
10+
let modifiedAt: String
11+
let createdAt: String
1612
@Binding var text: String
1713
var isFocused: FocusState<Bool>.Binding
1814
let isEditing: Bool
@@ -23,30 +19,13 @@ struct StickyNoteTitleBar: View {
2319
let onFocusLost: () -> Void
2420

2521
var body: some View {
26-
Group {
27-
if #available(macOS 26.0, *), appSettings.usesLiquidGlass {
28-
titleField
29-
.glassEffect(.regular, in: titleShape)
30-
} else {
31-
titleField
32-
.background(.regularMaterial, in: titleShape)
33-
.overlay {
34-
titleShape
35-
.strokeBorder(.separator.opacity(0.45), lineWidth: 0.5)
36-
}
37-
}
38-
}
39-
.padding(.horizontal, Self.horizontalInset)
40-
.padding(.top, Self.topInset)
41-
.accessibilityAddTraits(.isHeader)
42-
}
43-
44-
private var titleField: some View {
4522
TextField("", text: $text, prompt: Text(title))
4623
.textFieldStyle(.plain)
4724
.font(.title3.weight(.semibold))
4825
.lineLimit(1)
26+
.truncationMode(.tail)
4927
.accessibilityLabel(L10n.shared["common.noteTitlePlaceholder"])
28+
.accessibilityValue(hoverDetails)
5029
.focused(isFocused)
5130
.onSubmit(onCommit)
5231
.onExitCommand(perform: onCancel)
@@ -67,14 +46,18 @@ struct StickyNoteTitleBar: View {
6746
.opacity(isConflicting ? 1 : 0)
6847
}
6948
.frame(maxWidth: .infinity, alignment: .leading)
70-
.padding(.horizontal, 12)
71-
.frame(height: Self.surfaceHeight)
49+
.layoutPriority(1)
50+
.contentShape(Rectangle())
51+
.help(hoverDetails)
52+
.accessibilityAddTraits(.isHeader)
7253
}
7354

74-
private var titleShape: RoundedRectangle {
75-
RoundedRectangle(
76-
cornerRadius: SurfaceMetrics.liquidGlassControlCornerRadius,
77-
style: .continuous,
78-
)
55+
private var hoverDetails: String {
56+
guard !appSettings.showNoteDatesInHeader else { return path }
57+
return [
58+
path,
59+
L10n.shared.t("editor.modifiedAt", modifiedAt),
60+
L10n.shared.t("editor.createdAt", createdAt),
61+
].joined(separator: "\n")
7962
}
8063
}

‎EdgeMark/UI/EditorScreen.swift‎

Lines changed: 75 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -26,70 +26,28 @@ struct EditorScreen: View {
2626
headerContent
2727
} content: {
2828
if let note = noteStore.selectedNote {
29-
ZStack(alignment: .top) {
30-
MarkdownEditorView(
31-
noteID: note.id,
32-
noteTitle: note.title,
33-
noteFolder: note.folder,
34-
initialContent: note.content,
35-
topOverlayInset: StickyNoteTitleBar.editorContentInset,
36-
onContentChanged: { id, newContent in
37-
noteStore.updateContent(for: id, content: newContent)
38-
},
39-
pendingReload: $pendingEditorReload,
40-
showFindBar: $isFindBarShowing,
41-
onNavigateNext: { noteStore.navigateToNextNote(sortedBy: appSettings) },
42-
onNavigatePrevious: { noteStore.navigateToPreviousNote(sortedBy: appSettings) },
43-
)
44-
.onAppear {
45-
noteStore.onNeedEditorReload = { content in
46-
pendingEditorReload = content
47-
}
29+
MarkdownEditorView(
30+
noteID: note.id,
31+
noteTitle: note.title,
32+
noteFolder: note.folder,
33+
initialContent: note.content,
34+
onContentChanged: { id, newContent in
35+
noteStore.updateContent(for: id, content: newContent)
36+
},
37+
pendingReload: $pendingEditorReload,
38+
showFindBar: $isFindBarShowing,
39+
onNavigateNext: { noteStore.navigateToNextNote(sortedBy: appSettings) },
40+
onNavigatePrevious: { noteStore.navigateToPreviousNote(sortedBy: appSettings) },
41+
)
42+
.onAppear {
43+
noteStore.onNeedEditorReload = { content in
44+
pendingEditorReload = content
4845
}
49-
.onChange(of: noteStore.pendingEditorFind) { _, pending in
50-
guard pending else { return }
51-
noteStore.pendingEditorFind = false
52-
isFindBarShowing = true
53-
}
54-
55-
StickyNoteTitleBar(
56-
title: note.title.isEmpty ? l10n["common.untitled"] : note.title,
57-
text: Binding(
58-
get: {
59-
noteRename.renamingNoteID == note.id
60-
? noteRename.text
61-
: note.title
62-
},
63-
set: { newValue in
64-
if noteRename.renamingNoteID != note.id {
65-
noteRename.beginRename(note)
66-
}
67-
noteRename.text = newValue
68-
},
69-
),
70-
isFocused: $isNoteTitleFocused,
71-
isEditing: noteRename.renamingNoteID == note.id,
72-
isConflicting: noteRename.isConflicting(in: noteStore),
73-
onBeginEditing: {
74-
if noteRename.renamingNoteID != note.id {
75-
noteRename.beginRename(note)
76-
}
77-
},
78-
onCommit: {
79-
noteRename.commit(note: note, noteStore: noteStore)
80-
if noteRename.renamingNoteID == nil {
81-
isNoteTitleFocused = false
82-
}
83-
},
84-
onCancel: {
85-
noteRename.cancel(noteStore: noteStore)
86-
isNoteTitleFocused = false
87-
},
88-
onFocusLost: {
89-
noteRename.commitOrCancel(note: note, noteStore: noteStore)
90-
},
91-
)
92-
.zIndex(1)
46+
}
47+
.onChange(of: noteStore.pendingEditorFind) { _, pending in
48+
guard pending else { return }
49+
noteStore.pendingEditorFind = false
50+
isFindBarShowing = true
9351
}
9452
}
9553
}
@@ -128,22 +86,54 @@ struct EditorScreen: View {
12886
private var headerContent: some View {
12987
if let note = noteStore.selectedNote {
13088
VStack(spacing: 4) {
131-
HStack {
89+
HStack(spacing: 8) {
13290
HeaderIconButton(
13391
systemName: "chevron.left",
13492
help: backLabel,
13593
) {
13694
goBack()
13795
}
13896

139-
Spacer()
140-
141-
Text(note.displayDirectory)
142-
.font(.caption)
143-
.foregroundStyle(.tertiary)
144-
.lineLimit(1)
145-
146-
Spacer()
97+
NoteHeaderTitle(
98+
title: note.title.isEmpty ? l10n["common.untitled"] : note.title,
99+
path: note.displayPath,
100+
modifiedAt: note.modifiedAt.homeDisplayFormat,
101+
createdAt: note.createdAt.homeDisplayFormat,
102+
text: Binding(
103+
get: {
104+
noteRename.renamingNoteID == note.id
105+
? noteRename.text
106+
: note.title
107+
},
108+
set: { newValue in
109+
if noteRename.renamingNoteID != note.id {
110+
noteRename.beginRename(note)
111+
}
112+
noteRename.text = newValue
113+
},
114+
),
115+
isFocused: $isNoteTitleFocused,
116+
isEditing: noteRename.renamingNoteID == note.id,
117+
isConflicting: noteRename.isConflicting(in: noteStore),
118+
onBeginEditing: {
119+
if noteRename.renamingNoteID != note.id {
120+
noteRename.beginRename(note)
121+
}
122+
},
123+
onCommit: {
124+
noteRename.commit(note: note, noteStore: noteStore)
125+
if noteRename.renamingNoteID == nil {
126+
isNoteTitleFocused = false
127+
}
128+
},
129+
onCancel: {
130+
noteRename.cancel(noteStore: noteStore)
131+
isNoteTitleFocused = false
132+
},
133+
onFocusLost: {
134+
noteRename.commitOrCancel(note: note, noteStore: noteStore)
135+
},
136+
)
147137

148138
HStack(spacing: SurfaceMetrics.controlGroupSpacing) {
149139
PinButton()
@@ -158,18 +148,20 @@ struct EditorScreen: View {
158148
}
159149
}
160150

161-
HStack(spacing: 12) {
162-
DateLabelView(
163-
systemName: "clock",
164-
date: note.modifiedAt.homeDisplayFormat,
165-
tooltip: L10n.shared.t("editor.modifiedAt", note.modifiedAt.homeDisplayFormat),
166-
)
151+
if appSettings.showNoteDatesInHeader {
152+
HStack(spacing: 12) {
153+
DateLabelView(
154+
systemName: "clock",
155+
date: note.modifiedAt.homeDisplayFormat,
156+
tooltip: L10n.shared.t("editor.modifiedAt", note.modifiedAt.homeDisplayFormat),
157+
)
167158

168-
DateLabelView(
169-
systemName: "calendar",
170-
date: note.createdAt.homeDisplayFormat,
171-
tooltip: L10n.shared.t("editor.createdAt", note.createdAt.homeDisplayFormat),
172-
)
159+
DateLabelView(
160+
systemName: "calendar",
161+
date: note.createdAt.homeDisplayFormat,
162+
tooltip: L10n.shared.t("editor.createdAt", note.createdAt.homeDisplayFormat),
163+
)
164+
}
173165
}
174166
}
175167
}

‎EdgeMark/UI/Navigation/NoteListView.swift‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ struct NoteListView: View {
3333

3434
private var folderPath: String {
3535
guard let name = noteStore.selectedFolder?.name else { return "/" }
36-
return "/\(name)/"
36+
return ([l10n["common.home"]] + name.split(separator: "/").map(String.init))
37+
.joined(separator: " / ")
3738
}
3839

3940
private var sortedNotes: [Note] {
@@ -72,24 +73,13 @@ struct NoteListView: View {
7273
navigateBack()
7374
}
7475

75-
HStack(spacing: 4) {
76-
Text(folderLabel)
77-
.font(.headline)
78-
.lineLimit(1)
79-
.truncationMode(.tail)
80-
.layoutPriority(1)
81-
.help(folderLabel)
82-
83-
Text(folderPath)
84-
.font(.caption)
85-
.foregroundStyle(.tertiary)
86-
.lineLimit(1)
87-
.truncationMode(.tail)
88-
.frame(minWidth: 48, maxWidth: .infinity, alignment: .leading)
89-
.help(folderPath)
90-
}
91-
.frame(maxWidth: .infinity, alignment: .leading)
92-
.clipped()
76+
Text(folderLabel)
77+
.font(.title3.weight(.semibold))
78+
.lineLimit(1)
79+
.truncationMode(.tail)
80+
.layoutPriority(1)
81+
.help(folderPath)
82+
.frame(maxWidth: .infinity, alignment: .leading)
9383

9484
HStack(spacing: SurfaceMetrics.controlGroupSpacing) {
9585
PinButton()

‎EdgeMark/UI/Settings/GeneralSettingsTab.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ struct GeneralSettingsTab: View {
149149
Toggle(l10n["settings.editor.grammarChecking"], isOn: $settings.grammarCheckingEnabled)
150150
Toggle(l10n["settings.editor.autocorrect"], isOn: $settings.automaticSpellingCorrectionEnabled)
151151
Toggle(l10n["settings.editor.smartQuotes"], isOn: $settings.automaticQuoteSubstitutionEnabled)
152+
Toggle(l10n["settings.editor.showNoteDates"], isOn: $settings.showNoteDatesInHeader)
152153
Toggle(l10n["settings.editor.hoverPeek"], isOn: $settings.hoverPeekEnabled)
153154
Picker(l10n["settings.editor.hoverDelay"], selection: $settings.hoverPeekDelay) {
154155
ForEach(AppSettings.HoverPeekDelay.allCases, id: \.self) { delay in

0 commit comments

Comments
 (0)