feat(home): presence selector as a compact dropdown instead of 3 radios
Replace the three tooltip'd presence radios in the home Friends card with a pick_list dropdown + a one-line explainer for the current choice, mirroring the Settings NetworkMode picker. Add PresenceMode::ALL + a Display impl (descriptive labels) to back the picker. Tightens the Friends card vertically. clippy --all-targets clean, 256 lib tests green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,10 @@ pub enum PresenceMode {
|
||||
}
|
||||
|
||||
impl PresenceMode {
|
||||
/// All postures, default first — the option list for the Settings/home picker.
|
||||
pub const ALL: [PresenceMode; 3] =
|
||||
[PresenceMode::Normal, PresenceMode::Invisible, PresenceMode::Discoverable];
|
||||
|
||||
/// Whether this posture publishes to discovery (the only mode that does).
|
||||
pub fn publishes_to_discovery(self) -> bool {
|
||||
matches!(self, PresenceMode::Discoverable)
|
||||
@@ -46,6 +50,17 @@ impl PresenceMode {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PresenceMode {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let label = match self {
|
||||
PresenceMode::Normal => "Normal — friends only",
|
||||
PresenceMode::Invisible => "Invisible — appear offline",
|
||||
PresenceMode::Discoverable => "Discoverable — findable after a move",
|
||||
};
|
||||
f.write_str(label)
|
||||
}
|
||||
}
|
||||
|
||||
/// What a peer advertises about the gathering they're currently in. Both fields
|
||||
/// are peer-supplied and therefore untrusted — see [`interpret_pong`], which
|
||||
/// sanitizes the name and validates the ticket before surfacing them.
|
||||
|
||||
Reference in New Issue
Block a user