mirror of
https://github.com/vicliu624/trail-mate.git
synced 2026-08-29 07:08:27 +00:00
Use short labels for team members
This commit is contained in:
@@ -55,8 +55,7 @@ class TeamPageEventEffectSink
|
||||
const TeamPageRuntimePort& runtime,
|
||||
const TeamPageKeyEventLog& key_log,
|
||||
ITeamPageEventDeferred& deferred,
|
||||
ITeamPageEventNotifier& notifier,
|
||||
const ITeamPageMemberNameResolver& names) const;
|
||||
ITeamPageEventNotifier& notifier) const;
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
||||
@@ -36,18 +36,10 @@ struct TeamPageEventState
|
||||
std::vector<TeamMemberUi> members;
|
||||
};
|
||||
|
||||
class ITeamPageMemberNameResolver
|
||||
{
|
||||
public:
|
||||
virtual ~ITeamPageMemberNameResolver() = default;
|
||||
virtual std::string resolveMemberName(uint32_t node_id) const = 0;
|
||||
};
|
||||
|
||||
struct TeamPageEventContext
|
||||
{
|
||||
uint32_t now_s = 0;
|
||||
uint32_t self_node_id = 0;
|
||||
const ITeamPageMemberNameResolver* names = nullptr;
|
||||
};
|
||||
|
||||
struct TeamPageEventEffects
|
||||
@@ -143,7 +135,7 @@ class TeamPageEventReducer
|
||||
void applyPairingIdentity(TeamPageEventState& state,
|
||||
const TeamPagePairingUpdate& update) const;
|
||||
bool isPairingActive(TeamPairingState state) const;
|
||||
std::string resolveMemberName(uint32_t node_id) const;
|
||||
std::string memberDisplayLabel(uint32_t node_id) const;
|
||||
void assignMemberColor(TeamMemberUi& member) const;
|
||||
|
||||
TeamPageEventContext context_;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
namespace ui
|
||||
{
|
||||
namespace team_presentation
|
||||
{
|
||||
|
||||
inline std::string shortTeamMemberLabel(uint32_t node_id)
|
||||
{
|
||||
char label[5]{};
|
||||
std::snprintf(label,
|
||||
sizeof(label),
|
||||
"%04lX",
|
||||
static_cast<unsigned long>(node_id & 0xFFFFU));
|
||||
return std::string(label);
|
||||
}
|
||||
|
||||
} // namespace team_presentation
|
||||
} // namespace ui
|
||||
Reference in New Issue
Block a user