Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e0003d1
Merge pull request #1 from CarnegieLearningWeb/dev
emoltz May 31, 2024
094337c
Merge pull request #2 from CarnegieLearningWeb/dev
emoltz May 31, 2024
76dbea9
Merge pull request #3 from CarnegieLearningWeb/dev
emoltz May 31, 2024
4386e61
Merge pull request #4 from CarnegieLearningWeb/dev
emoltz Jun 4, 2024
ccfb8a0
Merge pull request #5 from CarnegieLearningWeb/dev
emoltz Jun 6, 2024
9f8c9ce
Merge pull request #6 from CarnegieLearningWeb/dev
emoltz Jun 7, 2024
a2fe1a5
Merge pull request #7 from CarnegieLearningWeb/dev
emoltz Jun 7, 2024
b7c154a
Merge pull request #8 from CarnegieLearningWeb/dev
emoltz Jun 7, 2024
d4602eb
Merge pull request #9 from CarnegieLearningWeb/dev
emoltz Jun 7, 2024
37a03e4
Merge pull request #10 from CarnegieLearningWeb/dev
emoltz Jun 10, 2024
2bbafed
Merge pull request #11 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
6b9dd72
Merge pull request #12 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
cabfce8
Merge pull request #13 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
1f7dfd2
Merge pull request #14 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
192eec0
Merge pull request #15 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
5197bfb
Merge pull request #16 from CarnegieLearningWeb/dev
emoltz Jun 11, 2024
30bdb25
Merge pull request #17 from CarnegieLearningWeb/dev
emoltz Jun 13, 2024
4fd24cf
Merge pull request #18 from CarnegieLearningWeb/dev
emoltz Jun 18, 2024
6b58505
added new util file for grad and promotion filter
talizacks Jun 24, 2024
05cdbe9
Filter Promoted and Graduated
talizacks Jun 25, 2024
4b7129f
added Filter Promoted and Graduated objects to context file
talizacks Jun 25, 2024
ac18cb6
added Filter Promoted button to App.tsx
talizacks Jun 26, 2024
2f2178e
added Filter Promoted button to App.tsx
talizacks Jun 27, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ public/sample_data
.env
src/lib/local_sample_data
.vercel
bun.lockb
Binary file modified bun.lockb
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
Expand All @@ -30,6 +30,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"d3": "^7.9.0",
"danfojs-node": "^1.1.2",
"express": "^4.19.2",
"html2canvas": "^1.4.1",
"joi": "^17.13.1",
Expand Down
34 changes: 31 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import DropZone from './components/DropZone';
import { Button } from './components/ui/button';
import { Context } from './Context';
import { processDataShopData } from './lib/dataProcessingUtils';
import {filterPromGrad} from "@/lib/GradPromUtils";

function App() {

const { resetData, setGraphData, setLoading, data, setData, graphData, loading } = useContext(Context)
const { resetData, setGraphData, setLoading, setFilteredData, filteredData, data, setData, graphData, loading } = useContext(Context)
const [showDropZone, setShowDropZone] = useState<boolean>(true)

const handleData = (data: GlobalDataType[]) => {
Expand All @@ -22,13 +23,29 @@ function App() {
setLoading(loading)
}

const filterData = (filteredData: GlobalDataType[]) => {
const data: GlobalDataType[] = filterPromGrad(filteredData, "PROMOTED")
setFilteredData(data)
console.log(data)
}

// const handleFilteredData = (filteredData: GlobalDataType[]) => {
// setData(filteredData)
// setShowDropZone(false)
// const graphData: GraphData = processDataShopData(filteredData)
// setGraphData(graphData)
// }

useEffect(() => {
if (data) {
const graphData: GraphData = processDataShopData(data)
setGraphData(graphData)

}
}, [data])
// if (filteredData) {
// const graphData: GraphData = processDataShopData(filteredData)
// setGraphData(graphData)
// }
}, [data]) //,filteredData

return (
<>
Expand Down Expand Up @@ -75,7 +92,18 @@ function App() {
</>
)
}
<div style={{position:"relative"}}>
<div style={{position:"absolute", float: "right", top:-260, right:600}}>
<Button

onClick={() => {
filterData(data!);
setFilteredData(data);
// handleFilteredData(filteredData!)
}
}> Filter Promoted Data </Button>
</div>
</div>
</div>
</div>
</>
Expand Down
6 changes: 6 additions & 0 deletions src/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { GlobalDataType, GraphData } from './lib/types';
interface ContextInterface {
data: GlobalDataType[] | null;
graphData: GraphData | null;
filteredData: GlobalDataType[] | null
setFilteredData: (filteredData: GlobalDataType[] | null) => void;
loading: boolean;
setLoading: (loading: boolean) => void;
setData: (data: GlobalDataType[] | null) => void;
Expand All @@ -13,6 +15,7 @@ interface ContextInterface {
export const Context = createContext({} as ContextInterface);
const initialState = {
data: null,
filteredData: null,
graphData: null,
loading: false
}
Expand All @@ -22,6 +25,7 @@ interface ProviderProps {
}
export const Provider = ({ children }: ProviderProps) => {
const [data, setData] = useState<GlobalDataType[] | null>(initialState.data)
const [filteredData, setFilteredData] = useState<GlobalDataType[] | null>(initialState.filteredData)
const [graphData, setGraphData] = useState<GraphData | null>(initialState.graphData)
const [loading, setLoading] = useState<boolean>(initialState.loading)

Expand All @@ -36,8 +40,10 @@ export const Provider = ({ children }: ProviderProps) => {
<Context.Provider
value={{
data,
filteredData,
graphData,
loading,
setFilteredData,
setLoading,
setData,
setGraphData,
Expand Down
14 changes: 14 additions & 0 deletions src/lib/GradPromUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {GlobalDataType} from "./types";


export function filterPromGrad(data: GlobalDataType[], promOrGrad: "GRADUATED" | "PROMOTED" | "NOT_COMPLETED" | null): GlobalDataType[] {
// If no data has been imported into DropZone, do nothing
if (data == null) {
}
if (promOrGrad !== null) {
return data.filter(item => item["CF (Workspace Progress Status)"] === promOrGrad);
} else {
// Return the original data if promOrGrad is null
return data;
}
}