diff --git a/src/mobile-web/src/components/CompactSettingsSheet.tsx b/src/mobile-web/src/components/CompactSettingsSheet.tsx index e99988ec34..1e616e20d1 100644 --- a/src/mobile-web/src/components/CompactSettingsSheet.tsx +++ b/src/mobile-web/src/components/CompactSettingsSheet.tsx @@ -34,7 +34,7 @@ interface CompactSettingsSheetProps { onSelectDevice: (device: SettingsDevice) => void; onToggleTheme: () => void; open: boolean; - renderDeviceIcon: (name: string) => React.ReactNode; + renderDeviceIcon: (device: SettingsDevice) => React.ReactNode; selectedDeviceId: string | null; } @@ -140,7 +140,7 @@ export default function CompactSettingsSheet({ disabled={!device.online || !controllable} key={device.device_id} label={deviceDisplayName(device)} - leading={{renderDeviceIcon(deviceDisplayName(device))}} + leading={{renderDeviceIcon(device)}} onClick={() => onSelectDevice(device)} selected={current} supportingText={!controllable diff --git a/src/mobile-web/src/components/DeviceSystemMark.tsx b/src/mobile-web/src/components/DeviceSystemMark.tsx new file mode 100644 index 0000000000..1995ba3887 --- /dev/null +++ b/src/mobile-web/src/components/DeviceSystemMark.tsx @@ -0,0 +1,53 @@ +import { Monitor, Smartphone } from 'lucide-react'; +import { + DEVICE_SYSTEM_MARKS, + deviceSystemKeyFromOs, + type DeviceSystemKey, +} from '../../../shared/device-system/deviceSystemMarks'; + +interface DeviceSystemMarkProps { + /** Kind the device reported: a headless host draws the server silhouette. */ + deviceKind?: string | null; + /** System the device reported. Absent system keeps a neutral mark. */ + os?: string | null; + size: number; +} + +/** + * The mark in front of a device name: the system that device reported, the server + * silhouette for a headless host, and the shape that says what a device is when + * it reports no system this client can draw. + * + * The marks themselves are shared with the desktop shell, so one device is drawn + * the same way on either surface. Size and colour are the caller's: mobile web + * sets its own icon scale, and every mark takes the colour of the row it sits in. + */ +export function DeviceSystemMark({ deviceKind, os, size }: DeviceSystemMarkProps) { + const kind = deviceKind?.trim().toLowerCase(); + // A phone is not a system and a headless host has no window to draw, whatever + // either of them runs. + if (kind === 'mobile') { + return