importCottonKitimportSwiftUI/// `/device` — "This phone" or "This Mac" (Spec 10.4): this device's own/// record page in the device table, the one `/devices/[id]` draws for every/// other device, with what this device is doing folded into its row/// (`native Device facts`). Its id is the one `read.devices` names `thisDevice`.structThisDeviceRoute: View { @Environment(\.cottonCore) privatevar core @State privatevar id: String? @State privatevar unread = falsevar body: someView {Group {iflet id {TablePageRoute(table: "device", id: id) .settingsKeptFlows(table: "device", record: id) } elseif unread {PaperScreen(title: HostNoun.titleCase) {QuietState( title: ShellLines.line("boot", "device.unread_title", ["host": HostNoun.titleCase]), message: ShellLines.line("boot", "device.unread_body")) .settingsFormWidth() } } else {PaperScreen { EmptyView() } } } .task {guard id == nil, let core else { return }let answer = try? await core.callJSON(CottonMethod.readDevices) id = answer?.untrimmed("thisDevice") unread = id == nil } }}