From 6a819722f593a8561acb2aeae8c162d78b801c86 Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:05:36 +0800 Subject: [PATCH 01/12] Remove unnecessary type annotations Since we already explicitly type the containing object, redeclaring the function parameter types would only lead to worse code readability. --- src/features/sicp/parser/ParseJson.tsx | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/features/sicp/parser/ParseJson.tsx b/src/features/sicp/parser/ParseJson.tsx index 65b061f343..b507cf6506 100644 --- a/src/features/sicp/parser/ParseJson.tsx +++ b/src/features/sicp/parser/ParseJson.tsx @@ -211,15 +211,15 @@ const handleLatex = (math: string) => { }; export const processingFunctions: Record JSX.Element> = { - '#text': (obj: JsonType, _refs: RefType) => handleText(obj.body!), + '#text': (obj, _refs) => handleText(obj.body!), - B: (obj: JsonType, refs: RefType) => {parseArr(obj.child!, refs)}, + B: (obj, refs) => {parseArr(obj.child!, refs)}, - BR: (_obj: JsonType, _refs: RefType) =>
, + BR: (_obj, _refs) =>
, DISPLAYFOOTNOTE: handleFootnote, - EM: (obj: JsonType, refs: RefType) => {parseArr(obj.child!, refs)}, + EM: (obj, refs) => {parseArr(obj.child!, refs)}, EPIGRAPH: handleEpigraph, @@ -227,35 +227,35 @@ export const processingFunctions: Record ( + FOOTNOTE_REF: (obj, refs) => ( (refs.current[obj.id!] = ref)}>{handleRef(obj, refs)} ), - JAVASCRIPTINLINE: (obj: JsonType, _refs: RefType) => {obj.body}, + JAVASCRIPTINLINE: (obj, _refs) => {obj.body}, - LATEX: (obj: JsonType, _refs: RefType) => handleLatex(obj.body!), + LATEX: (obj, _refs) => handleLatex(obj.body!), - LI: (obj: JsonType, refs: RefType) =>
  • {parseArr(obj.child!, refs)}
  • , + LI: (obj, refs) =>
  • {parseArr(obj.child!, refs)}
  • , - LINK: (obj: JsonType, _refs: RefType) => {obj.body}, + LINK: (obj, _refs) => {obj.body}, - META: (obj: JsonType, _refs: RefType) => {obj.body}, + META: (obj, _refs) => {obj.body}, - OL: (obj: JsonType, refs: RefType) =>
      {parseArr(obj.child!, refs)}
    , + OL: (obj, refs) =>
      {parseArr(obj.child!, refs)}
    , REF: handleRef, REFERENCE: handleReference, - SNIPPET: (obj: JsonType, _refs: RefType) => handleSnippet(obj), + SNIPPET: (obj, _refs) => handleSnippet(obj), - SUBHEADING: (obj: JsonType, refs: RefType) => ( + SUBHEADING: (obj, refs) => (

    {parseArr(obj.child!, refs)}

    ), - SUBSUBHEADING: (obj: JsonType, refs: RefType) => ( + SUBSUBHEADING: (obj, refs) => (


    @@ -264,13 +264,13 @@ export const processingFunctions: Record ), - TABLE: (obj: JsonType, refs: RefType) => ( + TABLE: (obj, refs) => ( {obj.child!.map((x, index) => handleTR(x, refs, index))}
    ), - TEXT: (obj: JsonType, refs: RefType) => ( + TEXT: (obj, refs) => (

    {parseArr(obj.child!, refs)}

    @@ -278,9 +278,9 @@ export const processingFunctions: Record {parseArr(obj.child!, refs)}, + TT: (obj, refs) => {parseArr(obj.child!, refs)}, - UL: (obj: JsonType, refs: RefType) =>
      {parseArr(obj.child!, refs)}
    + UL: (obj, refs) =>
      {parseArr(obj.child!, refs)}
    }; // Parse array of objects. An array of objects represent sibling nodes. From fc1210737cd7547b18edf75a4a506598c64346de Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:29:03 +0800 Subject: [PATCH 02/12] Remove unused styles These styles seem to have been duplicated to `_achievementdashboard.scss` and not used anywhere. --- src/styles/_achievementcontrol.scss | 108 ---------------------------- 1 file changed, 108 deletions(-) diff --git a/src/styles/_achievementcontrol.scss b/src/styles/_achievementcontrol.scss index 4fc7ba08b3..6dccc7865b 100644 --- a/src/styles/_achievementcontrol.scss +++ b/src/styles/_achievementcontrol.scss @@ -172,114 +172,6 @@ } } } - - .task { - .achievement-card { - cursor: pointer; - display: flex; - flex-direction: row; - height: $card-height; - transition: box-shadow 0.2s ease-out; - width: $card-width; - - .dropdown-button { - align-items: center; - display: flex; - height: $card-height; - padding: 0 0 0 0.5em; - width: $card-height; - } - - .content { - display: flex; - flex-direction: column; - height: $card-height; - width: $card-width - $card-height; - - .heading { - align-items: center; - display: flex; - flex-direction: row; - height: math.div($card-height * 3, 5); - } - - .details { - display: flex; - flex-direction: row; - font-size: 0.8em; - - p { - margin: 0; - } - - .ability { - align-items: center; - display: flex; - flex: 1 1 50%; - } - - .deadline, - .xp { - align-items: center; - display: flex; - flex: 1 1 25%; - - p { - padding: 0 0 0 0.3em; - } - } - } - - .progress { - height: 0.2em; - margin: 0.2em 0 0 0; - width: 95%; - } - } - } - - .achievement-card:hover { - box-shadow: 0 0 10px black; - transition: box-shadow 0.2s ease-in; - } - - .prerequisite-container { - $shrink-factor: 0.9; - $line-width: 1em; - // remaining-width is the empty space between line and card - $remaining-width: math.div((1 - $shrink-factor) * $card-width - 2 * $line-width, 2); - $top-spacing: 0.2em; - $line-extension: 0.1em; - - display: flex; - flex-direction: column; - - .prerequisite { - display: flex; - flex-direction: row; - max-width: $card-width; - - .dropdown-lines { - height: $top-spacing + $card-height + $remaining-width + $line-extension; - margin: -#{math.div($card-height, 1.6)} -#{$line-width + $remaining-width} 0 - $line-width; - min-width: $line-width; - } - - .achievement-card { - margin: $top-spacing 0 0 0; - transform: scale($shrink-factor); - } - } - - .prerequisite:first-child { - .dropdown-lines { - height: $top-spacing + math.div($card-height, 2) + $remaining-width; - margin-top: 0; - } - } - } - } } } From 143e97142e021d05371f6d3397d8dce956933f0b Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:31:09 +0800 Subject: [PATCH 03/12] Move some academy styles to use CSS modules --- src/pages/academy/Academy.tsx | 5 +++-- src/styles/_academy.module.scss | 17 +++++++++++++++++ src/styles/_academy.scss | 16 ---------------- src/styles/_global.scss | 2 ++ 4 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 src/styles/_academy.module.scss diff --git a/src/pages/academy/Academy.tsx b/src/pages/academy/Academy.tsx index 5b1a8bf931..222b216f77 100644 --- a/src/pages/academy/Academy.tsx +++ b/src/pages/academy/Academy.tsx @@ -7,6 +7,7 @@ import { Role } from 'src/commons/application/ApplicationTypes'; import ResearchAgreementPrompt from 'src/commons/researchAgreementPrompt/ResearchAgreementPrompt'; import Constants from 'src/commons/utils/Constants'; import { useSession } from 'src/commons/utils/Hooks'; +import classes from 'src/styles/_academy.module.scss'; import { fetchNotifications, @@ -48,7 +49,7 @@ const Academy: React.FC<{}> = () => { ] : null; return ( -
    +
    {/* agreedToResearch has a default value of undefined in the store. It will take on null/true/false when the backend returns. */} {Constants.showResearchPrompt && agreedToResearch === null && } @@ -112,7 +113,7 @@ const CourseSelectingAcademy: React.FC<{}> = () => { ) : routeCourseId === courseId ? ( ) : ( -
    +
    elements .markdown-notification { *:first-child { diff --git a/src/styles/_global.scss b/src/styles/_global.scss index 5922a82b6e..d15641caaf 100644 --- a/src/styles/_global.scss +++ b/src/styles/_global.scss @@ -1,3 +1,5 @@ +$ns: 'bp4'; + // Global variables $cadet-color-1: #1a2530; $cadet-color-2: #2c3e50; From 752c55b67d71eb7676a3a802596807449217a2cf Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:40:07 +0800 Subject: [PATCH 04/12] Move AchievementCommentCard styles to CSS modules --- .../achievement/AchievementCommentCard.tsx | 16 ++++++++++------ ...s.scss => AchievementCommentCard.module.scss} | 0 src/styles/index.scss | 1 - 3 files changed, 10 insertions(+), 7 deletions(-) rename src/styles/{_assessmentComments.scss => AchievementCommentCard.module.scss} (100%) diff --git a/src/commons/achievement/AchievementCommentCard.tsx b/src/commons/achievement/AchievementCommentCard.tsx index fe8cc768d4..ae259c2650 100644 --- a/src/commons/achievement/AchievementCommentCard.tsx +++ b/src/commons/achievement/AchievementCommentCard.tsx @@ -1,5 +1,6 @@ import React, { useMemo } from 'react'; import { useNavigate } from 'react-router'; +import classes from 'src/styles/AchievementCommentCard.module.scss'; import { Assessment } from '../assessment/AssessmentTypes'; import { useTypedSelector } from '../utils/Hooks'; @@ -28,22 +29,25 @@ const AchievementCommentCard: React.FC<{ return (
    -

    Feedback

    -
    +

    Feedback

    +
    {assessment && assessment.questions.map((question, index) => ( -
    +
    -

    {'Q' + (index + 1)}

    +

    {'Q' + (index + 1)}

    -
    +

    {question.comments === null ? 'No Comments' : question.comments}

    {'XP: ' + question.xp + '/' + question.maxXp}

    {showToQuestion && ( - )} diff --git a/src/styles/_assessmentComments.scss b/src/styles/AchievementCommentCard.module.scss similarity index 100% rename from src/styles/_assessmentComments.scss rename to src/styles/AchievementCommentCard.module.scss diff --git a/src/styles/index.scss b/src/styles/index.scss index 6e1e2a7367..57a55a401a 100755 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -51,4 +51,3 @@ @import 'variableHighlighting'; @import 'workspaceGreen'; @import 'workspace'; -@import 'assessmentComments'; From 20742846a9626714f4ff3c76faa0f1662f85c007 Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:41:06 +0800 Subject: [PATCH 05/12] Remove CSS selector nesting Prevents unnecessary selector specificity. Since we now use CSS modules, there is no risk of style conflicts. --- src/styles/AchievementCommentCard.module.scss | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/styles/AchievementCommentCard.module.scss b/src/styles/AchievementCommentCard.module.scss index 8793fa407f..2dce1a13d4 100644 --- a/src/styles/AchievementCommentCard.module.scss +++ b/src/styles/AchievementCommentCard.module.scss @@ -5,42 +5,42 @@ .feedback-list { padding-left: 2rem; padding-right: 2rem; +} - .assessment-comments { - display: flex; - margin-bottom: 0.5rem; +.assessment-comments { + display: flex; + margin-bottom: 0.5rem; +} - .question-header { - margin-top: 0; - } +.question-header { + margin-top: 0; +} - .box-comment { - flex-grow: 1; - display: block; - padding-top: 0.1rem; - padding-left: 1rem; - padding-right: 1rem; +.box-comment { + flex-grow: 1; + display: block; + padding-top: 0.1rem; + padding-left: 1rem; + padding-right: 1rem; - white-space: pre-wrap; - word-break: break-word; + white-space: pre-wrap; + word-break: break-word; - .xp { - font-weight: 700; - color: orange; - } - } + .xp { + font-weight: 700; + color: orange; + } +} - .to-assessment-button { - flex: none; +.to-assessment-button { + flex: none; - height: 2rem; - width: 6rem; + height: 2rem; + width: 6rem; - margin-top: 0.1rem; - margin-bottom: 1rem; - border-radius: 5px; + margin-top: 0.1rem; + margin-bottom: 1rem; + border-radius: 5px; - cursor: pointer; - } - } + cursor: pointer; } From 7f985b91c35da739761e4d4da10b89371c2860b2 Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:54:34 +0800 Subject: [PATCH 06/12] Move Contributors to use CSS modules --- .../subcomponents/ContributorsDetails.tsx | 33 ++--- .../subcomponents/ContributorsList.tsx | 7 +- src/styles/Contributors.module.scss | 130 ++++++++++++++++++ src/styles/_contributors.scss | 128 ----------------- 4 files changed, 151 insertions(+), 147 deletions(-) create mode 100644 src/styles/Contributors.module.scss diff --git a/src/pages/contributors/subcomponents/ContributorsDetails.tsx b/src/pages/contributors/subcomponents/ContributorsDetails.tsx index 446e8ab202..16a615f72d 100644 --- a/src/pages/contributors/subcomponents/ContributorsDetails.tsx +++ b/src/pages/contributors/subcomponents/ContributorsDetails.tsx @@ -1,22 +1,23 @@ import { Card, Elevation, H3, H5 } from '@blueprintjs/core'; import React from 'react'; +import classes from 'src/styles/Contributors.module.scss'; import { Links } from '../../../commons/utils/Constants'; -const dot = ; +const dot = ; const ContributorsDetails: React.FC = () => ( -
    - +
    +

    The Team behind the Source Academy

    -

    +

    The Source Academy is designed and developed by a team of students, most of who have used the system to learn the fundamentals of computing and enjoyed it. This page includes all developers who contributed to the Source Academy Merlin (2023) and its precursors{' '} Rook (2022), Knight (2020) and Cadet (2018). These versions succeeded Source Academy 2 (2017) and ultimately the original Source Academy (2016).

    -
    +
    2023 Leadership (Merlin) @@ -86,7 +87,7 @@ const ContributorsDetails: React.FC = () => ( (Coordination)

    -
    +
    Hall of Fame @@ -110,7 +111,7 @@ const ContributorsDetails: React.FC = () => ( Ng Tse Pei {dot} Joey Yeo {dot} Tan Yu Wei {dot} Sigmund Chianasta

    -
    +

    2019 Leadership

    @@ -145,8 +146,8 @@ const ContributorsDetails: React.FC = () => ( (Tools)

    -
    -

    +

    +

    2020 Leadership (Knight)


    @@ -180,13 +181,13 @@ const ContributorsDetails: React.FC = () => ( (Source)

    {dot} -

    +

    Tee Hao Wei
    (Backend & DevOps)

    -
    +

    2021 Leadership

    @@ -203,20 +204,20 @@ const ContributorsDetails: React.FC = () => ( (Frontend)

    {dot} -

    +

    Daryl Tan, Thomas Tan
    (Source)

    {dot} -

    +

    Tee Hao Wei
    (Backend & DevOps)

    -
    -

    +

    +

    2022 Leadership (Rook)


    @@ -270,7 +271,7 @@ const ContributorsDetails: React.FC = () => ( (Modules)

    -
    +
    All Contributors diff --git a/src/pages/contributors/subcomponents/ContributorsList.tsx b/src/pages/contributors/subcomponents/ContributorsList.tsx index cea6cd6ee0..373f2d67cc 100644 --- a/src/pages/contributors/subcomponents/ContributorsList.tsx +++ b/src/pages/contributors/subcomponents/ContributorsList.tsx @@ -1,5 +1,6 @@ import { Card, Elevation, H2, H3, H5 } from '@blueprintjs/core'; import React, { useEffect, useState } from 'react'; +import classes from 'src/styles/Contributors.module.scss'; import { Contributor, Repo } from '../../../features/contributors/ContributorsTypes'; import { fetchContributors, fetchRepos } from './ContributorsGithubApi'; @@ -34,12 +35,12 @@ const ContributorsList: React.FC = () => { ); }); return ( - -
    + +

    {repo.name}

    {repo.description}
    -
    {arrayMapped}
    +
    {arrayMapped}
    ); }) diff --git a/src/styles/Contributors.module.scss b/src/styles/Contributors.module.scss new file mode 100644 index 0000000000..903a27d6dd --- /dev/null +++ b/src/styles/Contributors.module.scss @@ -0,0 +1,130 @@ +@import "_global"; + +// Styling components of the ContributorsDetails + +.outsideDetails { + text-align: center; + + .contributorsDetails { + background-color: $cadet-color-4; + display: inline-block; + margin-top: 2%; + margin-bottom: 2%; + padding: 1% 1% 1% 1%; + + h3 { + font-weight: bold; + font-style: oblique; + } + + p { + margin-right: 0.5%; + margin-left: 0.5%; + } + + p.description { + text-align: justify; + text-align-last: center; + } + + span.dot { + padding: 0 0.2rem 0 0.2rem; + } + + div.leadership { + margin-top: 10px; + text-align: center; + + p { + vertical-align: top; + display: inline-block; + width: 120px; + &.wider { + width: 140px; + } + &.evenWider { + width: 180px; + } + } + } + + div.hallOfFame { + margin-top: 10px; + text-align: center; + } + + div.contributors { + margin-top: 10px; + text-align: center; + + h5 { + text-align: center; + } + } + } +} + +// Styling components of the ContributorsList + +.containerPermalink { + background-color: $cadet-color-4; + margin-bottom: 2%; +} + +div.inPermalink { + background-color: $cadet-color-4; + text-align: justify; + + div { + text-align: center; + vertical-align: top; + display: inline-block; + width: 20%; + height: 20%; + margin-top: 1%; + margin-bottom: 0.5%; + + @media screen and (max-width: 1000px) { + width: 33.3%; + height: 33.3%; + } + } + + img { + width: 90%; + height: 90%; + } + + p { + margin-bottom: 0.2rem; + color: $cadet-color-2; + } + + a { + text-decoration: none; + font-weight: bold; + color: $cadet-color-1; + &:hover { + color: $cadet-color-3; + } + } +} + +div.repoDetailsPermalink { + text-align: center; + + h3 { + margin: 0% 2% 0.5% 2%; + color: $cadet-color-2; + } + + h3::first-letter { + text-transform: uppercase; + } + + h5 { + margin: 0% 2% 1% 2%; + font-style: italic; + color: $cadet-color-1; + } +} diff --git a/src/styles/_contributors.scss b/src/styles/_contributors.scss index ae71e58eb7..56b7dbc4fe 100644 --- a/src/styles/_contributors.scss +++ b/src/styles/_contributors.scss @@ -24,131 +24,3 @@ } } } - -// Styling components of the ContributorsDetails - -.outsideDetails { - text-align: center; - - .contributorsDetails { - background-color: $cadet-color-4; - display: inline-block; - margin-top: 2%; - margin-bottom: 2%; - padding: 1% 1% 1% 1%; - - h3 { - font-weight: bold; - font-style: oblique; - } - - p { - margin-right: 0.5%; - margin-left: 0.5%; - } - - p.description { - text-align: justify; - text-align-last: center; - } - - span.dot { - padding: 0 0.2rem 0 0.2rem; - } - - div.leadership { - margin-top: 10px; - text-align: center; - - p { - vertical-align: top; - display: inline-block; - width: 120px; - &.wider { - width: 140px; - } - &.evenWider { - width: 180px; - } - } - } - - div.hallOfFame { - margin-top: 10px; - text-align: center; - } - - div.contributors { - margin-top: 10px; - text-align: center; - - h5 { - text-align: center; - } - } - } -} - -// Styling components of the ContributorsList - -.containerPermalink { - background-color: $cadet-color-4; - margin-bottom: 2%; -} - -div.inPermalink { - background-color: $cadet-color-4; - text-align: justify; - - div { - text-align: center; - vertical-align: top; - display: inline-block; - width: 20%; - height: 20%; - margin-top: 1%; - margin-bottom: 0.5%; - @include mQ(1000px) { - width: 33.3%; - height: 33.3%; - } - } - - img { - width: 90%; - height: 90%; - } - - p { - margin-bottom: 0.2rem; - color: $cadet-color-2; - } - - a { - text-decoration: none; - font-weight: bold; - color: $cadet-color-1; - &:hover { - color: $cadet-color-3; - } - } -} - -div.repoDetailsPermalink { - text-align: center; - - h3 { - margin: 0% 2% 0.5% 2%; - color: $cadet-color-2; - } - - h3::first-letter { - text-transform: uppercase; - } - - h5 { - margin: 0% 2% 1% 2%; - font-style: italic; - color: $cadet-color-1; - } -} From 8e3bb9c64d75f5fbedafc76f67ab2a46eb355e1b Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:39:22 +0800 Subject: [PATCH 07/12] Fix regressions due to `Academy` CSS module --- src/pages/githubAssessments/GitHubClassroom.tsx | 3 ++- src/pages/missionControl/MissionControl.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/githubAssessments/GitHubClassroom.tsx b/src/pages/githubAssessments/GitHubClassroom.tsx index ca6448c799..f696ca13a8 100644 --- a/src/pages/githubAssessments/GitHubClassroom.tsx +++ b/src/pages/githubAssessments/GitHubClassroom.tsx @@ -8,6 +8,7 @@ import { useDispatch } from 'react-redux'; import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { loginGitHub, logoutGitHub } from 'src/commons/application/actions/SessionActions'; import { useTypedSelector } from 'src/commons/utils/Hooks'; +import academyClasses from 'src/styles/_academy.module.scss'; import ContentDisplay from '../../commons/ContentDisplay'; import { MissionRepoData } from '../../commons/githubAssessments/GitHubMissionTypes'; @@ -101,7 +102,7 @@ const GitHubClassroom: React.FC = () => { ); return ( -
    +
    { closeDate: overview.closeAt }; return ( -
    +
    ); From 5896c73277a138424f2885c788d175735a67446d Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:56:06 +0800 Subject: [PATCH 08/12] Move some navigation bar styles to CSS modules --- src/commons/navigationBar/NavigationBar.tsx | 19 +++++++++++-------- src/styles/NavigationBar.module.scss | 7 +++++++ src/styles/_blueprint.scss | 9 --------- src/styles/index.scss | 1 - 4 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 src/styles/NavigationBar.module.scss delete mode 100644 src/styles/_blueprint.scss diff --git a/src/commons/navigationBar/NavigationBar.tsx b/src/commons/navigationBar/NavigationBar.tsx index 1ad361a2b7..3a8a331886 100644 --- a/src/commons/navigationBar/NavigationBar.tsx +++ b/src/commons/navigationBar/NavigationBar.tsx @@ -18,6 +18,7 @@ import classNames from 'classnames'; import { Location } from 'history'; import { useCallback, useMemo, useState } from 'react'; import { NavLink, Route, Routes, useLocation } from 'react-router-dom'; +import classes from 'src/styles/NavigationBar.module.scss'; import Dropdown from '../dropdown/Dropdown'; import NotificationBadge from '../notificationBadge/NotificationBadge'; @@ -304,7 +305,14 @@ const NavigationBar: React.FC = () => { return ( <> - + {Constants.playgroundOnly ? isMobileBreakpoint ? renderPlaygroundOnlyNavbarLeftMobile() @@ -376,7 +384,7 @@ export const renderNavlinksFromInfo = ( export const createDesktopNavlink: CreateNavlinkFunction = navbarEntry => ( - classNames('NavigationBar__link', Classes.BUTTON, Classes.MINIMAL, { + classNames(Classes.BUTTON, Classes.MINIMAL, { [Classes.ACTIVE]: isActive }) } @@ -385,12 +393,7 @@ export const createDesktopNavlink: CreateNavlinkFunction = navbarEntry => ( title={navbarEntry.text} > -
    `hidden-${bp}`) - )} - > +
    `hidden-${bp}`))}> {navbarEntry.text}
    {navbarEntry.hasNotifications && ( diff --git a/src/styles/NavigationBar.module.scss b/src/styles/NavigationBar.module.scss new file mode 100644 index 0000000000..2891e6304e --- /dev/null +++ b/src/styles/NavigationBar.module.scss @@ -0,0 +1,7 @@ +@import "_global"; + +.primary-navbar { + background: #141e30; /* fallback for old browsers */ + background: -webkit-linear-gradient(to right, #141e30, #243b55); /* Chrome 10-25, Safari 5.1-6 */ + background: linear-gradient(to right, $cadet-color-1, $cadet-color-2); +} diff --git a/src/styles/_blueprint.scss b/src/styles/_blueprint.scss deleted file mode 100644 index 3a7a52af01..0000000000 --- a/src/styles/_blueprint.scss +++ /dev/null @@ -1,9 +0,0 @@ -.#{$ns}-navbar.#{$ns}-dark { - background: #141e30; /* fallback for old browsers */ - background: -webkit-linear-gradient(to right, #141e30, #243b55); /* Chrome 10-25, Safari 5.1-6 */ - background: linear-gradient( - to right, - $cadet-color-1, - $cadet-color-2 - ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ -} diff --git a/src/styles/index.scss b/src/styles/index.scss index 57a55a401a..356edba2fe 100755 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -19,7 +19,6 @@ @import '../../node_modules/@blueprintjs/core/lib/scss/variables'; @import 'global'; -@import 'blueprint'; @import 'academy'; @import 'achievementcontrol'; From 1f96912e6607071c6377e92e3bff715e3817e107 Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:56:24 +0800 Subject: [PATCH 09/12] Fix format --- src/styles/Contributors.module.scss | 2 +- src/styles/NavigationBar.module.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/styles/Contributors.module.scss b/src/styles/Contributors.module.scss index 903a27d6dd..fb49f38b01 100644 --- a/src/styles/Contributors.module.scss +++ b/src/styles/Contributors.module.scss @@ -1,4 +1,4 @@ -@import "_global"; +@import '_global'; // Styling components of the ContributorsDetails diff --git a/src/styles/NavigationBar.module.scss b/src/styles/NavigationBar.module.scss index 2891e6304e..64102990b5 100644 --- a/src/styles/NavigationBar.module.scss +++ b/src/styles/NavigationBar.module.scss @@ -1,4 +1,4 @@ -@import "_global"; +@import '_global'; .primary-navbar { background: #141e30; /* fallback for old browsers */ From b536d7ede0a49239d112c8222b30c966d6d9fd2b Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:31:40 +0800 Subject: [PATCH 10/12] Move GitHub assessment styles to CSS modules Also deleted some unused styles. Further refactoring awaits to properly separate out and group the relevant styles to relevant files. --- .../githubAssessments/GitHubMissionCreateDialog.tsx | 3 ++- .../githubAssessments/GitHubMissionSaveDialog.tsx | 3 ++- .../githubAssessments/SideContentMissionEditor.tsx | 9 +++++---- .../githubAssessments/GitHubAssessmentWorkspace.tsx | 3 ++- ...bAssessments.scss => GithubAssessments.module.scss} | 10 ++-------- src/styles/index.scss | 1 - 6 files changed, 13 insertions(+), 16 deletions(-) rename src/styles/{_githubAssessments.scss => GithubAssessments.module.scss} (86%) diff --git a/src/commons/githubAssessments/GitHubMissionCreateDialog.tsx b/src/commons/githubAssessments/GitHubMissionCreateDialog.tsx index 9f81e9038c..6388f43797 100644 --- a/src/commons/githubAssessments/GitHubMissionCreateDialog.tsx +++ b/src/commons/githubAssessments/GitHubMissionCreateDialog.tsx @@ -1,6 +1,7 @@ import { AnchorButton, Button, Classes, Dialog, InputGroup, Intent } from '@blueprintjs/core'; import classNames from 'classnames'; import React, { useState } from 'react'; +import classes from 'src/styles/GithubAssessments.module.scss'; import { showWarningMessage } from '../utils/notifications/NotificationsHelper'; @@ -19,7 +20,7 @@ export const GitHubMissionCreateDialog: React.FC const [repositoryName, setrepositoryName] = useState('sa-new-mission-repository'); return ( - +

    Please confirm your save

    diff --git a/src/commons/githubAssessments/GitHubMissionSaveDialog.tsx b/src/commons/githubAssessments/GitHubMissionSaveDialog.tsx index 558085e322..09537c5dde 100644 --- a/src/commons/githubAssessments/GitHubMissionSaveDialog.tsx +++ b/src/commons/githubAssessments/GitHubMissionSaveDialog.tsx @@ -1,6 +1,7 @@ import { AnchorButton, Button, Classes, Dialog, InputGroup, Intent } from '@blueprintjs/core'; import classNames from 'classnames'; import React, { useState } from 'react'; +import classes from 'src/styles/GithubAssessments.module.scss'; export type GitHubMissionSaveDialogResolution = { confirmSave: boolean; @@ -23,7 +24,7 @@ export const GitHubMissionSaveDialog: React.FC = p const [commitMessage, setCommitMessage] = useState(''); return ( - +

    Please confirm your save

    diff --git a/src/commons/sideContent/githubAssessments/SideContentMissionEditor.tsx b/src/commons/sideContent/githubAssessments/SideContentMissionEditor.tsx index 2705e57179..296ae5901b 100644 --- a/src/commons/sideContent/githubAssessments/SideContentMissionEditor.tsx +++ b/src/commons/sideContent/githubAssessments/SideContentMissionEditor.tsx @@ -1,6 +1,7 @@ import { Label } from '@blueprintjs/core'; import { Chapter } from 'js-slang/dist/types'; import React from 'react'; +import classes from 'src/styles/GithubAssessments.module.scss'; import { SALanguage } from '../../application/ApplicationTypes'; import { ControlBarChapterSelect } from '../../controlBar/ControlBarChapterSelect'; @@ -15,12 +16,12 @@ export type SideContentMissionEditorProps = { const SideContentMissionEditor: React.FC = props => { return ( -
    -
    -
    +
    +
    +
    -
    +
    { if (isLoading) { return ( -
    +
    } />
    ); diff --git a/src/styles/_githubAssessments.scss b/src/styles/GithubAssessments.module.scss similarity index 86% rename from src/styles/_githubAssessments.scss rename to src/styles/GithubAssessments.module.scss index 7b6a11edba..99ddeea726 100644 --- a/src/styles/_githubAssessments.scss +++ b/src/styles/GithubAssessments.module.scss @@ -1,3 +1,5 @@ +@import '_global'; + .missionBrowser { background-color: $cadet-color-3; min-width: 600px; @@ -17,14 +19,6 @@ flex-direction: column; flex: 1 1 100%; - .workspace { - .ControlBar { - .ControlBar_editingWorkspace { - width: 0; - } - } - } - .SideContentMissionEditorRow { display: flex; flex-direction: row; diff --git a/src/styles/index.scss b/src/styles/index.scss index 356edba2fe..7332203cf8 100755 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -35,7 +35,6 @@ @import 'fileSystemView'; @import 'game'; @import 'github'; -@import 'githubAssessments'; @import 'storysimulator'; @import 'groundcontrol'; @import 'login'; From a642b1a37c28eb893b5f55aef34e8aadcde36a1f Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:38:03 +0800 Subject: [PATCH 11/12] Standardise CSS module filenames to use PascalCase --- src/pages/academy/Academy.tsx | 2 +- src/pages/githubAssessments/GitHubClassroom.tsx | 2 +- src/pages/missionControl/MissionControl.tsx | 2 +- src/styles/{_academy.module.scss => Academy.module.scss} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename src/styles/{_academy.module.scss => Academy.module.scss} (100%) diff --git a/src/pages/academy/Academy.tsx b/src/pages/academy/Academy.tsx index 222b216f77..8d375d7436 100644 --- a/src/pages/academy/Academy.tsx +++ b/src/pages/academy/Academy.tsx @@ -7,7 +7,7 @@ import { Role } from 'src/commons/application/ApplicationTypes'; import ResearchAgreementPrompt from 'src/commons/researchAgreementPrompt/ResearchAgreementPrompt'; import Constants from 'src/commons/utils/Constants'; import { useSession } from 'src/commons/utils/Hooks'; -import classes from 'src/styles/_academy.module.scss'; +import classes from 'src/styles/Academy.module.scss'; import { fetchNotifications, diff --git a/src/pages/githubAssessments/GitHubClassroom.tsx b/src/pages/githubAssessments/GitHubClassroom.tsx index f696ca13a8..77e32a787e 100644 --- a/src/pages/githubAssessments/GitHubClassroom.tsx +++ b/src/pages/githubAssessments/GitHubClassroom.tsx @@ -8,7 +8,7 @@ import { useDispatch } from 'react-redux'; import { Navigate, Route, Routes, useLocation } from 'react-router-dom'; import { loginGitHub, logoutGitHub } from 'src/commons/application/actions/SessionActions'; import { useTypedSelector } from 'src/commons/utils/Hooks'; -import academyClasses from 'src/styles/_academy.module.scss'; +import academyClasses from 'src/styles/Academy.module.scss'; import ContentDisplay from '../../commons/ContentDisplay'; import { MissionRepoData } from '../../commons/githubAssessments/GitHubMissionTypes'; diff --git a/src/pages/missionControl/MissionControl.tsx b/src/pages/missionControl/MissionControl.tsx index a9cb9da18b..c0b8f98d7f 100644 --- a/src/pages/missionControl/MissionControl.tsx +++ b/src/pages/missionControl/MissionControl.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react'; import { Navigate, useParams } from 'react-router'; import { useSession } from 'src/commons/utils/Hooks'; import { numberRegExp } from 'src/features/academy/AcademyTypes'; -import academyClasses from 'src/styles/_academy.module.scss'; +import academyClasses from 'src/styles/Academy.module.scss'; import { AssessmentStatuses } from '../../commons/assessment/AssessmentTypes'; import ContentDisplay from '../../commons/ContentDisplay'; diff --git a/src/styles/_academy.module.scss b/src/styles/Academy.module.scss similarity index 100% rename from src/styles/_academy.module.scss rename to src/styles/Academy.module.scss From 90f6c204f34ca052b17d4e97314b3bfcd26cd42e Mon Sep 17 00:00:00 2001 From: Richard Dominick <34370238+RichDom2185@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:52:05 +0800 Subject: [PATCH 12/12] Update test snapshots --- .../__snapshots__/NavigationBar.tsx.snap | 36 +++++------ .../AcademyNavigationBar.tsx.snap | 60 +++++++++---------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/commons/navigationBar/__tests__/__snapshots__/NavigationBar.tsx.snap b/src/commons/navigationBar/__tests__/__snapshots__/NavigationBar.tsx.snap index bd1b775d42..04091d52bc 100644 --- a/src/commons/navigationBar/__tests__/__snapshots__/NavigationBar.tsx.snap +++ b/src/commons/navigationBar/__tests__/__snapshots__/NavigationBar.tsx.snap @@ -3,7 +3,7 @@ exports[`NavigationBar Renders "Not logged in" correctly 1`] = `
    Classroom
    @@ -134,7 +134,7 @@ exports[`NavigationBar Renders "Not logged in" correctly 1`] = ` exports[`NavigationBar Renders correctly for student with course 1`] = `
    Missions
    @@ -174,7 +174,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="lightbulb" />
    Quests
    @@ -192,7 +192,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="predictive-analysis" />
    Paths
    @@ -210,7 +210,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="comparison" />
    Contests
    @@ -228,7 +228,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="manual" />
    Missions
    @@ -286,7 +286,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="music" />
    Sourcecast
    @@ -300,7 +300,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="code" />
    Playground
    @@ -314,7 +314,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="briefcase" />
    Classroom
    @@ -328,7 +328,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="book" />
    SICP JS
    @@ -342,7 +342,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="mountain" />
    Achievements
    @@ -356,7 +356,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` icon="git-repo" />
    Stories
    @@ -438,7 +438,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = ` exports[`NavigationBar Renders correctly for student without course 1`] = `
    Classroom
    @@ -513,7 +513,7 @@ exports[`NavigationBar Renders correctly for student without course 1`] = ` icon="book" />
    SICP JS
    @@ -527,7 +527,7 @@ exports[`NavigationBar Renders correctly for student without course 1`] = ` icon="git-repo" />
    Stories
    diff --git a/src/commons/navigationBar/subcomponents/__tests__/__snapshots__/AcademyNavigationBar.tsx.snap b/src/commons/navigationBar/subcomponents/__tests__/__snapshots__/AcademyNavigationBar.tsx.snap index 6da5e2b8a0..15ca97ab04 100644 --- a/src/commons/navigationBar/subcomponents/__tests__/__snapshots__/AcademyNavigationBar.tsx.snap +++ b/src/commons/navigationBar/subcomponents/__tests__/__snapshots__/AcademyNavigationBar.tsx.snap @@ -16,7 +16,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="flame" />
    Missions
    @@ -34,7 +34,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="lightbulb" />
    Quests
    @@ -52,7 +52,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="predictive-analysis" />
    Paths
    @@ -70,7 +70,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="comparison" />
    Contests
    @@ -88,7 +88,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="manual" />
    Others
    @@ -110,7 +110,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="satellite" />
    Ground Control
    @@ -124,7 +124,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="globe" />
    Dashboard
    @@ -138,7 +138,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="mobile-video" />
    Sourcereel
    @@ -152,7 +152,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="endorsed" />
    Grading
    @@ -170,7 +170,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="crown" />
    Game Simulator
    @@ -184,7 +184,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard an icon="notifications" />
    Notifications
    @@ -209,7 +209,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="flame" />
    Missions
    @@ -227,7 +227,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="lightbulb" />
    Quests
    @@ -245,7 +245,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="predictive-analysis" />
    Paths
    @@ -263,7 +263,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="comparison" />
    Contests
    @@ -281,7 +281,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="manual" />
    Others
    @@ -303,7 +303,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="notifications" />
    Notifications
    @@ -328,7 +328,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="flame" />
    Missions
    @@ -346,7 +346,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="lightbulb" />
    Quests
    @@ -364,7 +364,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="predictive-analysis" />
    Paths
    @@ -382,7 +382,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="comparison" />
    Contests
    @@ -400,7 +400,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="manual" />
    Others
    @@ -422,7 +422,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="satellite" />
    Ground Control
    @@ -436,7 +436,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="globe" />
    Dashboard
    @@ -450,7 +450,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="mobile-video" />
    Sourcereel
    @@ -464,7 +464,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="endorsed" />
    Grading
    @@ -482,7 +482,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="crown" />
    Game Simulator
    @@ -496,7 +496,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="calculator" />
    XP Calculation
    @@ -510,7 +510,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="settings" />
    Admin Panel
    @@ -524,7 +524,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G icon="notifications" />
    Notifications