Branchwell

Jotley / app · jotley.ai / macOS / Views / SettingsView+ObsidianTab.swift

Raw 3.4 KB on 0004e76b60187af1b51e974d64db6d5531ee0ab1
1import SwiftUI
2
3extension SettingsView {
4 var obsidianView: some View {
5 ScrollView {
6 VStack(alignment: .leading, spacing: 24) {
7 Text("Obsidian Sync")
8 .font(.title2)
9 .fontWeight(.semibold)
10
11 HStack {
12 Image("obsidian-icon")
13 .resizable()
14 .scaledToFit()
15 .frame(width: 60, height: 60)
16 .padding(.trailing, 16)
17
18 VStack(alignment: .leading, spacing: 12) {
19 if !obsidianSyncFolderPath.isEmpty {
20 Text("Current Sync Folder:")
21 .font(.caption)
22 .foregroundColor(Color.themeTextSecondary)
23 Button(action: openObsidianSyncFolderInFinder) {
24 Text(obsidianSyncFolderPath)
25 .font(.callout)
26 .underline()
27 .foregroundColor(Color.themePrimaryAccent)
28 .lineLimit(1)
29 .truncationMode(.middle)
30 }
31 .buttonStyle(.plain)
32 .help("Open sync folder in Finder")
33 .padding(.bottom, 4)
34 } else {
35 Text("No Obsidian sync folder selected.")
36 .font(.callout)
37 .foregroundColor(Color.themeTextSecondary)
38 .padding(.bottom, 4)
39 }
40
41 HStack(spacing: 12) {
42 Button(obsidianSyncFolderPath.isEmpty ? "Select Obsidian Sync Folder" : "Change Sync Folder") {
43 selectObsidianSyncFolder()
44 }
45 .buttonStyle(JotleyGlassButtonStyle())
46 .tint(Color.themePrimaryAccent)
47
48 Button("Export Selected Note…") {
49 LocalAppModel.shared.exportObsidian()
50 }
51 .buttonStyle(JotleyGlassButtonStyle())
52 .tint(Color.themePrimaryAccent)
53 .disabled(obsidianSyncFolderPath.isEmpty)
54 }
55 }
56
57 Spacer()
58 }
59 .padding(.vertical)
60
61 VStack(alignment: .leading, spacing: 12) {
62 Text("Setup")
63 .font(.headline)
64
65 Text("1. Create a folder anywhere inside your Obsidian vault.")
66 .font(.callout)
67 .foregroundColor(.secondary)
68 Text("2. In Jotley, select that folder as your Obsidian sync folder.")
69 .font(.callout)
70 .foregroundColor(.secondary)
71 Text("3. Jotley creates `YYYY-MM-DD` subfolders inside that sync folder and writes notes into the matching date folder.")
72 .font(.callout)
73 .foregroundColor(.secondary)
74 .lineSpacing(2)
75 }
76
77 }
78 .padding(32)
79 }
80 }
81}