Skip to content

Refactor/Cleanup Frontend (Part 2) #2724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/commons/achievement/AchievementCommentCard.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -28,22 +29,25 @@ const AchievementCommentCard: React.FC<{

return (
<div>
<h1 className="assessment-feedback">Feedback</h1>
<div className="feedback-list">
<h1 className={classes['assessment-feedback']}>Feedback</h1>
<div className={classes['feedback-list']}>
{assessment &&
assessment.questions.map((question, index) => (
<div className="assessment-comments" key={index}>
<div className={classes['assessment-comments']} key={index}>
<span>
<h2 className="question-header">{'Q' + (index + 1)}</h2>
<h2 className={classes['question-header']}>{'Q' + (index + 1)}</h2>
</span>

<div className="box-comment">
<div className={classes['box-comment']}>
<p>{question.comments === null ? 'No Comments' : question.comments}</p>
<p className="xp">{'XP: ' + question.xp + '/' + question.maxXp}</p>
</div>

{showToQuestion && (
<button className="to-assessment-button" onClick={() => toMission(index)}>
<button
className={classes['to-assessment-button']}
onClick={() => toMission(index)}
>
{'To Question'}
</button>
)}
Expand Down
3 changes: 2 additions & 1 deletion src/commons/githubAssessments/GitHubMissionCreateDialog.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -19,7 +20,7 @@ export const GitHubMissionCreateDialog: React.FC<GitHubMissionCreateDialogProps>
const [repositoryName, setrepositoryName] = useState('sa-new-mission-repository');

return (
<Dialog className="missionBrowser" isOpen={true}>
<Dialog className={classes['missionBrowser']} isOpen={true}>
<div className={classNames('githubDialogHeader', Classes.DIALOG_HEADER)}>
<h3>Please confirm your save</h3>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/commons/githubAssessments/GitHubMissionSaveDialog.tsx
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -23,7 +24,7 @@ export const GitHubMissionSaveDialog: React.FC<GitHubMissionSaveDialogProps> = p
const [commitMessage, setCommitMessage] = useState('');

return (
<Dialog className="missionBrowser" isOpen={true}>
<Dialog className={classes['missionBrowser']} isOpen={true}>
<div className={classNames('githubDialogHeader', Classes.DIALOG_HEADER)}>
<h3>Please confirm your save</h3>
</div>
Expand Down
19 changes: 11 additions & 8 deletions src/commons/navigationBar/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -304,7 +305,14 @@ const NavigationBar: React.FC = () => {

return (
<>
<Navbar className={classNames('NavigationBar', 'primary-navbar', Classes.DARK)}>
<Navbar
className={classNames(
'NavigationBar',
'primary-navbar',
classes['primary-navbar'],
Classes.DARK
)}
>
{Constants.playgroundOnly
? isMobileBreakpoint
? renderPlaygroundOnlyNavbarLeftMobile()
Expand Down Expand Up @@ -376,7 +384,7 @@ export const renderNavlinksFromInfo = (
export const createDesktopNavlink: CreateNavlinkFunction = navbarEntry => (
<NavLink
className={({ isActive }) =>
classNames('NavigationBar__link', Classes.BUTTON, Classes.MINIMAL, {
classNames(Classes.BUTTON, Classes.MINIMAL, {
[Classes.ACTIVE]: isActive
})
}
Expand All @@ -385,12 +393,7 @@ export const createDesktopNavlink: CreateNavlinkFunction = navbarEntry => (
title={navbarEntry.text}
>
<Icon icon={navbarEntry.icon} />
<div
className={classNames(
'navbar-button-text',
navbarEntry.hiddenInBreakpoints?.map(bp => `hidden-${bp}`)
)}
>
<div className={classNames(navbarEntry.hiddenInBreakpoints?.map(bp => `hidden-${bp}`))}>
{navbarEntry.text}
</div>
{navbarEntry.hasNotifications && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`NavigationBar Renders "Not logged in" correctly 1`] = `
<React.Fragment>
<Blueprint4.Navbar
className="NavigationBar primary-navbar bp4-dark"
className="NavigationBar primary-navbar primary-navbar bp4-dark"
>
<Blueprint4.NavbarGroup
align="left"
Expand Down Expand Up @@ -64,7 +64,7 @@ exports[`NavigationBar Renders "Not logged in" correctly 1`] = `
icon="briefcase"
/>
<div
className="navbar-button-text"
className=""
>
Classroom
</div>
Expand Down Expand Up @@ -134,7 +134,7 @@ exports[`NavigationBar Renders "Not logged in" correctly 1`] = `
exports[`NavigationBar Renders correctly for student with course 1`] = `
<React.Fragment>
<Blueprint4.Navbar
className="NavigationBar primary-navbar bp4-dark"
className="NavigationBar primary-navbar primary-navbar bp4-dark"
>
<Blueprint4.NavbarGroup
align="left"
Expand All @@ -156,7 +156,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="flame"
/>
<div
className="navbar-button-text hidden-xs hidden-sm"
className="hidden-xs hidden-sm"
>
Missions
</div>
Expand All @@ -174,7 +174,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="lightbulb"
/>
<div
className="navbar-button-text hidden-xs hidden-sm"
className="hidden-xs hidden-sm"
>
Quests
</div>
Expand All @@ -192,7 +192,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="predictive-analysis"
/>
<div
className="navbar-button-text hidden-xs hidden-sm"
className="hidden-xs hidden-sm"
>
Paths
</div>
Expand All @@ -210,7 +210,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="comparison"
/>
<div
className="navbar-button-text hidden-xs hidden-sm"
className="hidden-xs hidden-sm"
>
Contests
</div>
Expand All @@ -228,7 +228,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="manual"
/>
<div
className="navbar-button-text hidden-xs hidden-sm"
className="hidden-xs hidden-sm"
>
Missions
</div>
Expand Down Expand Up @@ -286,7 +286,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="music"
/>
<div
className="navbar-button-text"
className=""
>
Sourcecast
</div>
Expand All @@ -300,7 +300,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="code"
/>
<div
className="navbar-button-text"
className=""
>
Playground
</div>
Expand All @@ -314,7 +314,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="briefcase"
/>
<div
className="navbar-button-text"
className=""
>
Classroom
</div>
Expand All @@ -328,7 +328,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="book"
/>
<div
className="navbar-button-text"
className=""
>
SICP JS
</div>
Expand All @@ -342,7 +342,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="mountain"
/>
<div
className="navbar-button-text"
className=""
>
Achievements
</div>
Expand All @@ -356,7 +356,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
icon="git-repo"
/>
<div
className="navbar-button-text"
className=""
>
Stories
</div>
Expand Down Expand Up @@ -438,7 +438,7 @@ exports[`NavigationBar Renders correctly for student with course 1`] = `
exports[`NavigationBar Renders correctly for student without course 1`] = `
<React.Fragment>
<Blueprint4.Navbar
className="NavigationBar primary-navbar bp4-dark"
className="NavigationBar primary-navbar primary-navbar bp4-dark"
>
<Blueprint4.NavbarGroup
align="left"
Expand Down Expand Up @@ -499,7 +499,7 @@ exports[`NavigationBar Renders correctly for student without course 1`] = `
icon="briefcase"
/>
<div
className="navbar-button-text"
className=""
>
Classroom
</div>
Expand All @@ -513,7 +513,7 @@ exports[`NavigationBar Renders correctly for student without course 1`] = `
icon="book"
/>
<div
className="navbar-button-text"
className=""
>
SICP JS
</div>
Expand All @@ -527,7 +527,7 @@ exports[`NavigationBar Renders correctly for student without course 1`] = `
icon="git-repo"
/>
<div
className="navbar-button-text"
className=""
>
Stories
</div>
Expand Down
Loading