-
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 pull request #80 from ECN/feature-conversational-ui
Feature conversational ui
- Loading branch information
Showing
30 changed files
with
683 additions
and
128 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -94,7 +94,7 @@ function App() { | |
/> | ||
} | ||
</Box> | ||
</Box> | ||
</Paper> | ||
</ThemeProvider> | ||
); | ||
} | ||
|
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,21 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Typography } from "@material-ui/core"; | ||
import RelativeTime from "react-relative-time"; | ||
|
||
export default function Assignment({ by, to, datetime }){ | ||
return ( | ||
<Typography> | ||
<b>{by}</b> assigned this to <b>{to}</b> <RelativeTime value={new Date(datetime)} />. | ||
</Typography> | ||
); | ||
} | ||
|
||
Assignment.propTypes = { | ||
/** The person who changed the assignment. */ | ||
"by": PropTypes.string.isRequired, | ||
/** The person the item was assigned to. */ | ||
"to": PropTypes.string.isRequired, | ||
/** The time the assignment was changed in ISO 8601 format. */ | ||
"datetime": PropTypes.string.isRequired | ||
} |
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,26 @@ | ||
Renders a string representation of an assignment with a relative time. | ||
|
||
```jsx | ||
import Assignment from "./Assignment"; | ||
|
||
const example_assignment = { | ||
"type": "assignment", | ||
"datetime": "2020-06-23T13:27:00-0400", | ||
"by": "campb303", | ||
"to": "campb303" | ||
}; | ||
|
||
<Assignment {...example_assignment} /> | ||
|
||
``` | ||
|
||
```jsx static | ||
const example_assignment = { | ||
"type": "assignment", | ||
"datetime": "2020-06-23T13:27:00-0400", | ||
"by": "campb303", | ||
"to": "campb303" | ||
}; | ||
|
||
<Assignment {...example_assignment} /> | ||
``` |
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 @@ | ||
export { default } from "./Assignment"; |
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,44 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { useTheme, useMediaQuery, makeStyles } from '@material-ui/core'; | ||
|
||
export default function CurrentBreakPoint(){ | ||
const theme = useTheme(); | ||
const useStyles = makeStyles({ | ||
true: { | ||
color: theme.palette.success.main | ||
}, | ||
false: { | ||
color: theme.palette.error.main | ||
} | ||
}); | ||
const classes = useStyles(); | ||
|
||
const mediaQueries = { | ||
"xs": useMediaQuery(theme.breakpoints.up('xs')), | ||
"sm": useMediaQuery(theme.breakpoints.up('sm')), | ||
"md": useMediaQuery(theme.breakpoints.up('md')), | ||
"lg": useMediaQuery(theme.breakpoints.up('lg')), | ||
"xl": useMediaQuery(theme.breakpoints.up('xl')), | ||
} | ||
|
||
return ( | ||
<p style={{ margin: "0px" }}> | ||
{ Object.keys(mediaQueries).map( (key) => { | ||
return( | ||
<span className={ mediaQueries[key] ? classes.true : classes.false }> | ||
{`${key.toUpperCase()}: ${ mediaQueries[key] ? "true" : "false"}\n\n\n\n`} | ||
</span> | ||
) | ||
})} | ||
</p> | ||
); | ||
} | ||
|
||
CurrentBreakPoint.propTypes = { | ||
|
||
}; | ||
|
||
CurrentBreakPoint.defaultProps = { | ||
|
||
}; |
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,30 @@ | ||
Displays the MUI theme breakpoints and whether or not they are active. This is a utility component meant to make UI development easier, not as a UI element for production code. | ||
|
||
It must be used under a [ThemeProvider](https://material-ui.com/styles/api/#themeprovider). | ||
|
||
--- | ||
|
||
```jsx | ||
import { ThemeProvider } from '@material-ui/core/styles'; | ||
import { Paper, makeStyles } from '@material-ui/core'; | ||
import webqueue2Theme from "../../theme.js"; | ||
import CurrentBreakPoint from "./CurrentBreakPoint"; | ||
|
||
const theme = webqueue2Theme(false); | ||
|
||
const useStyles = makeStyles({ | ||
paperPadding: { | ||
padding: theme.spacing(1) | ||
} | ||
}); | ||
const classes = useStyles(); | ||
|
||
<ThemeProvider theme={theme}> | ||
<Paper classes={{ root: classes.paperPadding }}> | ||
<CurrentBreakPoint /> | ||
</Paper> | ||
</ThemeProvider> | ||
``` | ||
```jsx static | ||
<CurrentBreakPoint /> | ||
``` |
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 @@ | ||
export { default } from "./CurrentBreakPoint"; |
50 changes: 50 additions & 0 deletions
50
src/components/DirectoryInformation/DirectoryInformation.js
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,50 @@ | ||
import React from "react"; | ||
import PropTypes from "prop-types"; | ||
import { TableContainer, Table, TableRow, TableCell, Paper, makeStyles, useTheme } from "@material-ui/core"; | ||
|
||
export default function DirectoryInformation({ section }) { | ||
|
||
const theme = useTheme(); | ||
const useStyles = makeStyles((theme) => ({ | ||
headerCell: { | ||
borderBottom: "none", | ||
paddingTop: theme.spacing(0.5), | ||
paddingBottom: theme.spacing(0.5), | ||
}, | ||
bodyCell: { | ||
wordBreak: "break-word", | ||
borderBottom: "none", | ||
paddingTop: theme.spacing(0.5), | ||
paddingBottom: theme.spacing(0.5), | ||
}, | ||
stripedRow: { | ||
'&:nth-of-type(odd)': { | ||
backgroundColor: theme.palette.action.hover, | ||
}, | ||
}, | ||
})); | ||
const classes = useStyles(theme); | ||
|
||
return ( | ||
<TableContainer component={Paper}> | ||
<Table size="small" > | ||
{Object.keys(section).map((key) => ( | ||
key === "type" ? "" : | ||
<TableRow classes={{ root: classes.stripedRow }}> | ||
<TableCell classes={{ root: classes.headerCell }} variant="head">{key}</TableCell> | ||
<TableCell classes={{ root: classes.bodyCell }}>{section[key]}</TableCell> | ||
</TableRow> | ||
))} | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
DirectoryInformation.propTypes = { | ||
/** The object containing directory information. */ | ||
"section": PropTypes.object | ||
}; | ||
|
||
DirectoryInformation.defaultProps = { | ||
"section": {} | ||
}; |
28 changes: 28 additions & 0 deletions
28
src/components/DirectoryInformation/DirectoryInformation.md
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,28 @@ | ||
Displays the directory information as a table. | ||
|
||
|
||
```jsx | ||
import DirectoryInformation from "./DirectoryInformation"; | ||
|
||
const example_directory_data = { | ||
"type": "directory_information", | ||
"Name": "Heyi Feng", | ||
"Login": "feng293", | ||
"Computer": "civil4147pc2.ecn", | ||
"Location": "HAMP 4147", | ||
"Email": "feng293@purdue.edu", | ||
"Phone": "5039154835", | ||
"Office": "", | ||
"UNIX Dir": "None", | ||
"Zero Dir": "U=\\\\myhome.itap.purdue.edu\\myhome\\%username%", | ||
"User ECNDB": "http://eng.purdue.edu/jump/2e29495", | ||
"Host ECNDB": "http://eng.purdue.edu/jump/2eccc3f", | ||
"Subject": "Upgrade system and Abaqus" | ||
}; | ||
|
||
<DirectoryInformation section={example_directory_data} /> | ||
``` | ||
|
||
```jsx static | ||
<DirectoryInformation section={example_directory_data} /> | ||
``` |
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 @@ | ||
export { default } from "./DirectoryInformation"; |
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
Oops, something went wrong.