Skip to content

Commit

Permalink
fix: map save button for tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
bhoopesh369 committed Feb 13, 2024
1 parent 5bf2c28 commit a287590
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
43 changes: 27 additions & 16 deletions src/components/MapDesigner/MapDesigner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,10 @@ export default function MapDesigner(props: MapDesignerProps): JSX.Element {

useEffect(() => {
MapDesignerUtils.setLocalStorageKey(
props.pageType == 'MapDesigner' || props.pageType == 'Tutorials'
props.pageType == 'MapDesigner'
? 'cc-map-designer-map'
: props.pageType == 'Tutorials'
? 'tc-map-designer-map'
: 'dc-map-designer-map',
);
}, [props.pageType]);
Expand Down Expand Up @@ -241,11 +243,15 @@ export default function MapDesigner(props: MapDesignerProps): JSX.Element {

<Modal.Body className={styles.modalContent}>
<Container fluid>
<Row>
<p className={styles.contentP}>
<span>SAVE</span> : Save map only.
</p>
</Row>
{props.pageType == 'MapDesigner' ? (
<Row>
<p className={styles.contentP}>
<span>SAVE</span> : Save map only.
</p>
</Row>
) : (
<></>
)}
<Row>
<p className={styles.contentP}>
<span>SUBMIT</span> :{' '}
Expand All @@ -266,16 +272,21 @@ export default function MapDesigner(props: MapDesignerProps): JSX.Element {
)}
</Container>
<Container fluid className={styles.buttonRow}>
<Button
className={styles.modalButton}
size="lg"
onClick={() => {
compressImage('save');
}}
variant="outline-light"
>
SAVE
</Button>
{props.pageType == 'MapDesigner' ||
props.pageType == 'DailyChallenge' ? (
<Button
className={styles.modalButton}
size="lg"
onClick={() => {
compressImage('save');
}}
variant="outline-light"
>
SAVE
</Button>
) : (
<></>
)}
<Button
className={styles.modalButton}
size="lg"
Expand Down
6 changes: 4 additions & 2 deletions src/components/Websocket/Websocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ export const Websocket: React.FunctionComponent = () => {
const url = `${baseUrl}/ws`;
const wsClient = Stomp.over(() => new WebSocket(url));
wsClient.brokerURL = url;
const keepAliveTimeout = setInterval(() => {
wsClient.send('pong');
}, 30000);
const handleConnect = () => {
wsClient.subscribe(`/updates/${user.id}`, message => {
console.log('Received message:', message.body);
if (pageType === 'Tutorials') {
const game = JSON.parse(message.body) as TutorialGame;
if (game.status === GameStatus.Executing) {
Toast.success('Executing Now...');
return;
}
dispatch(changeSimulationState(true));
console.log(game.logs);
setTimeout(() => {
RendererUtils.loadLog(game.logs ?? '');
}, 1000);
Expand Down Expand Up @@ -97,6 +98,7 @@ export const Websocket: React.FunctionComponent = () => {

return () => {
wsClient.deactivate();
clearInterval(keepAliveTimeout);
};
}, [user, gameType, pageType]);

Expand Down
2 changes: 0 additions & 2 deletions src/pages/Dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,6 @@ export default function Dashboard(): JSX.Element {
}
};

console.log(pageState);

return (
<>
<Tour setOpened={setOpened} steps={EditorSteps}>
Expand Down

0 comments on commit a287590

Please sign in to comment.