Compare commits

..

5 Commits

Author SHA1 Message Date
CI
3f6364c9ea chore: release version v1.31.0
Some checks failed
Build / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2024-12-20 15:05:20 +00:00
Dmitry Popov
0d11b12282 feat(Core): Show tracking for new users by default. Auto link characters to account fix. Add character loading indicators. 2024-12-20 16:04:31 +01:00
CI
a5020b58f2 chore: release version v1.30.2
Some checks failed
Build / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2024-12-17 16:31:33 +00:00
Aleksei Chichenkov
f039a74a8f Merge pull request #84 from wanderer-industries/fix-ship-size
fix(Map): Fixed problem with ship size change.
2024-12-17 19:30:56 +03:00
achichenkov
0e6bb7390b fix(Map): Fixed problem with ship size change. 2024-12-17 19:10:26 +03:00
14 changed files with 1109 additions and 264 deletions

View File

@@ -2,6 +2,24 @@
<!-- changelog --> <!-- changelog -->
## [v1.31.0](https://github.com/wanderer-industries/wanderer/compare/v1.30.2...v1.31.0) (2024-12-20)
### Features:
* Core: Show tracking for new users by default. Auto link characters to account fix. Add character loading indicators.
## [v1.30.2](https://github.com/wanderer-industries/wanderer/compare/v1.30.1...v1.30.2) (2024-12-17)
### Bug Fixes:
* Map: Fixed problem with ship size change.
## [v1.30.1](https://github.com/wanderer-industries/wanderer/compare/v1.30.0...v1.30.1) (2024-12-17) ## [v1.30.1](https://github.com/wanderer-industries/wanderer/compare/v1.30.0...v1.30.1) (2024-12-17)

View File

