-
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.
Show raw xdi file in review component (#11)
* Show raw xdi file in review component * run linter
- Loading branch information
1 parent
5d7e5d8
commit 4795461
Showing
7 changed files
with
151 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
import { Tab, Tabs, Box} from "@mui/material"; | ||
|
||
import StandardMetadataCard from "./StandardMetadataCard"; | ||
import ReviewTextView from "./ReviewTextView"; | ||
|
||
import { useState } from "react"; | ||
import ReviewCard from "./ReviewCard"; | ||
|
||
interface TabPanelProps { | ||
children?: React.ReactNode; | ||
index: number; | ||
value: number; | ||
} | ||
|
||
function CustomTabPanel(props: TabPanelProps) { | ||
const { children, value, index, ...other } = props; | ||
|
||
return ( | ||
<div | ||
role="tabpanel" | ||
hidden={value !== index} | ||
id={`simple-tabpanel-${index}`} | ||
aria-labelledby={`simple-tab-${index}`} | ||
{...other} | ||
> | ||
{value === index && <Box sx={{ p: 3 }}>{children}</Box>} | ||
</div> | ||
); | ||
} | ||
|
||
function a11yProps(index: number) { | ||
return { | ||
id: `simple-tab-${index}`, | ||
'aria-controls': `simple-tabpanel-${index}`, | ||
}; | ||
} | ||
|
||
export default function ReviewTab(props: { standard: XASStandard }) { | ||
const [value, setValue] = useState(0); | ||
|
||
const handleChange = (event: React.SyntheticEvent, newValue: number) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ width: '100%' }}> | ||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||
<Tabs value={value} onChange={handleChange} aria-label="basic tabs example"> | ||
<Tab label="Standard" {...a11yProps(0)} /> | ||
<Tab label="Submitted File" {...a11yProps(1)} /> | ||
<Tab label="Review" {...a11yProps(2)} /> | ||
</Tabs> | ||
</Box> | ||
<CustomTabPanel value={value} index={0}> | ||
<StandardMetadataCard standard={props.standard}/> | ||
</CustomTabPanel> | ||
<CustomTabPanel value={value} index={1}> | ||
<ReviewTextView standard={props.standard}/> | ||
</CustomTabPanel> | ||
<CustomTabPanel value={value} index={2}> | ||
<ReviewCard standard={props.standard} /> | ||
</CustomTabPanel> | ||
</Box> | ||
); | ||
} |
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,29 @@ | ||
import { Typography, Box } from "@mui/material"; | ||
import { useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import { AdminXASStandard } from "../models"; | ||
|
||
const data_url = "/api/admin/data" | ||
|
||
export default function ReviewTextView(props: {standard : AdminXASStandard}) { | ||
|
||
const [fileString, setFileString] = useState("") | ||
|
||
useEffect(() => { | ||
const get_req = (id : number) => { | ||
|
||
|
||
axios.get(data_url + "/" + id).then((response) => { | ||
setFileString(response.data) | ||
}); | ||
}; | ||
get_req(props.standard.id); | ||
}, [props.standard, setFileString]); | ||
|
||
return ( | ||
<Box> | ||
<Typography sx={{whiteSpace:'pre-line',overflow:"scroll", maxHeight:"20em"}}> | ||
{fileString} | ||
</Typography> | ||
</Box>) | ||
} |
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