Fix Story 2.3 code review findings: remove duplicate ParticipantCard.js, fix lint in ScryingPoolStrip.js
- Delete src/ui/shared/ParticipantCard.js (duplicate of boardUtils.js with conflicting implementations) - Delete tests/unit/ui/shared/ParticipantCard.test.js (tests for deleted file) - Add directorsBoard to global declarations in ScryingPoolStrip.js to fix lint errors Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
// @ts-nocheck
|
||||
/**
|
||||
* boardUtils.js
|
||||
* Shared utility functions for participant board operations.
|
||||
* Can be imported by both src/ui/ and other modules without violating import boundaries.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves the target state for a visibility toggle action.
|
||||
* active → hidden, hidden → active, ghost → ghost (no toggle)
|
||||
* @param {string} currentState
|
||||
* @returns {string} Target state
|
||||
*/
|
||||
export function resolveToggleTarget(currentState) {
|
||||
if (currentState === 'ghost') return 'ghost';
|
||||
if (currentState === 'hidden') return 'active';
|
||||
return 'hidden';
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds context for a single participant in the Director's Board.
|
||||
* @param {object} stateStore
|
||||
* @param {string} userId
|
||||
* @returns {object} Participant context
|
||||
*/
|
||||
export function buildSimpleParticipantContext(stateStore, userId) {
|
||||
const state = stateStore.getState(userId);
|
||||
return {
|
||||
userId,
|
||||
state: state ?? 'active',
|
||||
isGhost: state === 'ghost',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds context for the Director's Board grid.
|
||||
* @param {object} stateStore
|
||||
* @param {object} controller
|
||||
* @param {object} adapter
|
||||
* @returns {object} Board context
|
||||
*/
|
||||
export function buildBoardContext(stateStore, controller, adapter) {
|
||||
try {
|
||||
const users = adapter.users.all?.() ?? [];
|
||||
const participants = users.map(u => buildSimpleParticipantContext(stateStore, u.id ?? u));
|
||||
return { participants, isEmpty: participants.length === 0 };
|
||||
} catch (err) {
|
||||
console.error('[ScryingPool] buildBoardContext failed:', err);
|
||||
return { participants: [], isEmpty: true };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user