mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-11-02 23:47:04 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83801c9063 | ||
|
|
0f34350c58 | ||
|
|
1c4c0f0715 | ||
|
|
3825fc831a | ||
|
|
654670cbc8 |
@@ -1,6 +1,27 @@
|
||||
FROM elixir:1.17-otp-27
|
||||
|
||||
RUN apt install -yq curl gnupg
|
||||
# Install OS packages and Node.js (via nodesource),
|
||||
# plus inotify-tools and yarn
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
sudo \
|
||||
curl \
|
||||
make \
|
||||
git \
|
||||
bash \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
jq \
|
||||
vim \
|
||||
net-tools \
|
||||
procps \
|
||||
# Optionally add any other tools you need, e.g. vim, wget...
|
||||
&& curl -sL https://deb.nodesource.com/setup_18.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends nodejs inotify-tools \
|
||||
&& npm install -g yarn \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN apt --fix-broken install
|
||||
|
||||
RUN mix local.hex --force
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
{
|
||||
"name": "wanderer-dev",
|
||||
"dockerComposeFile": ["./docker-compose.yml"],
|
||||
"extensions": [
|
||||
"jakebecker.elixir-ls",
|
||||
"JakeBecker.elixir-ls",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode"
|
||||
],
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"jakebecker.elixir-ls",
|
||||
"JakeBecker.elixir-ls",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode"
|
||||
],
|
||||
"settings": {
|
||||
"editor.formatOnSave": true,
|
||||
"search.exclude": {
|
||||
"**/doc": true
|
||||
},
|
||||
"elixirLS.dialyzerEnabled": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"service": "wanderer",
|
||||
"workspaceFolder": "/app",
|
||||
"shutdownAction": "stopCompose",
|
||||
"settings": {
|
||||
"editor.formatOnSave": true,
|
||||
"search.exclude": {
|
||||
"**/doc": true
|
||||
},
|
||||
"elixirLS.dialyzerEnabled": false
|
||||
}
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/common-utils:2": {
|
||||
"networkArgs": ["--add-host=host.docker.internal:host-gateway"]
|
||||
}
|
||||
},
|
||||
"forwardPorts": [4444]
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ services:
|
||||
|
||||
wanderer:
|
||||
environment:
|
||||
PORT: 8000
|
||||
PORT: 4444
|
||||
DB_HOST: db
|
||||
WEB_APP_URL: "http://localhost:8000"
|
||||
WEB_APP_URL: "http://localhost:4444"
|
||||
ERL_AFLAGS: "-kernel shell_history enabled"
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- 8000:8000
|
||||
- 4444:4444
|
||||
volumes:
|
||||
- ..:/app:delegated
|
||||
- ~/.gitconfig:/root/.gitconfig
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -2,6 +2,17 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.56.1](https://github.com/wanderer-industries/wanderer/compare/v1.56.0...v1.56.1) (2025-03-18)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* update activity api (#284)
|
||||
|
||||
* qol updates for dev (#283)
|
||||
|
||||
## [v1.56.0](https://github.com/wanderer-industries/wanderer/compare/v1.55.2...v1.56.0) (2025-03-17)
|
||||
|
||||
|
||||
|
||||
@@ -13,18 +13,12 @@ export const useTrackAndFollowHandlers = () => {
|
||||
* Handle hiding the track and follow dialog
|
||||
*/
|
||||
const handleHideTracking = useCallback(() => {
|
||||
// Send the command to the server first
|
||||
outCommand({
|
||||
type: OutCommand.hideTracking,
|
||||
data: {},
|
||||
});
|
||||
|
||||
// Then update local state to hide the dialog
|
||||
update(state => ({
|
||||
...state,
|
||||
showTrackAndFollow: false,
|
||||
}));
|
||||
}, [outCommand, update]);
|
||||
}, [update]);
|
||||
|
||||
/**
|
||||
* Handle showing the track and follow dialog
|
||||
@@ -101,7 +95,6 @@ export const useTrackAndFollowHandlers = () => {
|
||||
[outCommand],
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Handle user settings updates
|
||||
*/
|
||||
|
||||
@@ -45,16 +45,9 @@ export const useCommandsActivity = () => {
|
||||
}));
|
||||
}, []);
|
||||
|
||||
const hideTracking = useCallback(() => {
|
||||
ref.current.update((state: MapRootData) => ({
|
||||
...state,
|
||||
showTrackAndFollow: false,
|
||||
}));
|
||||
}, []);
|
||||
|
||||
const userSettingsUpdated = useCallback((data: CommandUserSettingsUpdated) => {
|
||||
emitMapEvent({ name: Commands.userSettingsUpdated, data });
|
||||
}, []);
|
||||
|
||||
return { characterActivityData, trackingCharactersData, userSettingsUpdated, hideActivity, hideTracking };
|
||||
return { characterActivityData, trackingCharactersData, userSettingsUpdated, hideActivity };
|
||||
};
|
||||
|
||||
@@ -241,7 +241,6 @@ export enum OutCommand {
|
||||
// Only UI commands
|
||||
openSettings = 'open_settings',
|
||||
showActivity = 'show_activity',
|
||||
hideTracking = 'hide_tracking',
|
||||
showTracking = 'show_tracking',
|
||||
getUserSettings = 'get_user_settings',
|
||||
updateUserSettings = 'update_user_settings',
|
||||
|
||||
@@ -691,40 +691,44 @@ defmodule WandererAppWeb.MapAPIController do
|
||||
}}
|
||||
]
|
||||
def character_activity(conn, params) do
|
||||
with {:ok, map_id} <- Util.fetch_map_id(params),
|
||||
current_user <- conn.assigns.current_user do
|
||||
# Get raw activity data from the domain logic
|
||||
result = WandererApp.Character.Activity.process_character_activity(map_id, current_user)
|
||||
with {:ok, map_id} <- Util.fetch_map_id(params) do
|
||||
# Get raw activity data directly from the Map module instead of the Activity processor
|
||||
raw_activity = WandererApp.Map.get_character_activity(map_id)
|
||||
|
||||
# Group activities by user_id and summarize
|
||||
summarized_result =
|
||||
result
|
||||
|> Enum.group_by(fn activity ->
|
||||
# Get user_id from the character
|
||||
activity.character.user_id
|
||||
end)
|
||||
|> Enum.map(fn {_user_id, user_activities} ->
|
||||
# Get the most active or followed character for this user
|
||||
representative_activity =
|
||||
user_activities
|
||||
|> Enum.max_by(fn activity ->
|
||||
activity.passages + activity.connections + activity.signatures
|
||||
end)
|
||||
if raw_activity == [] do
|
||||
# Return empty list if there's no data
|
||||
[]
|
||||
else
|
||||
raw_activity
|
||||
|> Enum.group_by(fn activity ->
|
||||
# Get user_id from the character
|
||||
activity.character.user_id
|
||||
end)
|
||||
|> Enum.map(fn {_user_id, user_activities} ->
|
||||
# Get the most active or followed character for this user
|
||||
representative_activity =
|
||||
user_activities
|
||||
|> Enum.max_by(fn activity ->
|
||||
activity.passages + activity.connections + activity.signatures
|
||||
end)
|
||||
|
||||
# Sum up all activities for this user
|
||||
total_passages = Enum.sum(Enum.map(user_activities, & &1.passages))
|
||||
total_connections = Enum.sum(Enum.map(user_activities, & &1.connections))
|
||||
total_signatures = Enum.sum(Enum.map(user_activities, & &1.signatures))
|
||||
# Sum up all activities for this user
|
||||
total_passages = Enum.sum(Enum.map(user_activities, & &1.passages))
|
||||
total_connections = Enum.sum(Enum.map(user_activities, & &1.connections))
|
||||
total_signatures = Enum.sum(Enum.map(user_activities, & &1.signatures))
|
||||
|
||||
# Return summarized activity with the mapped character
|
||||
%{
|
||||
character: character_to_json(representative_activity.character),
|
||||
passages: total_passages,
|
||||
connections: total_connections,
|
||||
signatures: total_signatures,
|
||||
timestamp: representative_activity.timestamp
|
||||
}
|
||||
end)
|
||||
# Return summarized activity with the mapped character
|
||||
%{
|
||||
character: character_to_json(representative_activity.character),
|
||||
passages: total_passages,
|
||||
connections: total_connections,
|
||||
signatures: total_signatures,
|
||||
timestamp: representative_activity.timestamp
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
||||
json(conn, %{data: summarized_result})
|
||||
else
|
||||
|
||||
@@ -155,10 +155,6 @@ defmodule WandererAppWeb.MapCharactersEventHandler do
|
||||
{:ok, tracking_data} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> MapEventHandler.push_map_event(
|
||||
"show_tracking",
|
||||
%{}
|
||||
)
|
||||
|> MapEventHandler.push_map_event(
|
||||
"tracking_characters_data",
|
||||
%{characters: tracking_data}
|
||||
|
||||
@@ -29,7 +29,6 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
@map_characters_ui_events [
|
||||
"toggle_track",
|
||||
"toggle_follow",
|
||||
"hide_tracking",
|
||||
"show_tracking",
|
||||
"getCharacterInfo"
|
||||
]
|
||||
@@ -305,12 +304,12 @@ defmodule WandererAppWeb.MapEventHandler do
|
||||
type,
|
||||
body
|
||||
) do
|
||||
socket
|
||||
|> Phoenix.LiveView.Utils.push_event("map_event", %{
|
||||
type: type,
|
||||
body: body
|
||||
})
|
||||
end
|
||||
socket
|
||||
|> Phoenix.LiveView.Utils.push_event("map_event", %{
|
||||
type: type,
|
||||
body: body
|
||||
})
|
||||
end
|
||||
|
||||
def push_map_event(socket, _type, _body), do: socket
|
||||
|
||||
|
||||
Reference in New Issue
Block a user