mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
Makes the game screen bigger by removing the status bar and moving the chat bar Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
123 lines
2.8 KiB
JavaScript
123 lines
2.8 KiB
JavaScript
/**
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
// Themes
|
|
import './styles/main.scss';
|
|
import './styles/themes/light.scss';
|
|
|
|
import { perf } from 'common/perf';
|
|
import { combineReducers } from 'common/redux';
|
|
import { setupHotReloading } from 'tgui-dev-server/link/client';
|
|
import { setupGlobalEvents } from 'tgui/events';
|
|
import { captureExternalLinks } from 'tgui/links';
|
|
import { createRenderer } from 'tgui/renderer';
|
|
import { configureStore, StoreProvider } from 'tgui/store';
|
|
import { audioMiddleware, audioReducer } from './audio';
|
|
import { chatMiddleware, chatReducer } from './chat';
|
|
import { gameMiddleware, gameReducer } from './game';
|
|
import { setupPanelFocusHacks } from './panelFocus';
|
|
import { pingMiddleware, pingReducer } from './ping';
|
|
import { settingsMiddleware, settingsReducer } from './settings';
|
|
import { telemetryMiddleware } from './telemetry';
|
|
|
|
perf.mark('inception', window.performance?.timing?.navigationStart);
|
|
perf.mark('init');
|
|
|
|
const store = configureStore({
|
|
reducer: combineReducers({
|
|
audio: audioReducer,
|
|
chat: chatReducer,
|
|
game: gameReducer,
|
|
ping: pingReducer,
|
|
settings: settingsReducer,
|
|
}),
|
|
middleware: {
|
|
pre: [
|
|
chatMiddleware,
|
|
pingMiddleware,
|
|
telemetryMiddleware,
|
|
settingsMiddleware,
|
|
audioMiddleware,
|
|
gameMiddleware,
|
|
],
|
|
},
|
|
});
|
|
|
|
const renderApp = createRenderer(() => {
|
|
const { Panel } = require('./Panel');
|
|
return (
|
|
<StoreProvider store={store}>
|
|
<Panel />
|
|
</StoreProvider>
|
|
);
|
|
});
|
|
|
|
const setupApp = () => {
|
|
// Delay setup
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', setupApp);
|
|
return;
|
|
}
|
|
|
|
setupGlobalEvents({
|
|
ignoreWindowFocus: true,
|
|
});
|
|
setupPanelFocusHacks();
|
|
captureExternalLinks();
|
|
|
|
// Subscribe for Redux state updates
|
|
store.subscribe(renderApp);
|
|
|
|
// Subscribe for bankend updates
|
|
window.update = msg => store.dispatch(Byond.parseJson(msg));
|
|
|
|
// Process the early update queue
|
|
while (true) {
|
|
const msg = window.__updateQueue__.shift();
|
|
if (!msg) {
|
|
break;
|
|
}
|
|
window.update(msg);
|
|
}
|
|
|
|
// Unhide the panel
|
|
Byond.winset('output', {
|
|
'is-visible': false,
|
|
});
|
|
Byond.winset('browseroutput', {
|
|
'is-visible': true,
|
|
'is-disabled': false,
|
|
'pos': '0x0',
|
|
'size': '0x0',
|
|
});
|
|
|
|
// Resize the panel to match the non-browser output
|
|
Byond.winget('output').then(output => {
|
|
Byond.winset('browseroutput', {
|
|
'size': output.size,
|
|
});
|
|
});
|
|
|
|
// Enable hot module reloading
|
|
if (module.hot) {
|
|
setupHotReloading();
|
|
module.hot.accept([
|
|
'./audio',
|
|
'./chat',
|
|
'./game',
|
|
'./Notifications',
|
|
'./Panel',
|
|
'./ping',
|
|
'./settings',
|
|
'./telemetry',
|
|
], () => {
|
|
renderApp();
|
|
});
|
|
}
|
|
};
|
|
|
|
setupApp();
|