#if os(macOS) import DocsKit import SwiftUI struct DocsDocumentWindow: View { let windows: DocsWindows let id: UUID? @Environment(\.openWindow) private var openWindow var body: some View { if let entry = windows.entries.first(where: { $0.id == id }) { 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) }) .id(entry.id) .focusedSceneValue(\.docsWindowAccount, entry.account) .onAppear { windows.setOpen(entry.id, true) } .onDisappear { windows.setOpen(entry.id, false) } } else { ContentUnavailableView { Label(docsMacString("Open a document from Home"), systemImage: "house") } actions: { Button(docsMacString("Home")) { openWindow(id: "home") } } } } } #endif