Skip to content

Commit

Permalink
demo code version
Browse files Browse the repository at this point in the history
  • Loading branch information
mahathiryali committed Nov 9, 2024
1 parent 0913743 commit 1b90047
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 21 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0",
"react-select": "^5.8.1",
"react-select": "^5.8.2",
"styled-components": "^6.1.13"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions src/SemesterHome.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* .body {
display: block !important;
} */
.content {
display: flex;
flex: 1;
Expand Down
4 changes: 0 additions & 4 deletions src/components/AddClass/addclass.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ body {
background-color: white !important;
}

/* .searchContent {
background-color: white;
color: black;
} */

.searchBar {
background-color: white;
Expand Down
4 changes: 4 additions & 0 deletions src/components/AddDegree/AddDegree.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
width: 500px;
flex-direction: column;
gap: var(--L, 32px);
align-items: flex-start;
justify-content: center;
align-self: stretch;
margin-left: 450px;
}
@media (max-width: 600px) {
.container {
Expand Down
5 changes: 4 additions & 1 deletion src/components/AddDegree/AddDegree.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import {useNavigate} from 'react-router-dom';
import { useLocation } from 'react-router-dom';
import Select from 'react-select'
import { Separator, Flex } from "@radix-ui/themes";
import MAJORS from './majors.json';
Expand All @@ -20,6 +21,8 @@ type AddDegreeProps = {

export default function AddDegree({ isMajor }: AddDegreeProps) {
const navigate = useNavigate();
const location = useLocation();
const { startYear, gradYear, summerCheck } = location.state || {};
const optionType = isMajor ? "Major" : "Minor";
const [selectedDegree, setSelectedDegree] = useState<DegreeOption | null>(null);
const [selectedDegreeList, setSelectedDegreeList] = useState<DegreeOption[]>([]);
Expand All @@ -41,7 +44,7 @@ export default function AddDegree({ isMajor }: AddDegreeProps) {
};

const handleConfirmClick = () => {
navigate('/next', { state : { } })
navigate('/next', { state : { startYear, gradYear, summerCheck } })
};

const DegreeSelect = () => (
Expand Down
8 changes: 8 additions & 0 deletions src/components/CustomClass/custom-class.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

function CustomClass() {
return (
<></>
)
}

export default CustomClass;
40 changes: 37 additions & 3 deletions src/components/SemesterBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import React, { useState } from 'react';
import { Button } from "@radix-ui/themes";
import "./semesterblock.css"
import AddClass from "../AddClass/AddClass";
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
import { DotsHorizontalIcon, TrashIcon, FileTextIcon } from '@radix-ui/react-icons';


interface SemesterYearProps {
selectedYear: number | string;
Expand All @@ -16,15 +19,19 @@ interface SemesterYearProps {
};

function SemesterBlock({ selectedYear, selectedSemester }: SemesterYearProps) {
const [classList, setClassList] = useState<string[]>([]);

const [isAddClassOpen, setIsAddClassOpen] = useState(false);
const [selectedClasses, setSelectedClasses] = useState<ClassType[]>([]);
const [totalUnits, setTotalUnits] = useState(0);

const handleDeleteClass = (name: string) => {
setClassList(classList.filter((className) => className !== name));
const handleDeleteClass = (indexToDelete: number) => {
const deletedClassUnits = selectedClasses[indexToDelete].units;
setSelectedClasses((prevClasses) =>
prevClasses.filter((_, index) => index !== indexToDelete)
);
setTotalUnits((prevTotalUnits) => prevTotalUnits - deletedClassUnits);
};

const handleEditClass = () => {};
const addClass = (cls: ClassType) => {
setSelectedClasses((prevClasses) => [...prevClasses, cls]);
Expand All @@ -43,6 +50,33 @@ function SemesterBlock({ selectedYear, selectedSemester }: SemesterYearProps) {
{/* <div className="classContainer"> */}
{selectedClasses.map((cls, index) => (
<div key={index} className="classContainer">
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild>
<Button className="dropDownBtn">
<DotsHorizontalIcon className="three-dot-icon" />
</Button>
</DropdownMenu.Trigger>

{/* Dropdown Menu Content */}
<DropdownMenu.Content
className="three-dot-menu"
sideOffset={5}
align="end"
>
<DropdownMenu.Item
className="menu-item"
onClick={handleEditClass}
>
<FileTextIcon/> Edit Course Details
</DropdownMenu.Item>
<DropdownMenu.Item
className="menu-item"
onClick={() => handleDeleteClass(index)}
>
<TrashIcon/> Delete Class
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
<h3 className="classTitle">{cls.name}</h3>
<p className="units">{cls.units} Units</p>
</div>
Expand Down
43 changes: 43 additions & 0 deletions src/components/SemesterBlock/semesterblock.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

}

.classContainer:hover {
background-color: #e0e0e0; /* Grayer background on hover */
}

.classTitle {
color: var(--Primary-Text, #000);
align-items: flex-start;
Expand Down Expand Up @@ -96,3 +100,42 @@
align-items: flex-start;
}


.three-dot-menu {
border-radius: var(--XXS, 4px);
background: var(--White, #FFF);
/* highdrop */
box-shadow: 0px 8px 12px 0px rgba(60, 66, 87, 0.15), 0px 0px 1px 0px rgba(0, 0, 0, 0.30);
padding: var(--XS, 8px);
}

.dropDownBtn {
width: 32px;
height: 16px;
position: absolute;
opacity: 0;
/* position: absolute;
top: 8px;
right: 8px; */
/* background: none;
border: none;
font-size: 20px;
color: #666; */
cursor: pointer;
/* opacity: 0; Initially hidden
transition: opacity 0.3s; */
}


.classContainer:hover .dropDownBtn {
opacity: 1;
}

.menu-item {
cursor: pointer;
}

.menu-item:hover {
background-color: #bfdbfe;
}

16 changes: 12 additions & 4 deletions src/components/SetUpPage/setup.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
.radix-themes {
display: flex !important;
justify-content: center;
align-items: center;
place-items: center;
}
.setup-container {
width: 500px;
/* flex-direction: column;
gap: var(--L, 32px); */
width: 420px;
margin-left: 500px;
background-color: white !important;
display: flex;
justify-content: center !important;
align-items: center !important;
}
@media (max-width: 600px) {
.container {
Expand All @@ -12,11 +20,11 @@

body {
background-color: white;
/* display: inline !important; */
}

.setup {
color: var(--Primary-Text, #000);
/* Web UI/Heading/Heading Medium */
font-family: "Inter Variable";
font-size: 20px;
font-style: normal;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2288,10 +2288,10 @@ [email protected]:
dependencies:
"@remix-run/router" "1.20.0"

react-select@^5.8.1:
version "5.8.1"
resolved "https://registry.npmjs.org/react-select/-/react-select-5.8.1.tgz"
integrity sha512-RT1CJmuc+ejqm5MPgzyZujqDskdvB9a9ZqrdnVLsvAHjJ3Tj0hELnLeVPQlmYdVKCdCpxanepl6z7R5KhXhWzg==
react-select@^5.8.2:
version "5.8.2"
resolved "https://registry.npmjs.org/react-select/-/react-select-5.8.2.tgz"
integrity sha512-a/LkOckoI62710gGPQSQqUp7A10fGbH/ya3/IR49qaq3XoBvwymgD5mJgtiHxBDsutyEQfdKNycWVh8Cg8UCjw==
dependencies:
"@babel/runtime" "^7.12.0"
"@emotion/cache" "^11.4.0"
Expand Down

0 comments on commit 1b90047

Please sign in to comment.