oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

1#if os(macOS)
2import DocsKit
3import SwiftUI
4
5struct DocsDocumentWindow: View {
6 let windows: DocsWindows
7 let id: UUID?
8 @Environment(\.openWindow) private var openWindow
9 var body: some View {
10 if let entry = windows.entries.first(where: { $0.id == id }) {
11 DocsWorkspace(client: entry.client, accountID: entry.account, signOut: {}, documentID: entry.document, newDocument: entry.isDraft, documentChanged: { document, title in windows.attach(entry.id, document: document, title: title) })
12 .id(entry.id)
13 .focusedSceneValue(\.docsWindowAccount, entry.account)
14 .onAppear { windows.setOpen(entry.id, true) }
15 .onDisappear { windows.setOpen(entry.id, false) }
16 } else {
17 ContentUnavailableView { Label(docsMacString("Open a document from Home"), systemImage: "house") } actions: {
18 Button(docsMacString("Home")) { openWindow(id: "home") }
19 }
20 }
21 }
22}
23#endif
24