Skip to content

Commit bfc879f

Browse files
Refactor FilterComponent and GraphvizProcessing modules
1 parent c959f6e commit bfc879f

3 files changed

Lines changed: 9 additions & 15 deletions

File tree

src/components/FilterComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const FilterComponent: React.FC<FilterComponentProps> = ({ onFilterChange }) =>
2020
</SelectTrigger>
2121
<SelectContent>
2222
<SelectGroup>
23-
<SelectItem value="ALL STATUSES">All Statuses</SelectItem>
23+
<SelectItem value="ALL">All Statuses</SelectItem>
2424
<SelectItem value="GRADUATED">Graduated</SelectItem>
2525
<SelectItem value="PROMOTED">Promoted</SelectItem>
2626
</SelectGroup>

src/components/ui/switch.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
import React, {ChangeEventHandler} from 'react';
1+
import React, { ChangeEventHandler } from 'react';
22
import './../../Switch.css';
33

4-
54
interface SwitchProps {
65
isOn: boolean;
76
handleToggle: () => void;
8-
filter: string|null;
7+
filter: string | null;
98

109
isDisabled?: boolean;
11-
1210
onChange?: ChangeEventHandler | undefined;
13-
1411
}
1512
const Switch: React.FC<SwitchProps> = ({ isOn, handleToggle }) => {
1613
return (

src/lib/GradPromUtils.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
import {GlobalDataType} from "./types";
1+
import { GlobalDataType } from "./types";
22

33

4-
export function filterPromGrad(data: GlobalDataType[], promOrGrad: "GRADUATED" | "PROMOTED" | null| string): GlobalDataType[] {
5-
// If no data has been imported into DropZone, do nothing
6-
// if (data == null) {
7-
// }
8-
if (promOrGrad !== null) {
9-
return data.filter(item => item["CF (Workspace Progress Status)"] === promOrGrad);
10-
} else {
11-
// Return the original data if promOrGrad is null
4+
export function filterPromGrad(data: GlobalDataType[], promOrGrad: "GRADUATED" | "PROMOTED" | "ALL" | null): GlobalDataType[] {
5+
// Return all data if promOrGrad is null or "ALL"
6+
if (promOrGrad === "ALL" || promOrGrad === null) {
127
return data;
138
}
9+
// Only filter for GRADUATED or PROMOTED
10+
return data.filter(item => item["CF (Workspace Progress Status)"] === promOrGrad);
1411
}

0 commit comments

Comments
 (0)