Skip to content

Commit

Permalink
Merge pull request #256 from elmadev/dev
Browse files Browse the repository at this point in the history
Live release 2 nov 2024
  • Loading branch information
sunehs authored Nov 2, 2024
2 parents aa054b8 + dae4891 commit 205da74
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 60 deletions.
1 change: 1 addition & 0 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export const IntBestTimes = kuskiIndex => {
};
export const LevelPacksByLevel = LevelIndex =>
api.get(`levelpack/byLevel/${+LevelIndex}`);
export const CupsByLevel = LevelIndex => api.get(`cups/byLevel/${+LevelIndex}`);
export const LatestLevelPacks = limit => api.get(`levelpack/latest/${limit}`);

export const LevelPackRecordHistory = (name, opts) =>
Expand Down
12 changes: 12 additions & 0 deletions src/pages/level/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const Level = ({ LevelId }) => {
eolLoading,
timeStats,
levelpacks,
cups,
statsLoading,
settings: { fancyMap, showGravityApples },
personalLeaderHistory,
Expand Down Expand Up @@ -276,6 +277,17 @@ const Level = ({ LevelId }) => {
])}
</div>
)}
{cups && cups.length > 0 && (
<div>
{`Cup: `}
{cups.map((cup, index) => [
index > 0 && ', ',
<Link to={`/cup/${cup.ShortName}/events`}>
{cup.CupName}
</Link>,
])}
</div>
)}
{level.AcceptBugs !== 0 && (
<div>Apple bugs are allowed in this level.</div>
)}
Expand Down
11 changes: 11 additions & 0 deletions src/pages/level/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
LevelTimeStats,
LeaderHistory,
LevelPacksByLevel,
CupsByLevel,
GetLevelTags,
UpdateLevelTags,
} from 'api';
Expand All @@ -17,6 +18,7 @@ export default {
besttimesLoading: false,
level: {},
levelpacks: [],
cups: [],
battlesForLevel: [],
loading: true,
allfinished: [],
Expand Down Expand Up @@ -63,6 +65,9 @@ export default {
setLevelPacks: action((state, payload) => {
state.levelpacks = payload;
}),
setCups: action((state, payload) => {
state.cups = payload;
}),
setBattlesForLevel: action((state, payload) => {
state.battlesForLevel = payload;
}),
Expand All @@ -84,6 +89,12 @@ export default {
actions.setLevelPacks(res.data);
}
});

CupsByLevel(payload).then(res => {
if (res.ok) {
actions.setCups(res.data);
}
});
}),
setAllfinished: action((state, payload) => {
state.allfinished = payload.times;
Expand Down
Loading

0 comments on commit 205da74

Please sign in to comment.