mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-11 02:05:58 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c317a8bff9 | ||
|
|
618cca39a4 | ||
|
|
4419c86164 | ||
|
|
9848f49b49 | ||
|
|
4c23069a0a | ||
|
|
4a1d7be44c | ||
|
|
26d0392da1 | ||
|
|
83b1406cce | ||
|
|
fa83185cf5 | ||
|
|
97d5010d41 | ||
|
|
e73ad93920 | ||
|
|
425af246fb | ||
|
|
a2912ba0ff | ||
|
|
61cd281a18 | ||
|
|
6e28134282 | ||
|
|
d1377f44d2 | ||
|
|
2a72a2612d | ||
|
|
66bb4f87d4 | ||
|
|
977b1ad083 | ||
|
|
94db18d42b | ||
|
|
7e0375108d |
81
CHANGELOG.md
81
CHANGELOG.md
@@ -2,6 +2,87 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.74.4](https://github.com/wanderer-industries/wanderer/compare/v1.74.3...v1.74.4) (2025-07-07)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Fixed issue with update system positions
|
||||
|
||||
## [v1.74.3](https://github.com/wanderer-industries/wanderer/compare/v1.74.2...v1.74.3) (2025-07-06)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Fixed issues with map subscription component
|
||||
|
||||
## [v1.74.2](https://github.com/wanderer-industries/wanderer/compare/v1.74.1...v1.74.2) (2025-06-30)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Fixed map loading for not existing maps
|
||||
|
||||
## [v1.74.1](https://github.com/wanderer-industries/wanderer/compare/v1.74.0...v1.74.1) (2025-06-28)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Core: Mark connections between Pochven systems as known.
|
||||
|
||||
## [v1.74.0](https://github.com/wanderer-industries/wanderer/compare/v1.73.0...v1.74.0) (2025-06-25)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Core: Reverted showing linked signature ID as part of temporary names
|
||||
|
||||
## [v1.73.0](https://github.com/wanderer-industries/wanderer/compare/v1.72.1...v1.73.0) (2025-06-25)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Core: Allowed system temp names up to 12 characters. Deprecated showing linked signature ID as part of temporary name.
|
||||
|
||||
## [v1.72.1](https://github.com/wanderer-industries/wanderer/compare/v1.72.0...v1.72.1) (2025-06-23)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* issue with tracking signature activity
|
||||
|
||||
## [v1.72.0](https://github.com/wanderer-industries/wanderer/compare/v1.71.3...v1.72.0) (2025-06-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* Core: Added an ability to see & topup map balance and map subscription info (on public)
|
||||
|
||||
## [v1.71.3](https://github.com/wanderer-industries/wanderer/compare/v1.71.2...v1.71.3) (2025-06-21)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* Map: Fix incorrect placing of labels
|
||||
|
||||
## [v1.71.2](https://github.com/wanderer-industries/wanderer/compare/v1.71.1...v1.71.2) (2025-06-20)
|
||||
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const SolarSystemNodeDefault = memo((props: NodeProps<MapSolarSystemType>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{localKillsCount && localKillsCount > 0 && nodeVars.solarSystemId && (
|
||||
{localKillsCount != null && localKillsCount > 0 && nodeVars.solarSystemId && (
|
||||
<KillsCounter
|
||||
killsCount={localKillsCount}
|
||||
systemId={nodeVars.solarSystemId}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo } from 'react';
|
||||
import { SolarSystemStaticInfoRaw } from '@/hooks/Mapper/types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
interface UseSystemNameParams {
|
||||
isTempSystemNameEnabled: boolean;
|
||||
@@ -26,7 +26,7 @@ export const useSystemName = ({
|
||||
}
|
||||
|
||||
if (isShowLinkedSigIdTempName && linkedSigPrefix) {
|
||||
return temporary_name ? `${linkedSigPrefix}・${temporary_name}` : `${linkedSigPrefix}・${solar_system_name}`;
|
||||
return temporary_name ? `${linkedSigPrefix}:${temporary_name}` : `${linkedSigPrefix}:${solar_system_name}`;
|
||||
}
|
||||
|
||||
return temporary_name ?? '';
|
||||
|
||||
@@ -206,7 +206,7 @@ export const SystemSettingsDialog = ({ systemId, visible, setVisible }: SystemSe
|
||||
aria-describedby="temporaryName"
|
||||
autoComplete="off"
|
||||
value={temporaryName}
|
||||
maxLength={10}
|
||||
maxLength={12}
|
||||
onChange={e => setTemporaryName(e.target.value)}
|
||||
/>
|
||||
</IconField>
|
||||
|
||||
@@ -84,9 +84,9 @@ map_subscription_base_price =
|
||||
config_dir
|
||||
|> get_int_from_path_or_env("WANDERER_MAP_SUBSCRIPTION_BASE_PRICE", 100_000_000)
|
||||
|
||||
map_subscription_extra_characters_100_price =
|
||||
map_subscription_extra_characters_50_price =
|
||||
config_dir
|
||||
|> get_int_from_path_or_env("WANDERER_MAP_SUBSCRIPTION_EXTRA_CHARACTERS_100_PRICE", 50_000_000)
|
||||
|> get_int_from_path_or_env("WANDERER_MAP_SUBSCRIPTION_EXTRA_CHARACTERS_50_PRICE", 50_000_000)
|
||||
|
||||
map_subscription_extra_hubs_10_price =
|
||||
config_dir
|
||||
@@ -167,7 +167,7 @@ config :wanderer_app,
|
||||
month_12_discount: 0.5
|
||||
}
|
||||
],
|
||||
extra_characters_100: map_subscription_extra_characters_100_price,
|
||||
extra_characters_50: map_subscription_extra_characters_50_price,
|
||||
extra_hubs_10: map_subscription_extra_hubs_10_price
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ defmodule WandererApp.Env do
|
||||
def base_url, do: get_key(:web_app_url, "<BASE_URL>")
|
||||
def custom_route_base_url, do: get_key(:custom_route_base_url, "<CUSTOM_ROUTE_BASE_URL>")
|
||||
def invites, do: get_key(:invites, false)
|
||||
|
||||
def map_subscriptions_enabled?, do: get_key(:map_subscriptions_enabled, false)
|
||||
def public_api_disabled?, do: get_key(:public_api_disabled, false)
|
||||
|
||||
@@ -74,5 +75,4 @@ defmodule WandererApp.Env do
|
||||
def to_client_env do
|
||||
%{detailedKillsDisabled: not wanderer_kills_service_enabled?()}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -97,7 +97,7 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
) do
|
||||
%{
|
||||
plans: plans,
|
||||
extra_characters_100: extra_characters_100,
|
||||
extra_characters_50: extra_characters_50,
|
||||
extra_hubs_10: extra_hubs_10
|
||||
} = WandererApp.Env.subscription_settings()
|
||||
|
||||
@@ -113,7 +113,7 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
case characters_limit > plan_characters_limit do
|
||||
true ->
|
||||
estimated_price +
|
||||
(characters_limit - plan_characters_limit) / 100 * extra_characters_100
|
||||
(characters_limit - plan_characters_limit) / 50 * extra_characters_50
|
||||
|
||||
_ ->
|
||||
estimated_price
|
||||
@@ -153,7 +153,7 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
) do
|
||||
%{
|
||||
plans: plans,
|
||||
extra_characters_100: extra_characters_100,
|
||||
extra_characters_50: extra_characters_50,
|
||||
extra_hubs_10: extra_hubs_10
|
||||
} = WandererApp.Env.subscription_settings()
|
||||
|
||||
@@ -170,7 +170,7 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
case characters_limit > sub_characters_limit do
|
||||
true ->
|
||||
additional_price +
|
||||
(characters_limit - sub_characters_limit) / 100 * extra_characters_100
|
||||
(characters_limit - sub_characters_limit) / 50 * extra_characters_50
|
||||
|
||||
_ ->
|
||||
additional_price
|
||||
@@ -186,6 +186,7 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
end
|
||||
|
||||
period = get_active_months(selected_subscription)
|
||||
|
||||
total_price = additional_price * period
|
||||
|
||||
{:ok, discount} =
|
||||
@@ -200,9 +201,16 @@ defmodule WandererApp.Map.SubscriptionManager do
|
||||
end
|
||||
|
||||
defp get_active_months(subscription) do
|
||||
subscription.active_till
|
||||
|> Timex.shift(days: 5)
|
||||
|> Timex.diff(Timex.now(), :months)
|
||||
months =
|
||||
subscription.active_till
|
||||
|> Timex.shift(days: 5)
|
||||
|> Timex.diff(Timex.now(), :months)
|
||||
|
||||
if months == 0 do
|
||||
1
|
||||
else
|
||||
months
|
||||
end
|
||||
end
|
||||
|
||||
defp calc_discount(
|
||||
|
||||
@@ -30,7 +30,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
@a4 22
|
||||
@a5 23
|
||||
@ccp4 24
|
||||
# @pochven 25
|
||||
@pochven 25
|
||||
# @zarzakh 10100
|
||||
|
||||
@jita 30_000_142
|
||||
@@ -51,7 +51,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
@redoubt
|
||||
]
|
||||
|
||||
@known_space [@hs, @ls, @ns]
|
||||
@known_space [@hs, @ls, @ns, @pochven]
|
||||
|
||||
@prohibited_systems [@jita]
|
||||
@prohibited_system_classes [
|
||||
|
||||
@@ -28,12 +28,11 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|
||||
MapSystem.read_by_map_and_solar_system(%{
|
||||
map_id: map_id,
|
||||
solar_system_id: system_solar_id
|
||||
}),
|
||||
{:ok, %{eve_id: char_eve_id}} <- Character.get_character(char_id) do
|
||||
}) do
|
||||
do_update_signatures(
|
||||
state,
|
||||
system,
|
||||
char_eve_id,
|
||||
char_id,
|
||||
user_id,
|
||||
delete_conn?,
|
||||
added_params,
|
||||
@@ -52,13 +51,24 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|
||||
defp do_update_signatures(
|
||||
state,
|
||||
system,
|
||||
character_eve_id,
|
||||
character_id,
|
||||
user_id,
|
||||
delete_conn?,
|
||||
added_params,
|
||||
updated_params,
|
||||
removed_params
|
||||
) do
|
||||
# Get character EVE ID for signature parsing
|
||||
character_eve_id =
|
||||
case Character.get_character(character_id) do
|
||||
{:ok, %{eve_id: eve_id}} ->
|
||||
eve_id
|
||||
|
||||
_ ->
|
||||
Logger.warning("Could not get character EVE ID for character_id: #{character_id}")
|
||||
nil
|
||||
end
|
||||
|
||||
# parse incoming DTOs
|
||||
added_sigs = parse_signatures(added_params, character_eve_id, system.id)
|
||||
updated_sigs = parse_signatures(updated_params, character_eve_id, system.id)
|
||||
@@ -89,7 +99,7 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|
||||
added_eve_ids = Enum.map(added_sigs, & &1.eve_id)
|
||||
|
||||
existing_index =
|
||||
MapSystemSignature.by_system_id_all!(system.id)
|
||||
existing_all
|
||||
|> Enum.filter(&(&1.eve_id in added_eve_ids))
|
||||
|> Map.new(&{&1.eve_id, &1})
|
||||
|
||||
@@ -127,7 +137,7 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|
||||
state.map_id,
|
||||
system.solar_system_id,
|
||||
user_id,
|
||||
character_eve_id,
|
||||
character_id,
|
||||
added_ids
|
||||
)
|
||||
end
|
||||
@@ -138,7 +148,7 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|
||||
state.map_id,
|
||||
system.solar_system_id,
|
||||
user_id,
|
||||
character_eve_id,
|
||||
character_id,
|
||||
removed_ids
|
||||
)
|
||||
end
|
||||
|
||||
89
lib/wanderer_app_web/live/map/components/map_subscription.ex
Normal file
89
lib/wanderer_app_web/live/map/components/map_subscription.ex
Normal file
@@ -0,0 +1,89 @@
|
||||
defmodule WandererAppWeb.MapSubscription do
|
||||
use WandererAppWeb, :live_component
|
||||
|
||||
use LiveViewEvents
|
||||
|
||||
alias BetterNumber, as: Number
|
||||
|
||||
@impl true
|
||||
def mount(socket) do
|
||||
socket =
|
||||
socket
|
||||
|> assign(title: "")
|
||||
|> assign(status: :alpha)
|
||||
|> assign(balance: 0)
|
||||
|
||||
{:ok, socket}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def update(
|
||||
%{
|
||||
current_user: current_user,
|
||||
map_slug: map_slug
|
||||
} = assigns,
|
||||
socket
|
||||
) do
|
||||
socket = handle_info_or_assign(socket, assigns)
|
||||
|
||||
with {:ok, %{id: map_id} = map} <-
|
||||
WandererApp.MapRepo.get_by_slug_with_permissions(map_slug, current_user),
|
||||
{:ok, %{plan: plan} = subscription} <-
|
||||
WandererApp.Map.SubscriptionManager.get_active_map_subscription(map_id),
|
||||
{:ok, map_balance} <- WandererApp.Map.SubscriptionManager.get_balance(map) do
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(status: plan)
|
||||
|> assign(title: get_title(subscription))
|
||||
|> assign(balance: map_balance)}
|
||||
else
|
||||
_error ->
|
||||
{:ok, socket}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<div
|
||||
id={@id}
|
||||
class="cursor-pointer flex gap-1 px-1 rounded-md items-center justify-center transition-all hover:bg-stone-700/90"
|
||||
title={@title}
|
||||
phx-click="show_topup"
|
||||
phx-target={@myself}
|
||||
>
|
||||
<div>
|
||||
<span class="text-md">
|
||||
<%= case @status do %>
|
||||
<% :alpha -> %>
|
||||
α
|
||||
<% :omega -> %>
|
||||
Ω
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="ml-auto text-right">
|
||||
<span class="text-md font-semibold text-green-600">
|
||||
ISK {@balance
|
||||
|> Number.to_human(units: ["", "K", "M", "B", "T", "P"])}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
"""
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("show_topup", _params, socket) do
|
||||
notify_to(socket.assigns.notify_to, socket.assigns.event_name, socket.assigns.map_slug)
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
defp get_title(%{plan: plan, auto_renew?: auto_renew?, active_till: active_till} = subscription) do
|
||||
if plan != :alpha do
|
||||
"Active subscription: omega \nActive till: #{Calendar.strftime(active_till, "%m/%d/%Y")} \nAuto renew: #{auto_renew?}"
|
||||
else
|
||||
"Active subscription: alpha"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -121,6 +121,19 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
),
|
||||
do: socket
|
||||
|
||||
def handle_server_event({"show_topup", _map_slug}, socket) do
|
||||
socket
|
||||
|> assign(show_topup: true)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_server_event(
|
||||
{_event, {:flash, type, message}},
|
||||
socket
|
||||
) do
|
||||
socket |> put_flash(type, message)
|
||||
end
|
||||
|
||||
def handle_server_event(event, socket) do
|
||||
Logger.warning(fn -> "unhandled map core event: #{inspect(event)}" end)
|
||||
socket
|
||||
@@ -135,7 +148,7 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
|
||||
if is_version_valid? do
|
||||
map_id = Map.get(assigns, :map_id)
|
||||
|
||||
|
||||
case map_id do
|
||||
map_id when not is_nil(map_id) ->
|
||||
maybe_start_map(map_id)
|
||||
@@ -481,19 +494,23 @@ defmodule WandererAppWeb.MapCoreEventHandler do
|
||||
end
|
||||
|
||||
# Load initial kill counts
|
||||
kills_data = case WandererApp.Map.get_map(map_id) do
|
||||
{:ok, %{systems: systems}} ->
|
||||
systems
|
||||
|> Enum.map(fn {solar_system_id, _system} ->
|
||||
kills_count = case WandererApp.Cache.get("zkb:kills:#{solar_system_id}") do
|
||||
count when is_integer(count) and count >= 0 -> count
|
||||
_ -> 0
|
||||
end
|
||||
%{solar_system_id: solar_system_id, kills: kills_count}
|
||||
end)
|
||||
_ ->
|
||||
nil
|
||||
end
|
||||
kills_data =
|
||||
case WandererApp.Map.get_map(map_id) do
|
||||
{:ok, %{systems: systems}} ->
|
||||
systems
|
||||
|> Enum.map(fn {solar_system_id, _system} ->
|
||||
kills_count =
|
||||
case WandererApp.Cache.get("zkb:kills:#{solar_system_id}") do
|
||||
count when is_integer(count) and count >= 0 -> count
|
||||
_ -> 0
|
||||
end
|
||||
|
||||
%{solar_system_id: solar_system_id, kills: kills_count}
|
||||
end)
|
||||
|
||||
_ ->
|
||||
nil
|
||||
end
|
||||
|
||||
initial_data =
|
||||
%{
|
||||
|
||||
@@ -7,8 +7,12 @@ defmodule WandererAppWeb.MapSystemsEventHandler do
|
||||
|
||||
def handle_server_event(%{event: :add_system, payload: system}, socket) do
|
||||
# Schedule kill update for the new system after a short delay to allow subscription
|
||||
Process.send_after(self(), %{event: :update_system_kills, payload: system.solar_system_id}, 2000)
|
||||
|
||||
Process.send_after(
|
||||
self(),
|
||||
%{event: :update_system_kills, payload: system.solar_system_id},
|
||||
2000
|
||||
)
|
||||
|
||||
socket
|
||||
|> MapEventHandler.push_map_event("add_systems", [
|
||||
MapEventHandler.map_ui_system(system)
|
||||
@@ -319,7 +323,8 @@ defmodule WandererAppWeb.MapSystemsEventHandler do
|
||||
defp update_system_position(map_id, %{
|
||||
"position" => %{"x" => x, "y" => y},
|
||||
"solar_system_id" => solar_system_id
|
||||
}),
|
||||
})
|
||||
when not is_nil(x) and not is_nil(y) and not is_nil(solar_system_id),
|
||||
do:
|
||||
map_id
|
||||
|> WandererApp.Map.Server.update_system_position(%{
|
||||
@@ -327,4 +332,6 @@ defmodule WandererAppWeb.MapSystemsEventHandler do
|
||||
position_x: x,
|
||||
position_y: y
|
||||
})
|
||||
|
||||
defp update_system_position(_map_id, _position), do: :ok
|
||||
end
|
||||
|
||||
@@ -13,8 +13,11 @@ defmodule WandererAppWeb.MapLive do
|
||||
|> assign(
|
||||
map_slug: map_slug,
|
||||
map_loaded?: false,
|
||||
show_topup: false,
|
||||
active_subscription_tab: "balance",
|
||||
server_online: false,
|
||||
selected_subscription: nil,
|
||||
map_subscriptions_enabled: WandererApp.Env.map_subscriptions_enabled?(),
|
||||
active_subscription: nil,
|
||||
user_permissions: nil
|
||||
)
|
||||
|> push_event("js-exec", %{
|
||||
@@ -31,8 +34,10 @@ defmodule WandererAppWeb.MapLive do
|
||||
|> assign(
|
||||
map_slug: nil,
|
||||
map_loaded?: false,
|
||||
show_topup: false,
|
||||
server_online: false,
|
||||
selected_subscription: nil,
|
||||
active_subscription: nil,
|
||||
map_subscriptions_enabled: WandererApp.Env.map_subscriptions_enabled?(),
|
||||
user_permissions: nil
|
||||
)}
|
||||
end
|
||||
@@ -107,6 +112,10 @@ defmodule WandererAppWeb.MapLive do
|
||||
socket
|
||||
|> WandererAppWeb.MapEventHandler.handle_event(info)}
|
||||
|
||||
@impl true
|
||||
def handle_event("change_subscription_tab", %{"tab" => tab}, socket),
|
||||
do: {:noreply, socket |> assign(active_subscription_tab: tab)}
|
||||
|
||||
@impl true
|
||||
def handle_event(event, body, socket) do
|
||||
WandererAppWeb.MapEventHandler.handle_ui_event(event, body, socket)
|
||||
|
||||
@@ -13,6 +13,16 @@
|
||||
event_name="change_map"
|
||||
/>
|
||||
|
||||
<.live_component
|
||||
:if={not is_nil(assigns |> Map.get(:map_slug)) && @map_subscriptions_enabled}
|
||||
module={WandererAppWeb.MapSubscription}
|
||||
id="map-subscription"
|
||||
notify_to={self()}
|
||||
current_user={@current_user}
|
||||
map_slug={@map_slug}
|
||||
event_name="show_topup"
|
||||
/>
|
||||
|
||||
<button
|
||||
:if={(@user_permissions || %{}) |> Map.get(:track_character, false)}
|
||||
id="show-activity-button"
|
||||
@@ -25,18 +35,162 @@
|
||||
<.link
|
||||
:if={(@user_permissions || %{}) |> Map.get(:delete_map, false)}
|
||||
id={"map-audit-#{@map_slug}"}
|
||||
class="h-8 w-8 hover:text-white"
|
||||
navigate={~p"/#{@map_slug}/audit?period=1H&activity=all"}
|
||||
>
|
||||
<.icon name="hero-key-solid" class="w-6 h-6" />
|
||||
<button
|
||||
class="h-8 w-8 hover:text-white"
|
||||
>
|
||||
<.icon name="hero-key-solid" class="w-6 h-6" />
|
||||
</button>
|
||||
</.link>
|
||||
|
||||
<.link
|
||||
:if={(@user_permissions || %{}) |> Map.get(:delete_map, false)}
|
||||
id={"map-characters-#{@map_slug}"}
|
||||
class="h-8 w-8 hover:text-white"
|
||||
navigate={~p"/#{@map_slug}/characters"}
|
||||
>
|
||||
<.icon name="hero-user-group-solid" class="w-6 h-6" />
|
||||
<button
|
||||
class="h-8 w-8 hover:text-white"
|
||||
>
|
||||
<.icon name="hero-user-group-solid" class="w-6 h-6" />
|
||||
</button>
|
||||
</.link>
|
||||
</div>
|
||||
|
||||
<.modal
|
||||
:if={@show_topup}
|
||||
title="Map Subscription Info"
|
||||
class="!min-w-[700px]"
|
||||
id="map-topup-modal"
|
||||
show
|
||||
on_cancel={JS.navigate(~p"/#{@map_slug}")}
|
||||
>
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="verticalTabsContainer">
|
||||
<div class="p-tabview p-component" data-pc-name="tabview" data-pc-section="root">
|
||||
<div class="p-tabview-nav-container" data-pc-section="navcontainer">
|
||||
<div class="p-tabview-nav-content" data-pc-section="navcontent">
|
||||
<ul class="p-tabview-nav" role="tablist" data-pc-section="nav">
|
||||
<li
|
||||
class={[
|
||||
"p-unselectable-text",
|
||||
classes("p-tabview-selected p-highlight": @active_subscription_tab == "balance")
|
||||
]}
|
||||
role="presentation"
|
||||
data-pc-name=""
|
||||
data-pc-section="header"
|
||||
|
||||
>
|
||||
<a
|
||||
role="tab"
|
||||
class="p-tabview-nav-link flex p-[10px]"
|
||||
tabindex="-1"
|
||||
aria-controls="pr_id_332_content"
|
||||
aria-selected="false"
|
||||
aria-disabled="false"
|
||||
data-pc-section="headeraction"
|
||||
phx-click="change_subscription_tab"
|
||||
phx-value-tab="balance"
|
||||
>
|
||||
<span class="p-tabview-title" data-pc-section="headertitle">
|
||||
<.icon name="hero-banknotes-solid" class="w-4 h-4" /> Balance
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
:if={@map_subscriptions_enabled?}
|
||||
class={[
|
||||
"p-unselectable-text",
|
||||
classes(
|
||||
"p-tabview-selected p-highlight": @active_subscription_tab == "subscription"
|
||||
)
|
||||
]}
|
||||
role="presentation"
|
||||
data-pc-name=""
|
||||
data-pc-section="header"
|
||||
>
|
||||
<a
|
||||
role="tab"
|
||||
class="p-tabview-nav-link flex p-[10px]"
|
||||
tabindex="-1"
|
||||
aria-controls="pr_id_334_content"
|
||||
aria-selected="false"
|
||||
aria-disabled="false"
|
||||
data-pc-section="headeraction"
|
||||
phx-click="change_subscription_tab"
|
||||
phx-value-tab="subscription"
|
||||
>
|
||||
<span class="p-tabview-title" data-pc-section="headertitle">
|
||||
<.icon name="hero-check-badge-solid" class="w-4 h-4" /> Subscription
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class={[
|
||||
"p-unselectable-text",
|
||||
classes("p-tabview-selected p-highlight": false)
|
||||
]}
|
||||
role="presentation"
|
||||
data-pc-name=""
|
||||
data-pc-section="header"
|
||||
>
|
||||
<a
|
||||
role="tab"
|
||||
class="p-tabview-nav-link flex p-[10px]"
|
||||
tabindex="-1"
|
||||
aria-controls="pr_id_332_content"
|
||||
aria-selected="false"
|
||||
aria-disabled="false"
|
||||
data-pc-section="headeraction"
|
||||
phx-click="change_settings_tab"
|
||||
phx-value-tab="balance"
|
||||
>
|
||||
<span class="p-tabview-title" data-pc-section="headertitle">
|
||||
<.icon name="hero-arrow-up-solid" class="w-4 h-4" /> Top Donators <span class="badge">coming soon</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-tabview-panels" data-pc-section="panelcontainer">
|
||||
<div
|
||||
id="pr_id_330_content"
|
||||
class="p-tabview-panel"
|
||||
role="tabpanel"
|
||||
aria-labelledby="pr_id_33_header_0"
|
||||
data-pc-name=""
|
||||
data-pc-section="content"
|
||||
>
|
||||
<.live_component
|
||||
:if={@active_subscription_tab == "balance" && not is_nil(assigns |> Map.get(:map_id))}
|
||||
module={WandererAppWeb.Maps.MapBalanceComponent}
|
||||
id="map-balance-component"
|
||||
map_id={@map_id}
|
||||
notify_to={self()}
|
||||
event_name="balance_event"
|
||||
current_user={@current_user}
|
||||
/>
|
||||
|
||||
<.live_component
|
||||
:if={@active_subscription_tab == "subscription"}
|
||||
module={WandererAppWeb.Maps.MapSubscriptionsComponent}
|
||||
id="map-subscriptions-component"
|
||||
map_id={@map_id}
|
||||
notify_to={self()}
|
||||
event_name="subscriptions_event"
|
||||
current_user={@current_user}
|
||||
readonly={(@user_permissions || %{}) |> Map.get(:delete_map, false) |> Kernel.not()}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-action">
|
||||
|
||||
</div>
|
||||
</.modal>
|
||||
|
||||
@@ -31,8 +31,8 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
subscription_form = %{
|
||||
"plan" => "omega",
|
||||
"period" => "1",
|
||||
"characters_limit" => "100",
|
||||
"hubs_limit" => "10",
|
||||
"characters_limit" => "50",
|
||||
"hubs_limit" => "20",
|
||||
"auto_renew?" => true
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
}
|
||||
>
|
||||
<.button
|
||||
:if={not @is_adding_subscription?}
|
||||
:if={not @readonly && not @is_adding_subscription?}
|
||||
type="button"
|
||||
disabled={
|
||||
@map_subscriptions |> Enum.at(0) |> Map.get(:status) == :active &&
|
||||
@@ -462,7 +462,7 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
{if subscription.auto_renew?, do: "Yes", else: "No"}
|
||||
</:col>
|
||||
<:action :let={subscription}>
|
||||
<div class="tooltip tooltip-left" data-tip="Edit subscription">
|
||||
<div :if={not @readonly} class="tooltip tooltip-left" data-tip="Edit subscription">
|
||||
<button
|
||||
:if={subscription.status == :active && subscription.plan != :alpha}
|
||||
phx-click="edit-subscription"
|
||||
@@ -474,7 +474,7 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
</div>
|
||||
</:action>
|
||||
<:action :let={subscription}>
|
||||
<div class="tooltip tooltip-left" data-tip="Cancel subscription">
|
||||
<div :if={not @readonly} class="tooltip tooltip-left" data-tip="Cancel subscription">
|
||||
<button
|
||||
:if={subscription.status == :active && subscription.plan != :alpha}
|
||||
phx-click="cancel-subscription"
|
||||
@@ -488,7 +488,10 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<.header :if={@is_adding_subscription?} class="bordered border-1 flex flex-col gap-4">
|
||||
<.header
|
||||
:if={not @readonly && @is_adding_subscription?}
|
||||
class="bordered border-1 flex flex-col gap-4"
|
||||
>
|
||||
<div :if={is_nil(@selected_subscription)}>
|
||||
Add subscription
|
||||
</div>
|
||||
@@ -519,9 +522,9 @@ defmodule WandererAppWeb.Maps.MapSubscriptionsComponent do
|
||||
label="Characters limit"
|
||||
show_value={true}
|
||||
type="range"
|
||||
min="100"
|
||||
min="50"
|
||||
max="5000"
|
||||
step="100"
|
||||
step="50"
|
||||
class="range range-xs"
|
||||
/>
|
||||
<.input
|
||||
|
||||
@@ -515,19 +515,19 @@ defmodule WandererAppWeb.MapsLive do
|
||||
{:ok, tmp_file_path}
|
||||
end)
|
||||
|
||||
Task.async(fn ->
|
||||
{:ok, data} =
|
||||
WandererApp.Utils.JSONUtil.read_json(uploaded_file_path)
|
||||
# Task.async(fn ->
|
||||
# {:ok, data} =
|
||||
# WandererApp.Utils.JSONUtil.read_json(uploaded_file_path)
|
||||
|
||||
WandererApp.Map.Manager.start_map(map_id)
|
||||
# WandererApp.Map.Manager.start_map(map_id)
|
||||
|
||||
:timer.sleep(1000)
|
||||
# :timer.sleep(1000)
|
||||
|
||||
map_id
|
||||
|> WandererApp.Map.Server.import_settings(data, current_user.id)
|
||||
# map_id
|
||||
# |> WandererApp.Map.Server.import_settings(data, current_user.id)
|
||||
|
||||
:imported
|
||||
end)
|
||||
# :imported
|
||||
# end)
|
||||
|
||||
{:noreply,
|
||||
socket
|
||||
@@ -543,7 +543,7 @@ defmodule WandererAppWeb.MapsLive do
|
||||
selected_subscription
|
||||
) do
|
||||
%{
|
||||
extra_characters_100: extra_characters_100,
|
||||
extra_characters_50: extra_characters_50,
|
||||
extra_hubs_10: extra_hubs_10
|
||||
} = WandererApp.Env.subscription_settings()
|
||||
|
||||
@@ -558,7 +558,7 @@ defmodule WandererAppWeb.MapsLive do
|
||||
case characters_limit > sub_characters_limit do
|
||||
true ->
|
||||
additional_price +
|
||||
(characters_limit - sub_characters_limit) / 100 * extra_characters_100
|
||||
(characters_limit - sub_characters_limit) / 50 * extra_characters_50
|
||||
|
||||
_ ->
|
||||
additional_price
|
||||
|
||||
@@ -432,9 +432,9 @@
|
||||
for={@import_form}
|
||||
phx-change="import"
|
||||
>
|
||||
<div phx-drop-target="{@uploads.settings.ref}">
|
||||
<%!-- <div phx-drop-target="{@uploads.settings.ref}">
|
||||
<.live_file_input upload={@uploads.settings} />
|
||||
</div>
|
||||
</div> --%>
|
||||
</.form>
|
||||
<progress :if={@importing} class="progress w-56"></progress>
|
||||
<.button
|
||||
@@ -547,6 +547,7 @@
|
||||
notify_to={self()}
|
||||
event_name="subscriptions_event"
|
||||
current_user={@current_user}
|
||||
readonly={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user