import AppKit import CallsKit import SwiftUI /// Offline visual fixtures of the mini window: at its smallest, default /// and a larger size, with and without the hover controls, and collapsed /// to a tab, muted and not. There is no call behind them, so the stage is /// your own (absent) camera and the tab says "Just you". @MainActor enum MiniWindowSnapshots { static func save(to folder: URL) async throws { for scheme in [ColorScheme.light, .dark] { let suffix = LobbySnapshots.name(scheme) for width in [MiniWindowRules.minimumWidth, MiniWindowRules.size.width, 480] { let size = CGSize(width: width, height: width / MiniWindowRules.aspect) for hovering in [false, true] { let call = Call(playAudio: false) try await LobbySnapshots.render( MiniWindowSnapshot.window(call: call, hovering: hovering), scheme: scheme, size: size, to: folder.appendingPathComponent( "mini-\(Int(width))\(hovering ? "-hover" : "")-\(suffix).png")) } } for muted in [false, true] { let call = Call(playAudio: false) if muted { call.mute() } try await LobbySnapshots.render( MiniWindowSnapshot.tab(call: call), scheme: scheme, size: MiniWindowTab.size, to: folder.appendingPathComponent("tab\(muted ? "-muted" : "")-\(suffix).png")) } } } }