Skip to content

Commit

Permalink
Merge pull request #486 from chrismbirmingham/leaderboard
Browse files Browse the repository at this point in the history
Leaderboard
  • Loading branch information
tcorbly authored Nov 5, 2024
2 parents 705de83 + 2f35192 commit 0483128
Show file tree
Hide file tree
Showing 5 changed files with 399 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { auth } from './firebase/firebase';

import Dashboard from './pages/Dashboard';
import Tutorials from './pages/Tutorials';
import Leaderboard from './pages/Leaderboard';

import Loading from './components/Loading';
import Root from './pages/Root';
Expand Down Expand Up @@ -125,6 +126,7 @@ class App extends React.Component<Props, State> {
<Switch>
<Route path="/" exact component={Dashboard} />
<Route path="/tutorials" exact component={Tutorials} />
<Route path="/leaderboard" exact component={Leaderboard} />
<Route path="/scene/:sceneId" component={Root} />
<Route path="/challenge/:challengeId" component={ChallengeRoot} />
<Route path="/curriculum" component={CurriculumPage} />
Expand Down
25 changes: 20 additions & 5 deletions src/components/World/SceneMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,26 @@ class SceneMenu extends React.PureComponent<Props, State> {
const { theme, onSaveAsScene, onNewScene, onSaveScene, onOpenScene, onSettingsScene, onDeleteScene, locale } = props;
return (
<Container theme={theme}>
<Item theme={theme} disabled={!onSettingsScene} onClick={onSettingsScene}><ItemIcon icon={faCogs} /> {LocalizedString.lookup(tr('Settings'), locale)}</Item>
<Item theme={theme} disabled={!onOpenScene} onClick={onOpenScene}><ItemIcon icon={faFolderOpen} /> {LocalizedString.lookup(tr('Open'), locale)}</Item>
<Item theme={theme} disabled={!onSaveScene} onClick={onSaveScene}><ItemIcon icon={faSave} /> {LocalizedString.lookup(tr('Save'), locale)}</Item>
<Item theme={theme} disabled={!onSaveAsScene} onClick={onSaveAsScene}><ItemIcon icon={faCopy} /> {LocalizedString.lookup(tr('Save As'), locale)}</Item>
<Item theme={theme} disabled={!onDeleteScene} onClick={onDeleteScene}><ItemIcon icon={faTrash} /> {LocalizedString.lookup(tr('Delete'), locale)}</Item>
<Item theme={theme} disabled={!onSettingsScene} onClick={onSettingsScene ? onSettingsScene : () => {console.log("empty");}}>
<ItemIcon icon={faCogs} />
{LocalizedString.lookup(tr('Settings'), locale)}
</Item>
<Item theme={theme} disabled={!onOpenScene} onClick={onOpenScene ? onOpenScene : () => {console.log("empty");}}>
<ItemIcon icon={faFolderOpen} />
{LocalizedString.lookup(tr('Open'), locale)}
</Item>
<Item theme={theme} disabled={!onSaveScene} onClick={onSaveScene ? onSaveScene : () => {console.log("empty");}}>
<ItemIcon icon={faSave} />
{LocalizedString.lookup(tr('Save'), locale)}
</Item>
<Item theme={theme} disabled={!onSaveAsScene} onClick={onSaveAsScene ? onSaveAsScene : () => {console.log("empty");}}>
<ItemIcon icon={faCopy} />
{LocalizedString.lookup(tr('Save As'), locale)}
</Item>
<Item theme={theme} disabled={!onDeleteScene} onClick={onDeleteScene ? onDeleteScene : () => {console.log("empty");}}>
<ItemIcon icon={faTrash} />
{LocalizedString.lookup(tr('Delete'), locale)}
</Item>
</Container>
);
}
Expand Down
14 changes: 13 additions & 1 deletion src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface DashboardPublicProps extends RouteComponentProps, ThemeProps, S
interface DashboardPrivateProps {
onTutorialsClick: () => void;
onSimulatorClick: () => void;
onLeaderboardClick: () => void;
locale: LocalizedString.Language;
}

Expand Down Expand Up @@ -67,7 +68,7 @@ class Dashboard extends React.PureComponent<Props> {

render() {
const { props } = this;
const { className, style, onTutorialsClick, onSimulatorClick, locale } = props;
const { className, style, onTutorialsClick, onSimulatorClick, onLeaderboardClick, locale } = props;
const theme = DARK;

return (
Expand Down Expand Up @@ -100,6 +101,16 @@ class Dashboard extends React.PureComponent<Props> {
hoverBackgroundSize={'95%'}
onClick={this.onAboutClick_}
/>
<Card
theme={theme}
title={LocalizedString.lookup(tr('Leaderboard'), locale)}
description={LocalizedString.lookup(tr('See the current challenge leaderboard.'), locale)}
backgroundImage={'linear-gradient(#3b3c3c, transparent), url(../../static/example_images/Gold_Medal_Robot.png)'}
backgroundColor={'#3b3c3c'}
backgroundSize={'80%'}
hoverBackgroundSize={'95%'}
onClick={onLeaderboardClick}
/>
</CardContainer>
</Container>
);
Expand All @@ -110,5 +121,6 @@ export default connect((state: State) => ({
locale: state.i18n.locale,
}), dispatch => ({
onTutorialsClick: () => dispatch(push('/tutorials')),
onLeaderboardClick: () => dispatch(push('/leaderboard')),
onSimulatorClick: () => dispatch(push('/scene/jbcSandboxA')),
}))(Dashboard) as React.ComponentType<DashboardPublicProps>;
Loading

0 comments on commit 0483128

Please sign in to comment.