-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix-page-loading
# Conflicts: # frontend/app/[locale]/components/CourseControls.tsx # frontend/app/[locale]/components/ProjectDetailsPage.tsx # frontend/app/[locale]/components/SubmitDetailsPage.tsx
- Loading branch information
Showing
20 changed files
with
345 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import {ClearIcon } from '@mui/x-date-pickers/icons'; | ||
import React, { useState } from 'react'; | ||
import CheckIcon from "@mui/icons-material/Check"; | ||
import {Button, Typography} from "@mui/material"; | ||
import HelpOutlineIcon from "@mui/icons-material/HelpOutline"; | ||
|
||
interface StatusButtonProps { | ||
files: any[], | ||
setFiles: (value: (((prevState: any[]) => any[]) | any[])) => void, | ||
fileIndex: number, | ||
} | ||
|
||
function StatusButton( | ||
{files, setFiles, fileIndex}: StatusButtonProps, | ||
) { | ||
const [statusIndex, setStatusIndex] = useState(getStart(files[fileIndex])); | ||
const statuses = [ | ||
{ icon: <CheckIcon style={{ color: '#66bb6a' }} /> }, | ||
{ icon: <HelpOutlineIcon style={{ color: '#000000' }} />}, | ||
{ icon: <ClearIcon style={{ color: '#ef5350' }} /> }, | ||
]; | ||
const status_valeus = ['+', '~', '-']; | ||
|
||
const handleClick = () => { | ||
const newStatusIndex = (statusIndex + 1) % statuses.length; | ||
setStatusIndex(newStatusIndex); | ||
const newFiles = [...files]; | ||
newFiles[fileIndex] = status_valeus[newStatusIndex]; | ||
setFiles(newFiles); | ||
}; | ||
|
||
return ( | ||
<Button | ||
variant="contained" | ||
onClick={handleClick} | ||
style={{ | ||
border: 'none', | ||
backgroundColor: 'transparent', | ||
margin: 10, | ||
}} | ||
> | ||
{statuses[statusIndex].icon} | ||
</Button> | ||
); | ||
} | ||
|
||
function getStart(file: string) { | ||
if (file[0] === '+') { | ||
return 0; | ||
} else if (file[0] === '~') { | ||
return 1; | ||
} else { | ||
return 2; | ||
} | ||
} | ||
|
||
export default StatusButton; |
Oops, something went wrong.