Skip to content

Commit

Permalink
make leaderboard visible
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikue committed Jan 23, 2024
1 parent dcb4359 commit 647bc01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/chat_socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare const CONFIG: Config|undefined;
let ws: ReconnectingWebSocket|null = null;

export function connectChatSocket() {
if (!CONFIG) return null;
if (!CONFIG) return;
ws = new ReconnectingWebSocket(CONFIG.chat_url);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Leaderboard from "components/Leaderboard.vue";
<div id="vueMain">
<div class="ng-extend"><ExtensionBar /></div>
<div id="content">
<div id="neuroglancer-container"></div>
<div id="neuroglancer-container" style="width: 0;"></div>
<Leaderboard class="ng-extend"></Leaderboard>
</div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {createPinia} from 'pinia';
import 'neuroglancer/ui/default_viewer.css';

import App from 'components/App.vue';
import {useLayersStore} from 'src/store';
import {useLayersStore, useStatsStore, useChatStore} from 'src/store';
import {connectChatSocket} from 'src/chat_socket';
import {setupDefaultViewer} from 'third_party/neuroglancer/ui/default_viewer_setup';

function mergeTopBars() {
Expand All @@ -25,4 +26,9 @@ window.addEventListener('DOMContentLoaded', () => {
const viewer = setupDefaultViewer();
initializeWithViewer(viewer);
mergeTopBars();
const {loopUpdateLeaderboard} = useStatsStore();
loopUpdateLeaderboard();
connectChatSocket();
const {joinChat} = useChatStore();
joinChat();
});
4 changes: 2 additions & 2 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const useStatsStore = defineStore('stats', () => {
*/
}

return {leaderboardLoaded, leaderboardEntries, setLeaderboardTimespan, resetLeaderboard};
return {leaderboardLoaded, leaderboardEntries, setLeaderboardTimespan, resetLeaderboard, loopUpdateLeaderboard};
});

interface ServerMessage {
Expand Down Expand Up @@ -439,5 +439,5 @@ export const useChatStore = defineStore('chat', () => {
}
}

return {chatMessages, unreadMessages, sendMessage, markLastMessageRead};
return {chatMessages, unreadMessages, sendMessage, markLastMessageRead, joinChat};
});

0 comments on commit 647bc01

Please sign in to comment.