Skip to content

Commit

Permalink
Remove team formation from workspace slice
Browse files Browse the repository at this point in the history
The filters never belonged there in the first place as it is not a
workspace.

The functionality is not restored as we will be moving back to AG Grid
for tables.
  • Loading branch information
RichDom2185 committed Mar 26, 2024
1 parent 96b25a0 commit 5b4803f
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 63 deletions.
8 changes: 0 additions & 8 deletions src/commons/application/ApplicationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,6 @@ export const defaultWorkspaceManager: WorkspaceManagerState = {
currentQuestion: undefined,
hasUnsavedChanges: false
},
teamFormation: {
...createDefaultWorkspace('teamFormation'),
teamFormationTableFilters: {
columnFilters: [],
globalFilter: null
}
},
playground: {
...createDefaultWorkspace('playground'),
usingSubst: false,
Expand Down Expand Up @@ -556,7 +549,6 @@ export const defaultSideContentManager: SideContentManagerState = {
assessment: defaultSideContent,
grading: defaultSideContent,
playground: defaultSideContent,
teamFormation: defaultSideContent,
sicp: defaultSideContent,
sourcecast: defaultSideContent,
sourcereel: defaultSideContent,
Expand Down
7 changes: 0 additions & 7 deletions src/commons/workspace/WorkspaceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import {
SET_TOKEN_COUNT,
SHIFT_EDITOR_TAB,
SubmissionsTableFilters,
TeamFormationsTableFilters,
TOGGLE_EDITOR_AUTORUN,
TOGGLE_FOLDER_MODE,
TOGGLE_UPDATE_CSE,
Expand All @@ -71,7 +70,6 @@ import {
UPDATE_STEPSTOTAL,
UPDATE_SUBLANGUAGE,
UPDATE_SUBMISSIONS_TABLE_FILTERS,
UPDATE_TEAM_FORMATIONS_TABLE_FILTERS,
UPDATE_WORKSPACE,
WorkspaceLocation,
WorkspaceLocationsWithTools,
Expand Down Expand Up @@ -402,11 +400,6 @@ export const updateSubmissionsTableFilters = createAction(
(filters: SubmissionsTableFilters) => ({ payload: { filters } })
);

export const updateTeamFormationsTableFilters = createAction(
UPDATE_TEAM_FORMATIONS_TABLE_FILTERS,
(filters: TeamFormationsTableFilters) => ({ payload: { filters } })
);

export const updateCurrentAssessmentId = createAction(
UPDATE_CURRENT_ASSESSMENT_ID,
(assessmentId: number, questionId: number) => ({ payload: { assessmentId, questionId } })
Expand Down
9 changes: 0 additions & 9 deletions src/commons/workspace/WorkspaceReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ import {
UPDATE_STEPSTOTAL,
UPDATE_SUBLANGUAGE,
UPDATE_SUBMISSIONS_TABLE_FILTERS,
UPDATE_TEAM_FORMATIONS_TABLE_FILTERS,
UPDATE_WORKSPACE,
WorkspaceLocation,
WorkspaceManagerState
Expand Down Expand Up @@ -627,14 +626,6 @@ const oldWorkspaceReducer: Reducer<WorkspaceManagerState, SourceActionType> = (
submissionsTableFilters: action.payload.filters
}
};
case UPDATE_TEAM_FORMATIONS_TABLE_FILTERS:
return {
...state,
teamFormation: {
...state.teamFormation,
teamFormationTableFilters: action.payload.filters
}
};
case UPDATE_CURRENT_ASSESSMENT_ID:
return {
...state,
Expand Down
8 changes: 0 additions & 8 deletions src/commons/workspace/WorkspaceTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const TOGGLE_USING_SUBST = 'TOGGLE_USING_SUBST';
export const TOGGLE_USING_CSE = 'TOGGLE_USING_CSE';
export const TOGGLE_UPDATE_CSE = 'TOGGLE_UPDATE_CSE';
export const UPDATE_SUBMISSIONS_TABLE_FILTERS = 'UPDATE_SUBMISSIONS_TABLE_FILTERS';
export const UPDATE_TEAM_FORMATIONS_TABLE_FILTERS = 'UPDATE_TEAM_FORMATIONS_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 @@ -84,14 +83,8 @@ type GradingWorkspaceAttr = {
readonly hasUnsavedChanges: boolean;
};

type TeamFormationWorkspaceAttr = {
readonly teamFormationTableFilters: TeamFormationsTableFilters;
};

type GradingWorkspaceState = GradingWorkspaceAttr & WorkspaceState;

type TeamFormationWorkspaceState = TeamFormationWorkspaceAttr & WorkspaceState;

type PlaygroundWorkspaceAttr = {
readonly usingSubst: boolean;
readonly usingCse: boolean;
Expand All @@ -107,7 +100,6 @@ export type SicpWorkspaceState = PlaygroundWorkspaceState;
export type WorkspaceManagerState = {
readonly assessment: AssessmentWorkspaceState;
readonly grading: GradingWorkspaceState;
readonly teamFormation: TeamFormationWorkspaceState;
readonly playground: PlaygroundWorkspaceState;
readonly sourcecast: SourcecastWorkspaceState;
readonly sourcereel: SourcereelWorkspaceState;
Expand Down
4 changes: 0 additions & 4 deletions src/commons/workspace/__tests__/WorkspaceReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ function generateDefaultWorkspace(payload: any = {}): WorkspaceManagerState {
stories: {
...defaultWorkspaceManager.stories,
...cloneDeep(payload)
},
teamFormation: {
...defaultWorkspaceManager.teamFormation,
...cloneDeep(payload)
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ import {
Text,
TextInput
} from '@tremor/react';
import React from 'react';
import { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { useTypedSelector } from 'src/commons/utils/Hooks';
import { updateTeamFormationsTableFilters } from 'src/commons/workspace/WorkspaceActions';
import React, { useState } from 'react';
import { TeamFormationOverview } from 'src/features/teamFormation/TeamFormationTypes';

import { AssessmentTypeBadge } from '../../teamFormation/subcomponents/TeamFormationBadges';
Expand Down Expand Up @@ -85,25 +81,16 @@ type TeamFormationTableProps = {
};

const TeamFormationTable: React.FC<TeamFormationTableProps> = ({ group, teams }) => {
const dispatch = useDispatch();
const tableFilters = useTypedSelector(
state => state.workspaces.teamFormation.teamFormationTableFilters
);

const defaultFilters = [];
if (group && !tableFilters.columnFilters.find(filter => filter.id === 'groupName')) {
if (group) {
defaultFilters.push({
id: 'groupName',
value: group
});
}

const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([
...tableFilters.columnFilters,
...defaultFilters
]);

const [globalFilter, setGlobalFilter] = useState<string | null>(tableFilters.globalFilter);
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([...defaultFilters]);
const [globalFilter, setGlobalFilter] = useState<string | null>(null);

const globalFilterFn = (
row: Row<TeamFormationOverview>,
Expand Down Expand Up @@ -147,15 +134,6 @@ const TeamFormationTable: React.FC<TeamFormationTableProps> = ({ group, teams })
setColumnFilters(newFilters);
};

useEffect(() => {
dispatch(
updateTeamFormationsTableFilters({
columnFilters,
globalFilter
})
);
}, [columnFilters, globalFilter, dispatch]);

return (
<>
<Flex marginTop="mt-2" justifyContent="justify-between" alignItems="items-center">
Expand Down
1 change: 0 additions & 1 deletion src/pages/fileSystem/createInBrowserFileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { EditorTabState, WorkspaceManagerState } from '../../commons/workspace/W
export const WORKSPACE_BASE_PATHS: Record<keyof WorkspaceManagerState, string> = {
assessment: '',
grading: '',
teamFormation: '',
playground: '/playground',
sicp: '/sicp',
sourcecast: '',
Expand Down

0 comments on commit 5b4803f

Please sign in to comment.