@@ -97,14 +97,16 @@ export const useContextMenuConnectionHandlers = () => {
}, },
}); });
outCommand({ if (status === ShipSizeStatus.small) {
type: OutCommand.updateConnectionMassStatus, outCommand({
data: { type: OutCommand.updateConnectionMassStatus,
source: edge.source, data: {
target: edge.target, source: edge.source,
value: MassState.normal, target: edge.target,
}, value: MassState.normal,
}); },
});
}
}, []); }, []);
const onToggleMassSave = useCallback((locked: boolean) => { const onToggleMassSave = useCallback((locked: boolean) => {

View File

@@ -8,6 +8,7 @@ import CopyToClipboard from './copyToClipboard';
import DownloadJson from './downloadJson'; import DownloadJson from './downloadJson';
import NewVersionUpdate from './newVersionUpdate'; import NewVersionUpdate from './newVersionUpdate';
import MapAction from './maps/mapAction'; import MapAction from './maps/mapAction';
import ShowCharactersAddAlert from './showCharactersAddAlert';
export default { export default {
DownloadJson, DownloadJson,
@@ -20,4 +21,5 @@ export default {
Ping, Ping,
CopyToClipboard, CopyToClipboard,
NewVersionUpdate, NewVersionUpdate,
ShowCharactersAddAlert,
}; };

View File

@@ -0,0 +1,11 @@
export default {
mounted() {
this.pushEvent('restore_show_characters_add_alert', {
value: localStorage.getItem('wanderer:hide_characters_add_alert') !== 'true',
});
document.getElementById('characters-add-alert-hide')?.addEventListener('click', e => {
localStorage.setItem('wanderer:hide_characters_add_alert', 'true');
});
},
};

View File

@@ -93,13 +93,9 @@ defmodule WandererAppWeb.AuthController do
|> redirect(to: ~p"/") |> redirect(to: ~p"/")
end end
def maybe_update_character_user_id(character, user_id) do def maybe_update_character_user_id(character, user_id) when not is_nil(user_id) do
case character.user_id do WandererApp.Api.Character.assign_user!(character, %{user_id: user_id})
nil ->
WandererApp.Api.Character.assign_user!(character, %{user_id: user_id})
_ ->
Logger.debug("character already has user_id")
end
end end
def maybe_update_character_user_id(_character, _user_id), do: :ok
end end

View File

@@ -28,6 +28,7 @@ defmodule WandererAppWeb.CharactersLive do
{:ok, {:ok,
socket socket
|> assign( |> assign(
show_characters_add_alert: true,
mode: :blocks, mode: :blocks,
wallet_tracking_enabled?: WandererApp.Env.wallet_tracking_enabled?(), wallet_tracking_enabled?: WandererApp.Env.wallet_tracking_enabled?(),
characters: characters |> Enum.sort_by(& &1.name, :asc) |> Enum.map(&map_ui_character/1), characters: characters |> Enum.sort_by(& &1.name, :asc) |> Enum.map(&map_ui_character/1),
@@ -45,6 +46,13 @@ defmodule WandererAppWeb.CharactersLive do
{:noreply, apply_action(socket, socket.assigns.live_action, params)} {:noreply, apply_action(socket, socket.assigns.live_action, params)}
end end
@impl true
def handle_event("restore_show_characters_add_alert", %{"value" => value}, socket) do
{:noreply,
socket
|> assign(show_characters_add_alert: value)}
end
@impl true @impl true
def handle_event("authorize", form, socket) do def handle_event("authorize", form, socket) do
track_wallet = form |> Map.get("track_wallet", false) track_wallet = form |> Map.get("track_wallet", false)

View File

@@ -29,9 +29,45 @@
id="characters-list" id="characters-list"
class="w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 pb-20 overflow-auto" class="w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 pb-20 overflow-auto"
> >
<div
:if={@show_characters_add_alert}
role="alert"
class="alert"
id="characters-add-alert"
phx-hook="ShowCharactersAddAlert"
phx-ignore
data-key="show_characters_add_alert"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
class="h-6 w-6 shrink-0 stroke-current"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
>
</path>
</svg>
<span>
All added characters will be automatically linked to your user account. You can't have same characters linked to several accounts.
</span>
<div>
<button
class="btn btn-sm"
id="characters-add-alert-hide"
phx-click={JS.toggle_class("hidden", to: "#characters-add-alert")}
>
Hide
</button>
</div>
</div>
<div <div
:if={@mode == :blocks} :if={@mode == :blocks}
class="gap-4 grid grid-cols-1 lg:grid-cols-5 md:grid-cols-3 sm:grid-cols-2 " class="gap-4 grid grid-cols-1 lg:grid-cols-5 md:grid-cols-3 sm:grid-cols-2 mt-4"
> >
<.link patch={~p"/characters/authorize"}> <.link patch={~p"/characters/authorize"}>
<div class="card card-side rounded-none h-full items-center hover:text-white bg-gradient-to-l from-stone-950 to-stone-900 transform transition duration-500"> <div class="card card-side rounded-none h-full items-center hover:text-white bg-gradient-to-l from-stone-950 to-stone-900 transform transition duration-500">
@@ -51,9 +87,24 @@
<div class="absolute left-0 bottom-0 w-full h-30 bg-opacity-60 bg-gray-900"> <div class="absolute left-0 bottom-0 w-full h-30 bg-opacity-60 bg-gray-900">
<h2 class="absolute w-full flex justify-between px-4 left-0 top-10 text-xs"> <h2 class="absolute w-full flex justify-between px-4 left-0 top-10 text-xs">
Corporation: Corporation:
<span
:if={
is_nil(
character
|> get(
path(:corporation_name),
nil
)
)
}
class="loading loading-dots loading-xs"
/>
<span> <span>
<%= character <%= character
|> get(path(:corporation_name), "-") %> |> get(
path(:corporation_name),
""
) %>
</span> </span>
</h2> </h2>
<h2 class="absolute w-full flex justify-between px-4 left-0 top-16 text-xs"> <h2 class="absolute w-full flex justify-between px-4 left-0 top-16 text-xs">
@@ -65,9 +116,21 @@
</h2> </h2>
<h2 class="absolute left-0 bottom-12 px-4 text-xs w-full flex justify-between"> <h2 class="absolute left-0 bottom-12 px-4 text-xs w-full flex justify-between">
Location: Location:
<span
:if={
is_nil(
character
|> get(
path(:location / :solar_system_info / :solar_system_name, :map),
nil
)
)
}
class="loading loading-dots loading-xs"
/>
<span> <span>
<%= character <%= character
|> get(path(:location / :solar_system_info / :solar_system_name, :map), "-") %> |> get(path(:location / :solar_system_info / :solar_system_name, :map), "") %>
</span> </span>
</h2> </h2>
<h2 <h2
@@ -126,7 +189,7 @@
</div> </div>
</div> </div>
<div :if={@mode == :table} class="flex flex-col gap-4"> <div :if={@mode == :table} class="flex flex-col gap-4 mt-4">
<.link patch={~p"/characters/authorize"}> <.link patch={~p"/characters/authorize"}>
<button <button
type="button" type="button"

View File

@@ -66,35 +66,9 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
def handle_ui_event( def handle_ui_event(
"add_character", "add_character",
_, _,
%{ socket
assigns: %{ ),
current_user: current_user, do: {:noreply, socket |> add_character()}
map_id: map_id,
user_permissions: %{track_character: true}
}
} = socket
) do
{:noreply,
socket
|> assign(show_tracking?: true)
|> assign_async(:characters, fn ->
{:ok, map} =
map_id
|> WandererApp.MapRepo.get([:acls])
{:ok, character_settings} =
case WandererApp.MapCharacterSettingsRepo.get_all_by_map(map_id) do
{:ok, settings} -> {:ok, settings}
_ -> {:ok, []}
end
map
|> WandererApp.Maps.load_characters(
character_settings,
current_user.id
)
end)}
end
def handle_ui_event( def handle_ui_event(
"add_character", "add_character",
@@ -222,6 +196,38 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
def handle_ui_event(event, body, socket), def handle_ui_event(event, body, socket),
do: MapCoreEventHandler.handle_ui_event(event, body, socket) do: MapCoreEventHandler.handle_ui_event(event, body, socket)
def add_character(
%{
assigns: %{
current_user: current_user,
map_id: map_id,
user_permissions: %{track_character: true}
}
} = socket
),
do:
socket
|> assign(show_tracking?: true)
|> assign_async(:characters, fn ->
{:ok, map} =
map_id
|> WandererApp.MapRepo.get([:acls])
{:ok, character_settings} =
case WandererApp.MapCharacterSettingsRepo.get_all_by_map(map_id) do
{:ok, settings} -> {:ok, settings}
_ -> {:ok, []}
end
map
|> WandererApp.Maps.load_characters(
character_settings,
current_user.id
)
end)
def add_character(socket), do: socket
def has_tracked_characters?([]), do: false def has_tracked_characters?([]), do: false
def has_tracked_characters?(_user_characters), do: true def has_tracked_characters?(_user_characters), do: true

View File

@@ -221,8 +221,9 @@ defmodule WandererAppWeb.MapCoreEventHandler do
socket socket
|> put_flash( |> put_flash(
:error, :error,
"You should enable tracking for at least one character." "You should enable tracking for at least one character!"
)} )
|> MapCharactersEventHandler.add_character()}
def handle_ui_event(event, body, socket) do def handle_ui_event(event, body, socket) do
Logger.warning(fn -> "unhandled map ui event: #{event} #{inspect(body)}" end) Logger.warning(fn -> "unhandled map ui event: #{event} #{inspect(body)}" end)
@@ -448,23 +449,35 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|> filter_map_characters(user_character_eve_ids, user_permissions, options) |> filter_map_characters(user_character_eve_ids, user_permissions, options)
|> Enum.map(&MapCharactersEventHandler.map_ui_character/1) |> Enum.map(&MapCharactersEventHandler.map_ui_character/1)
socket has_tracked_characters? =
|> assign( MapCharactersEventHandler.has_tracked_characters?(user_character_eve_ids)
map_loaded?: true,
map_user_settings: map_user_settings, socket =
user_characters: user_character_eve_ids, socket
has_tracked_characters?: |> assign(
MapCharactersEventHandler.has_tracked_characters?(user_character_eve_ids) map_loaded?: true,
) map_user_settings: map_user_settings,
|> MapEventHandler.push_map_event( user_characters: user_character_eve_ids,
"init", has_tracked_characters?: has_tracked_characters?
initial_data )
|> Map.put(:characters, map_characters) |> MapEventHandler.push_map_event(
) "init",
|> push_event("js-exec", %{ initial_data
to: "#map-loader", |> Map.put(:characters, map_characters)
attr: "data-loaded" )
}) |> push_event("js-exec", %{
to: "#map-loader",
attr: "data-loaded"
})
case not has_tracked_characters? && user_permissions.track_character do
true ->
socket
|> MapCharactersEventHandler.add_character()
_ ->
socket
end
end end
defp handle_map_start_events(socket, map_id, events) do defp handle_map_start_events(socket, map_id, events) do
@@ -487,10 +500,6 @@ defmodule WandererAppWeb.MapCoreEventHandler do
:empty_tracked_characters -> :empty_tracked_characters ->
socket socket
|> put_flash(
:info,
"You should enable tracking for at least one character to work with map."
)
:map_character_limit -> :map_character_limit ->
socket socket

View File

@@ -6,7 +6,7 @@ defmodule WandererAppWeb.MapLive do
@impl true @impl true
def mount(%{"slug" => map_slug} = _params, _session, socket) when is_connected?(socket) do def mount(%{"slug" => map_slug} = _params, _session, socket) when is_connected?(socket) do
Process.send_after(self(), %{event: :load_map}, Enum.random(10..500)) Process.send_after(self(), %{event: :load_map}, Enum.random(10..800))
{:ok, {:ok,
socket socket
@@ -76,13 +76,15 @@ defmodule WandererAppWeb.MapLive do
def handle_info(:not_all_characters_tracked, %{assigns: %{map_slug: map_slug}} = socket), def handle_info(:not_all_characters_tracked, %{assigns: %{map_slug: map_slug}} = socket),
do: do:
{:noreply, WandererAppWeb.MapEventHandler.handle_ui_event(
socket %{event: "add_character"},
|> put_flash( nil,
:error, socket
"You should enable tracking for all characters that have access to this map first!" |> put_flash(
) :error,
|> push_navigate(to: ~p"/tracking/#{map_slug}")} "You should enable tracking for all characters that have access to this map first!"
)
)
@impl true @impl true
def handle_info(info, socket), def handle_info(info, socket),

View File

@@ -92,12 +92,12 @@
<.modal <.modal
:if={assigns |> Map.get(:show_tracking?, false)} :if={assigns |> Map.get(:show_tracking?, false)}
id="map-tracking-modal" id="map-tracking-modal"
title="Characters tracking" title="Track Characters"
show show
on_cancel={JS.push("hide_tracking")} on_cancel={JS.push("hide_tracking")}
> >
<.async_result :let={characters} assign={@characters}> <.async_result :let={characters} assign={@characters}>
<:loading><span class="loading loading-dots loading-xs" />.</:loading> <:loading><span class="loading loading-dots loading-xs" /></:loading>
<:failed :let={reason}><%= reason %></:failed> <:failed :let={reason}><%= reason %></:failed>
<.table <.table
@@ -106,7 +106,7 @@
class="h-[400px] !overflow-y-auto" class="h-[400px] !overflow-y-auto"
rows={characters} rows={characters}
> >
<:col :let={character} label="Tracked"> <:col :let={character} label="Track">
<label class="flex items-center gap-3"> <label class="flex items-center gap-3">
<input <input
type="checkbox" type="checkbox"

View File

@@ -2,7 +2,7 @@ defmodule WandererApp.MixProject do
use Mix.Project use Mix.Project
@source_url "https://github.com/wanderer-industries/wanderer" @source_url "https://github.com/wanderer-industries/wanderer"
@version "1.30.1" @version "1.31.0"
def project do def project do
[ [

View File

@@ -755,11 +755,11 @@ groupID,categoryID,groupName,iconID,useBasePrice,anchored,anchorable,fittableNon
944,9,Capital Industrial Ship Blueprint,None,1,0,0,0,1 944,9,Capital Industrial Ship Blueprint,None,1,0,0,0,1
945,9,Industrial Command Ship Blueprint,None,1,0,0,0,1 945,9,Industrial Command Ship Blueprint,None,1,0,0,0,1
952,11,Mission Container,0,0,1,0,0,0 952,11,Mission Container,0,0,1,0,0,0
954,32,Defensive Subsystem,None,0,0,0,0,1 954,32,Defensive Subsystem,3631,0,0,0,0,1
955,17,Depricated Subsystems,None,0,0,0,0,0 955,17,Depricated Subsystems,None,0,0,0,0,0
956,32,Offensive Subsystem,None,0,0,0,0,1 956,32,Offensive Subsystem,3641,0,0,0,0,1
957,32,Propulsion Subsystem,None,0,0,0,0,1 957,32,Propulsion Subsystem,3646,0,0,0,0,1
958,32,Core Subsystem,None,0,0,0,0,1 958,32,Core Subsystem,3636,0,0,0,0,1
959,11,Deadspace Sleeper Sleepless Sentinel,0,0,0,0,0,0 959,11,Deadspace Sleeper Sleepless Sentinel,0,0,0,0,0,0
960,11,Deadspace Sleeper Awakened Sentinel,0,0,0,0,0,0 960,11,Deadspace Sleeper Awakened Sentinel,0,0,0,0,0,0
961,11,Deadspace Sleeper Emergent Sentinel,0,0,0,0,0,0 961,11,Deadspace Sleeper Emergent Sentinel,0,0,0,0,0,0
@@ -1529,6 +1529,8 @@ groupID,categoryID,groupName,iconID,useBasePrice,anchored,anchorable,fittableNon
4811,9,Mercenary Den Blueprint,None,1,0,0,0,1 4811,9,Mercenary Den Blueprint,None,1,0,0,0,1
4820,9,Mutaplasmid Blueprint,None,1,0,0,0,1 4820,9,Mutaplasmid Blueprint,None,1,0,0,0,1
4821,17,Atavum,None,1,0,0,0,1 4821,17,Atavum,None,1,0,0,0,1
4824,17,Infomorph Systems,None,1,0,0,0,1
4825,2,Local Beacon,None,0,1,0,0,0
350858,350001,Infantry Weapons,None,1,0,0,0,0 350858,350001,Infantry Weapons,None,1,0,0,0,0
351064,350001,Infantry Dropsuits,None,1,0,0,0,0 351064,350001,Infantry Dropsuits,None,1,0,0,0,0
351121,350001,Infantry Modules,None,1,0,0,0,0 351121,350001,Infantry Modules,None,1,0,0,0,0
1 groupID categoryID groupName iconID useBasePrice anchored anchorable fittableNonSingleton published
755 944 9 Capital Industrial Ship Blueprint None 1 0 0 0 1
756 945 9 Industrial Command Ship Blueprint None 1 0 0 0 1
757 952 11 Mission Container 0 0 1 0 0 0
758 954 32 Defensive Subsystem None 3631 0 0 0 0 1
759 955 17 Depricated Subsystems None 0 0 0 0 0
760 956 32 Offensive Subsystem None 3641 0 0 0 0 1
761 957 32 Propulsion Subsystem None 3646 0 0 0 0 1
762 958 32 Core Subsystem None 3636 0 0 0 0 1
763 959 11 Deadspace Sleeper Sleepless Sentinel 0 0 0 0 0 0
764 960 11 Deadspace Sleeper Awakened Sentinel 0 0 0 0 0 0
765 961 11 Deadspace Sleeper Emergent Sentinel 0 0 0 0 0 0
1529 4811 9 Mercenary Den Blueprint None 1 0 0 0 1
1530 4820 9 Mutaplasmid Blueprint None 1 0 0 0 1
1531 4821 17 Atavum None 1 0 0 0 1
1532 4824 17 Infomorph Systems None 1 0 0 0 1
1533 4825 2 Local Beacon None 0 1 0 0 0
1534 350858 350001 Infantry Weapons None 1 0 0 0 0
1535 351064 350001 Infantry Dropsuits None 1 0 0 0 0
1536 351121 350001 Infantry Modules None 1 0 0 0 0

File diff suppressed because it is too large Load Diff