From 3917a97aecb89638ad5e93e6c22ae246534ec7c6 Mon Sep 17 00:00:00 2001 From: Chris Wilton-Magras Date: Thu, 25 Apr 2024 13:30:47 +0100 Subject: [PATCH] Revert renaming of levels const (will fix later) --- .../LevelMissionInfoBanner.test.tsx | 4 ++-- .../LevelMissionInfoBanner/LevelMissionInfoBanner.tsx | 4 ++-- .../LevelSelectionBox/LevelSelectionBox.test.tsx | 10 +++++----- .../components/LevelSelectionBox/LevelSelectionBox.tsx | 4 ++-- frontend/src/components/Overlay/MissionInformation.tsx | 6 +++--- frontend/src/levels.ts | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.test.tsx b/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.test.tsx index 54508ce0e..ef09698e6 100644 --- a/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.test.tsx +++ b/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.test.tsx @@ -6,7 +6,7 @@ import { } from '@testing-library/react'; import { describe, expect, test, vi } from 'vitest'; -import { Levels } from '@src/levels'; +import { LEVELS } from '@src/levels'; import { LEVEL_NAMES } from '@src/models/level'; import LevelMissionInfoBanner from './LevelMissionInfoBanner'; @@ -23,7 +23,7 @@ describe('LevelMissionInfoBanner component tests', () => { /> ); - const expectedContent = Levels[currentLevel].missionInfoShort; + const expectedContent = LEVELS[currentLevel].missionInfoShort; if (!expectedContent) throw new Error(`No missionInfoShort found for level ${currentLevel}`); diff --git a/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.tsx b/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.tsx index 1ce90e189..b73948d28 100644 --- a/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.tsx +++ b/frontend/src/components/LevelMissionInfoBanner/LevelMissionInfoBanner.tsx @@ -1,5 +1,5 @@ import ThemedButton from '@src/components/ThemedButtons/ThemedButton'; -import { Levels } from '@src/levels'; +import { LEVELS } from '@src/levels'; import { LEVEL_NAMES } from '@src/models/level'; import './LevelMissionInfoBanner.css'; @@ -23,7 +23,7 @@ function LevelMissionInfoBanner({

{`Level ${currentLevel + 1}`}

diff --git a/frontend/src/components/LevelSelectionBox/LevelSelectionBox.test.tsx b/frontend/src/components/LevelSelectionBox/LevelSelectionBox.test.tsx index 290366659..6d959e6da 100644 --- a/frontend/src/components/LevelSelectionBox/LevelSelectionBox.test.tsx +++ b/frontend/src/components/LevelSelectionBox/LevelSelectionBox.test.tsx @@ -2,13 +2,13 @@ import { render, screen } from '@testing-library/react'; import { userEvent } from '@testing-library/user-event'; import { describe, expect, test, vi } from 'vitest'; -import { Levels } from '@src/levels'; +import { LEVELS } from '@src/levels'; import { LEVEL_NAMES } from '@src/models/level'; import LevelSelectionBox, { LevelSelectionBoxProps } from './LevelSelectionBox'; const defaultProps: LevelSelectionBoxProps = { - currentLevel: Levels[0].id, + currentLevel: LEVELS[0].id, numCompletedLevels: 0, setCurrentLevel: () => {}, }; @@ -19,7 +19,7 @@ function renderComponent(props: LevelSelectionBoxProps = defaultProps) { return { user }; } -const levels = Levels.map(({ id, name }) => ({ +const levels = LEVELS.map(({ id, name }) => ({ id, name: id === LEVEL_NAMES.SANDBOX ? name : `Level ${id + 1}`, })); @@ -50,7 +50,7 @@ describe('LevelSelectionBox component tests', () => { test('renders buttons disabled ahead of highest level completed, except for sandbox', () => { const numCompletedLevels = 1; - const currentLevel = Levels[numCompletedLevels]; + const currentLevel = LEVELS[numCompletedLevels]; const setCurrentLevel = vi.fn(); renderComponent({ @@ -70,7 +70,7 @@ describe('LevelSelectionBox component tests', () => { test('clicking aria-disabled button does not trigger level change', async () => { const numCompletedLevels = 0; - const currentLevel = Levels[numCompletedLevels]; + const currentLevel = LEVELS[numCompletedLevels]; const setCurrentLevel = vi.fn(); const { user } = renderComponent({ diff --git a/frontend/src/components/LevelSelectionBox/LevelSelectionBox.tsx b/frontend/src/components/LevelSelectionBox/LevelSelectionBox.tsx index 121624e3a..38bd15a91 100644 --- a/frontend/src/components/LevelSelectionBox/LevelSelectionBox.tsx +++ b/frontend/src/components/LevelSelectionBox/LevelSelectionBox.tsx @@ -1,7 +1,7 @@ import { clsx } from 'clsx'; import ThemedButton from '@src/components/ThemedButtons/ThemedButton'; -import { Levels } from '@src/levels'; +import { LEVELS } from '@src/levels'; import { LEVEL_NAMES } from '@src/models/level'; import './LevelSelectionBox.css'; @@ -17,7 +17,7 @@ function LevelSelectionBox({ numCompletedLevels, setCurrentLevel, }: LevelSelectionBoxProps) { - const displayLevels = Levels.map(({ id, name }) => ({ + const displayLevels = LEVELS.map(({ id, name }) => ({ id, displayName: id === LEVEL_NAMES.SANDBOX ? name : `${id + 1}`, })); diff --git a/frontend/src/components/Overlay/MissionInformation.tsx b/frontend/src/components/Overlay/MissionInformation.tsx index eff48775f..332741b0f 100644 --- a/frontend/src/components/Overlay/MissionInformation.tsx +++ b/frontend/src/components/Overlay/MissionInformation.tsx @@ -2,7 +2,7 @@ import Handler from '@src/assets/images/handler.png'; import Lawyer from '@src/assets/images/lawyer.png'; import Manager from '@src/assets/images/manager.png'; import OverlayButton from '@src/components/ThemedButtons/OverlayButton'; -import { Levels } from '@src/levels'; +import { LEVELS } from '@src/levels'; import { LEVEL_NAMES } from '@src/models/level'; import MultipageOverlay from './MultipageOverlay'; @@ -14,9 +14,9 @@ function MissionInformation({ currentLevel: LEVEL_NAMES; closeOverlay: () => void; }) { - const heading = `${Levels[currentLevel].name} Mission Info`; + const heading = `${LEVELS[currentLevel].name} Mission Info`; - const pages = Levels[currentLevel].missionInfoDialogue.map( + const pages = LEVELS[currentLevel].missionInfoDialogue.map( ({ speaker, text }, index, source) => { return { content: ( diff --git a/frontend/src/levels.ts b/frontend/src/levels.ts index c6441d664..1ca9e5ff9 100644 --- a/frontend/src/levels.ts +++ b/frontend/src/levels.ts @@ -1,6 +1,6 @@ import { Level, LEVEL_NAMES } from './models/level'; -const Levels: Level[] = [ +const LEVELS: Level[] = [ { id: LEVEL_NAMES.LEVEL_1, name: 'Level 1', @@ -93,4 +93,4 @@ const Levels: Level[] = [ }, ]; -export { Levels }; +export { LEVELS };