// The Lune window in the Mac app: connect this Mac, see each vault plainly, and make the few decisions only a person // can (a held big change, a possible secret, a note changed in two places). Talks to the app, not to the hub. import { StrictMode, useCallback, useEffect, useState } from 'react'; import { createRoot } from 'react-dom/client'; import { invoke } from '@tauri-apps/api/core'; import '../styles.css'; import './desktop.css'; import moon from './moon.svg'; type Level = 'current' | 'behind' | 'offline' | 'secret'; interface VaultStatus { name: string; path: string; team: string | null; elsewhere: string | null; level: Level; headline: string; last_synced: number | null; waiting: number; read_only: boolean; running: boolean; held: { message: string; removed: number; rewritten: number; total: number }[]; secrets: { path: string; found: string[] }[]; tidy: { note: string; copy: string; label: string }[]; case_clashes: string[]; } interface Overview { version: string; connected: boolean; teams: string[]; device: string; folder: string; level: Level; summary: string; vaults: VaultStatus[]; pending: { kind: 'join' | 'pair'; hub: string } | null; update: string | null; recent: string[]; } interface Comparison { note: string; copy: string; label: string; copy_is_mine: boolean; note_text: string | null; copy_text: string | null; } const host = (url: string | null) => (url ? url.replace(/^https?:\/\//, '') : ''); const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? '' : 's'}`; function Dot({ level }: { level: Level }) { return