refactor: remove voting system, add author colors + pin numbering

- Remove votes backend (route, db functions, server mount)
- Remove votes frontend (store, socket, PinOverlay badges, FeedbackPanel UI)
- Add authorColors utility (8-color palette, deterministic hash)
- Add getPinNumber() to annotationStore
- Fix JWT to include username/display_name
- Add resolveAuthorName DB fallback for old tokens
This commit is contained in:
Hiren Kangad
2026-03-11 00:54:48 +05:30
parent f7a39a1726
commit f24414e25c
11 changed files with 60 additions and 200 deletions
+2 -15
View File
@@ -304,8 +304,8 @@ export function useCanvasSetup(deps: CanvasSetupDeps) {
}
});
// ── Annotations: load threads + votes, wire socket events ──
const token = localStorage.getItem('token');
// ── Annotations: load threads, wire socket events ──
const token = localStorage.getItem('refboard_token');
if (token) {
fetch(`/api/boards/${resolvedBoardId}/threads`, {
headers: { Authorization: `Bearer ${token}` },
@@ -315,15 +315,6 @@ export function useCanvasSetup(deps: CanvasSetupDeps) {
if (data.threads) annotationStoreRef.current?.loadThreads(data.threads);
})
.catch((err) => console.error('[annotations] load threads error:', err));
fetch(`/api/boards/${resolvedBoardId}/votes`, {
headers: { Authorization: `Bearer ${token}` },
})
.then((r) => r.json())
.then((data) => {
if (data.votes) annotationStoreRef.current?.loadVotes(data.votes);
})
.catch((err) => console.error('[annotations] load votes error:', err));
}
socket.on('thread:add', (data: any) => {
@@ -344,10 +335,6 @@ export function useCanvasSetup(deps: CanvasSetupDeps) {
socket.on('comment:delete', (data: any) => {
annotationStoreRef.current?.onCommentDelete(data.threadId, data.commentId);
});
socket.on('vote:toggle', (data: any) => {
annotationStoreRef.current?.onVoteToggle(data.objectId, data.userId, data.active);
});
// ── Pin overlay (hidden by default, shown in Review Mode) ──
const pinOverlay = new PinOverlay(viewport, scene, annotationStoreRef.current!);
pinOverlay.visible = false;