Skip to content

Commit

Permalink
feat(room-responsible): add legacy room responsible handler support (#10
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Yoronex authored Nov 17, 2024
2 parents bce3ff6 + 98838fb commit 27e3f6c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/HandlerSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import { AuthContext } from './contexts/AuthContext';
import StageEffectsView from './handlers/stage-effects';
import PosterView from './handlers/poster';
import TimeTrailRaceView from './handlers/time-trail-race';
import RoomResponsibleLegacyView from './handlers/room-responsible-legacy';

export enum Handlers {
SPOTIFY = 'CurrentlyPlayingTrackHandler',
CENTURION = 'CenturionScreenHandler',
POSTER = 'PosterScreenHandler',
STAGE_EFFECTS = 'StageEffectsHandler',
TIME_TRAIL_RACE = 'TimeTrailRaceScreenHandler',
ROOM_RESPONSIBLE_LEGACY = 'RoomResponsibleLegacyHandler',
}

export default function HandlerSwitcher() {
Expand Down Expand Up @@ -68,6 +70,8 @@ export default function HandlerSwitcher() {
return <StageEffectsView socket={screenSocket} />;
case Handlers.TIME_TRAIL_RACE:
return <TimeTrailRaceView socket={screenSocket} />;
case Handlers.ROOM_RESPONSIBLE_LEGACY:
return <RoomResponsibleLegacyView />;
default:
return <DefaultView />;
}
Expand Down
30 changes: 30 additions & 0 deletions src/handlers/room-responsible-legacy/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useEffect, useState } from 'react';
import { LoadingView } from '../default';
import { getRoomResponsibleLegacyUrl } from '../../api';

export default function RoomResponsibleLegacyView() {
const [url, setUrl] = useState('');

useEffect(() => {
getRoomResponsibleLegacyUrl().then((res) => {

Check failure on line 9 in src/handlers/room-responsible-legacy/index.tsx

View workflow job for this annotation

GitHub Actions / build-and-lint / build-and-lint-yarn

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
if (res && res.data) setUrl(res.data);
});
}, []);

if (!url) {
return (
<LoadingView>
<h1>Fetching url...</h1>
</LoadingView>
);
}

return (
<div className="h-screen w-screen bg-black">
<iframe src={url} title="Room Responsible Legacy" className="w-full h-full border-0" />
<div className="absolute bottom-0 right-0 w-10 pb-1 overflow-hidden">
<img src="/base/helmet-white.svg" alt="Aurora" />
</div>
</div>
);
}

0 comments on commit 27e3f6c

Please sign in to comment.