feat(Core): Show online state on map characters page

This commit is contained in:
Dmitry Popov
2025-03-22 09:29:13 +01:00
parent 6d4981a3db
commit f994255091
2 changed files with 21 additions and 3 deletions
@@ -54,14 +54,20 @@ defmodule WandererAppWeb.MapCharacters do
>
Tracked
</span>
<span :if={is_online?(@character.id)} class="text-green-500 rounded-full px-2 py-1">
Online
</span>
<span :if={not is_online?(@character.id)} class="text-red-500 rounded-full px-2 py-1">
Offline
</span>
<div class="avatar">
<div class="rounded-md w-8 h-8">
<img src={member_icon_url(@character.eve_id)} alt={@character.name} />
</div>
</div>
<span><%= @character.name %></span>
<span :if={@character.alliance_ticker}>[<%= @character.alliance_ticker %>]</span>
<span :if={@character.corporation_ticker}>[<%= @character.corporation_ticker %>]</span>
<span>{@character.name}</span>
<span :if={@character.alliance_ticker}>[{@character.alliance_ticker}]</span>
<span :if={@character.corporation_ticker}>[{@character.corporation_ticker}]</span>
</div>
"""
end
@@ -79,4 +85,8 @@ defmodule WandererAppWeb.MapCharacters do
end)
end
defp is_online?(character_id) do
{:ok, state} = WandererApp.Character.get_character_state(character_id)
state.is_online
end
end
@@ -10,6 +10,14 @@
id="map-character-list"
class="pt-20 w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 pb-20 overflow-auto"
>
<div class="mb-6 p-4 border rounded-md flex gap-2 items-center">
<.icon name="hero-information-circle-mini" class="h-5 w-5" />
<p>
'Untrack' characters leading to completely remove them from the map, required manually enable the tracking by users later.
</p>
</div>
<div class="flex flex-col gap-4 w-full">
<.live_component
module={MapCharacters}