Skip to content

Redesign Avenger dashboard #2437

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 19 commits into from
Apr 22, 2023
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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"@sourceacademy/sharedb-ace": "^2.0.2",
"@sourceacademy/sling-client": "^0.1.0",
"@szhsin/react-menu": "^3.2.0",
"@tanstack/react-table": "^8.7.9",
"@tremor/react": "^1.7.0",
"ace-builds": "^1.4.14",
"acorn": "^8.8.2",
"ag-grid-community": "^28.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/commons/ContentDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import React, { useEffect } from 'react';
export type ContentDisplayProps = {
fullWidth?: boolean;
display: JSX.Element;
loadContentDispatch: () => void;
loadContentDispatch?: () => void;
};

const ContentDisplay: React.FC<ContentDisplayProps> = props => {
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => props.loadContentDispatch(), []);
useEffect(() => props.loadContentDispatch?.(), []);

return (
<div className="ContentDisplay row center-xs">
Expand Down
4 changes: 4 additions & 0 deletions src/commons/application/ApplicationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ export const defaultWorkspaceManager: WorkspaceManagerState = {
},
grading: {
...createDefaultWorkspace('grading'),
submissionsTableFilters: {
columnFilters: [],
globalFilter: null
},
currentSubmission: undefined,
currentQuestion: undefined,
hasUnsavedChanges: false
Expand Down
5 changes: 5 additions & 0 deletions src/commons/workspace/WorkspaceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
SEND_REPL_INPUT_TO_OUTPUT,
SET_FOLDER_MODE,
SHIFT_EDITOR_TAB,
SubmissionsTableFilters,
TOGGLE_EDITOR_AUTORUN,
TOGGLE_FOLDER_MODE,
TOGGLE_UPDATE_ENV,
Expand All @@ -61,6 +62,7 @@ import {
UPDATE_HAS_UNSAVED_CHANGES,
UPDATE_REPL_VALUE,
UPDATE_SUBLANGUAGE,
UPDATE_SUBMISSIONS_TABLE_FILTERS,
UPDATE_WORKSPACE,
WorkspaceLocation,
WorkspaceState
Expand Down Expand Up @@ -313,6 +315,9 @@ export const setIsEditorReadonly = (
isEditorReadonly: isEditorReadonly
});

export const updateSubmissionsTableFilters = (filters: SubmissionsTableFilters) =>
action(UPDATE_SUBMISSIONS_TABLE_FILTERS, { filters });

export const updateCurrentAssessmentId = (assessmentId: number, questionId: number) =>
action(UPDATE_CURRENT_ASSESSMENT_ID, {
assessmentId,
Expand Down
9 changes: 9 additions & 0 deletions src/commons/workspace/WorkspaceReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ import {
UPDATE_HAS_UNSAVED_CHANGES,
UPDATE_REPL_VALUE,
UPDATE_SUBLANGUAGE,
UPDATE_SUBMISSIONS_TABLE_FILTERS,
UPDATE_WORKSPACE,
WorkspaceLocation,
WorkspaceManagerState
Expand Down Expand Up @@ -605,6 +606,14 @@ export const WorkspaceReducer: Reducer<WorkspaceManagerState> = (
} else {
return state;
}
case UPDATE_SUBMISSIONS_TABLE_FILTERS:
return {
...state,
grading: {
...state.grading,
submissionsTableFilters: action.payload.filters
}
};
case UPDATE_CURRENT_ASSESSMENT_ID:
return {
...state,
Expand Down
7 changes: 7 additions & 0 deletions src/commons/workspace/WorkspaceTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const TOGGLE_EDITOR_AUTORUN = 'TOGGLE_EDITOR_AUTORUN';
export const TOGGLE_USING_SUBST = 'TOGGLE_USING_SUBST';
export const TOGGLE_USING_ENV = 'TOGGLE_USING_ENV';
export const TOGGLE_UPDATE_ENV = 'TOGGLE_UPDATE_ENV';
export const UPDATE_SUBMISSIONS_TABLE_FILTERS = 'UPDATE_SUBMISSIONS_TABLE_FILTERS';
export const UPDATE_CURRENT_ASSESSMENT_ID = 'UPDATE_CURRENT_ASSESSMENT_ID';
export const UPDATE_CURRENT_SUBMISSION_ID = 'UPDATE_CURRENT_SUBMISSION_ID';
export const TOGGLE_FOLDER_MODE = 'TOGGLE_FOLDER_MODE';
Expand Down Expand Up @@ -71,6 +72,7 @@ type AssessmentWorkspaceAttr = {
type AssessmentWorkspaceState = AssessmentWorkspaceAttr & WorkspaceState;

type GradingWorkspaceAttr = {
readonly submissionsTableFilters: SubmissionsTableFilters;
readonly currentSubmission?: number;
readonly currentQuestion?: number;
readonly hasUnsavedChanges: boolean;
Expand Down Expand Up @@ -147,3 +149,8 @@ export type DebuggerContext = {
context: Context;
workspaceLocation?: WorkspaceLocation;
};

export type SubmissionsTableFilters = {
columnFilters: { id: string; value: unknown }[];
globalFilter: string | null;
};
28 changes: 27 additions & 1 deletion src/commons/workspace/__tests__/WorkspaceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ import {
updateEditorValue,
updateHasUnsavedChanges,
updateReplValue,
updateSublanguage
updateSublanguage,
updateSubmissionsTableFilters
} from '../WorkspaceActions';
import {
ADD_EDITOR_TAB,
Expand Down Expand Up @@ -90,6 +91,7 @@ import {
UPDATE_HAS_UNSAVED_CHANGES,
UPDATE_REPL_VALUE,
UPDATE_SUBLANGUAGE,
UPDATE_SUBMISSIONS_TABLE_FILTERS,
WorkspaceLocation
} from '../WorkspaceTypes';

Expand Down Expand Up @@ -541,6 +543,30 @@ test('resetWorkspace generates correct action object with provided workspace', (
});
});

test('updateSubmissionsTableFilters generates correct action object', () => {
const columnFilters = [
{
id: 'groupName',
value: '1A'
},
{
id: 'assessmentType',
value: 'Missions'
}
];
const globalFilter = 'runes';
const action = updateSubmissionsTableFilters({ columnFilters, globalFilter });
expect(action).toEqual({
type: UPDATE_SUBMISSIONS_TABLE_FILTERS,
payload: {
filters: {
columnFilters,
globalFilter
}
}
});
});

test('updateCurrentAssessmentId generates correct action object', () => {
const assessmentId = 2;
const questionId = 4;
Expand Down
4 changes: 3 additions & 1 deletion src/pages/academy/Academy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router'
import { useTypedSelector } from 'src/commons/utils/Hooks';

import {
fetchGradingOverviews,
fetchNotifications,
updateLatestViewedCourse
} from '../../commons/application/actions/SessionActions';
Expand All @@ -18,7 +19,7 @@ import NotFound from '../notFound/NotFound';
import AdminPanel from './adminPanel/AdminPanel';
import Dashboard from './dashboard/Dashboard';
import Game from './game/Game';
import Grading from './grading/GradingContainer';
import Grading from './grading/Grading';
import GroundControl from './groundControl/GroundControlContainer';
import Sourcereel from './sourcereel/SourcereelContainer';
import StorySimulator from './storySimulator/StorySimulator';
Expand All @@ -29,6 +30,7 @@ const Academy: React.FC<{}> = () => {
const dispatch = useDispatch();
React.useEffect(() => {
dispatch(fetchNotifications());
dispatch(fetchGradingOverviews(false));
}, [dispatch]);

const assessmentConfigurations = useTypedSelector(
Expand Down
Loading