oficina / sheets Public

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

Plain git — no account needed to clone.

Download

Download this file

1#if os(macOS)
2import SheetsKit
3import SwiftUI
4
5struct SheetsDocumentWindow: View {
6 let windows: SheetsWindows
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 SheetsWorkspace(client: entry.client, signOut: {}, documentID: entry.document)
12 .id(entry.id)
13 .focusedSceneValue(\.sheetsWindowAccount, entry.account)
14 .onAppear { windows.setOpen(entry.id, true) }
15 .onDisappear { windows.setOpen(entry.id, false) }
16 } else {
17 ContentUnavailableView { Label(sheetsMacString("Open a document from Home"), systemImage: "house") } actions: {
18 Button(sheetsMacString("Home")) { openWindow(id: "home") }
19 }
20 }
21 }
22}
23#endif
24