GamendWeb.PresenceIndicator (gamend_web v1.0.1215)

Copy Markdown View Source

The online / idle / offline dot, shared by every surface that lists a user.

Before this the web had exactly one presence indicator — a two-state pip on one host's world map — and none at all in chat, friends or groups. Two states meant someone who closed the tab a minute ago rendered the same as someone last seen a week back; :recent is the state that distinguishes them.

Colours mirror the Godot client's COLOR_ONLINE / COLOR_RECENT / COLOR_OFFLINE exactly, so the same person shows the same colour in the game and on the site. Change them together or not at all.

Summary

Functions

Colour for a status, for callers that draw their own mark (SVG, canvas).

Screen-reader label; also the dot's tooltip.

A presence dot.

Functions

color(status)

Colour for a status, for callers that draw their own mark (SVG, canvas).

label(_)

Screen-reader label; also the dot's tooltip.

presence_dot(assigns)

A presence dot.

<.presence_dot status={PresenceStatus.status(user)} />

Offline stays visible in grey rather than disappearing: a missing dot reads as "no information", and the point is to say the person is away.

Attributes

  • status (:atom) - from Gamend.Accounts.PresenceStatus.status/1. Defaults to :offline. Must be one of :online, :recent, or :offline.
  • size (:string) - Defaults to "0.55rem".
  • class (:string) - Defaults to nil.