From 4670f69e22aedd82a603678101d2edc8eb2b4f31 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:12:34 -0400 Subject: [PATCH 1/7] Add status option for TimelineActionCard --- src/components/TimelineActionCard/TimelineActionCard.js | 8 ++++++-- src/theme.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/TimelineActionCard/TimelineActionCard.js b/src/components/TimelineActionCard/TimelineActionCard.js index 431cd3e..1137b19 100644 --- a/src/components/TimelineActionCard/TimelineActionCard.js +++ b/src/components/TimelineActionCard/TimelineActionCard.js @@ -16,6 +16,10 @@ export default function TimelineActionCard({ type, datetime, by, content }){ "reply_to_user": { "verbage": "replied", "coloring": theme.palette.reply_to_user.main + }, + "status": { + "verbage": "updated the status", + "coloring": theme.palette.status.main } } @@ -54,9 +58,9 @@ TimelineActionCard.propTypes = { ]), /** ISO 8601 formatted time string. */ "datetime": PropTypes.string.isRequired, - /** The name of the person who added the edit. */ + /** The name of the person who added the action. */ "by": PropTypes.string.isRequired, - /** An array of strings containing the content of the edit. */ + /** An array of strings containing the content of the action. */ "content": PropTypes.array.isRequired }; diff --git a/src/theme.js b/src/theme.js index 685626a..5d2edb2 100644 --- a/src/theme.js +++ b/src/theme.js @@ -26,7 +26,7 @@ export default function theme(darkMode = false) { "reply_to_user": { main: "rgba(99, 125, 255, 0.2)", }, - "reply_from_user": { + "status": { main: "rgba(99, 255, 151, 0.2)", } }, From 014ad96efaf678fd6d2017b66e6b07225fe4b4a7 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:13:46 -0400 Subject: [PATCH 2/7] Use TimelineActionCard for status --- src/components/ItemBodyView/ItemBodyView.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/components/ItemBodyView/ItemBodyView.js b/src/components/ItemBodyView/ItemBodyView.js index 19e48fb..d823133 100644 --- a/src/components/ItemBodyView/ItemBodyView.js +++ b/src/components/ItemBodyView/ItemBodyView.js @@ -1,7 +1,7 @@ import React from "react"; import PropTypes from "prop-types"; import { Timeline, TimelineItem, TimelineSeparator, TimelineConnector, TimelineContent, TimelineDot } from '@material-ui/lab'; -import { Typography, makeStyles } from "@material-ui/core"; +import { makeStyles } from "@material-ui/core"; import DirectoryInformation from "../DirectoryInformation/"; import Assignment from "../Assignment/"; import TimelineActionCard from "../TimelineActionCard/"; @@ -36,9 +36,7 @@ export default function ItemBodyView({ item }) { ); case "initial_message": return ( - <> - - + ); case "edit": return ( @@ -46,12 +44,7 @@ export default function ItemBodyView({ item }) { ); case "status": return ( - <> - - {`${section.by} update the status to at ${Date(section.datetime)}`} - - {section.content.map((line) => {line})} - + ); case "assignment": return ( From b0d230a1843622a6b1a0c53c2321303d60143063 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:14:07 -0400 Subject: [PATCH 3/7] Add indicator for uncaught sections --- src/components/ItemBodyView/ItemBodyView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ItemBodyView/ItemBodyView.js b/src/components/ItemBodyView/ItemBodyView.js index d823133..ba1fbf2 100644 --- a/src/components/ItemBodyView/ItemBodyView.js +++ b/src/components/ItemBodyView/ItemBodyView.js @@ -59,7 +59,7 @@ export default function ItemBodyView({ item }) { ); default: - return "No Match Found"; + return `No match found for type: ${section.type}`; }; }; From d9bf26b69d0ffa0ca0facc217824adfdea86fe54 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:16:48 -0400 Subject: [PATCH 4/7] Remove unneccesary return clauses --- src/components/ItemBodyView/ItemBodyView.js | 28 ++++++--------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/components/ItemBodyView/ItemBodyView.js b/src/components/ItemBodyView/ItemBodyView.js index ba1fbf2..1d7c4f8 100644 --- a/src/components/ItemBodyView/ItemBodyView.js +++ b/src/components/ItemBodyView/ItemBodyView.js @@ -31,33 +31,19 @@ export default function ItemBodyView({ item }) { const generateTimelineItem = (section) => { switch (section.type) { case "directory_information": - return ( - - ); + return case "initial_message": - return ( - - ); + return case "edit": - return ( - - ); + return case "status": - return ( - - ); + return case "assignment": - return ( - - ); + return case "reply_to_user": - return ( - - ); + return case "reply_from_user": - return ( - - ); + return default: return `No match found for type: ${section.type}`; }; From ac5349b88ebff58438cc51f08273475c07120ceb Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:48:22 -0400 Subject: [PATCH 5/7] Create ParseError component w/ docs --- src/components/ParseError/ParseError.js | 61 +++++++++++++++++++++++++ src/components/ParseError/ParseError.md | 36 +++++++++++++++ src/components/ParseError/index.js | 1 + 3 files changed, 98 insertions(+) create mode 100644 src/components/ParseError/ParseError.js create mode 100644 src/components/ParseError/ParseError.md create mode 100644 src/components/ParseError/index.js diff --git a/src/components/ParseError/ParseError.js b/src/components/ParseError/ParseError.js new file mode 100644 index 0000000..28dd626 --- /dev/null +++ b/src/components/ParseError/ParseError.js @@ -0,0 +1,61 @@ +import React from "react"; +import PropTypes from "prop-types"; +import { Typography, Paper, makeStyles, useTheme } from '@material-ui/core'; +import clsx from "clsx"; + +export default function ParseError({ file_path, expected, got, line_num }){ + + const theme = useTheme(); + + const useStyles = makeStyles({ + "Paper-root": { + overflow: "hidden" + }, + "headerColor": { + backgroundColor: theme.palette.parse_error.main + }, + "padding": { + padding: theme.spacing(1) + } + + }); + const classes = useStyles(); + + return( + +
+ + Parsing Error + +
+
+ + File Path: {file_path} + + + Line: {line_num} + + + Expected: {expected} + + + Got: {got} + +
+
+ ); +} + +ParseError.propTypes = { + "file_path": PropTypes.string, + "expected": PropTypes.string, + "got": PropTypes.string, + "line_num": PropTypes.number +}; + +ParseError.defaultProps = { + "file_path": "", + "expected": "", + "got": "", + "line_num": "" +}; \ No newline at end of file diff --git a/src/components/ParseError/ParseError.md b/src/components/ParseError/ParseError.md new file mode 100644 index 0000000..98b58a2 --- /dev/null +++ b/src/components/ParseError/ParseError.md @@ -0,0 +1,36 @@ +Displays a parsing error. + +--- + +```jsx +import { ThemeProvider } from "@material-ui/core/styles"; +import webqueue2Theme from "../../theme"; +import ParseError from "./ParseError"; + +const theme = webqueue2Theme(false); + +const demo_data = { + "type": "parse_error", + "datetime": "2020-10-23T00:45:32", + "file_path": "/home/pier/e/campb303/webqueue2/q-snapshot/ce/32", + "expected": "Did not encounter a reply-from-user ending delimiter", + "got": "765-869-4032 to assist please?\tThank you\n", + "line_num": 120 +}; + + + +``` +```jsx static + +``` \ No newline at end of file diff --git a/src/components/ParseError/index.js b/src/components/ParseError/index.js new file mode 100644 index 0000000..8a5ec40 --- /dev/null +++ b/src/components/ParseError/index.js @@ -0,0 +1 @@ +export { default } from "./ParseError"; \ No newline at end of file From c1a15813e50af10c13d0e139a94dd3590f7449e7 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:48:48 -0400 Subject: [PATCH 6/7] Add parse_error color to theme --- src/theme.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/theme.js b/src/theme.js index 5d2edb2..52c59bd 100644 --- a/src/theme.js +++ b/src/theme.js @@ -28,6 +28,9 @@ export default function theme(darkMode = false) { }, "status": { main: "rgba(99, 255, 151, 0.2)", + }, + "parse_error": { + main: "rgba(255, 99, 204, 0.2)", } }, }) From bfc0bd0ab3b485db7c9ff930a32c22ca960dfa28 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Fri, 23 Oct 2020 00:49:02 -0400 Subject: [PATCH 7/7] Started using ParseError --- src/components/ItemBodyView/ItemBodyView.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/ItemBodyView/ItemBodyView.js b/src/components/ItemBodyView/ItemBodyView.js index 1d7c4f8..4e5edce 100644 --- a/src/components/ItemBodyView/ItemBodyView.js +++ b/src/components/ItemBodyView/ItemBodyView.js @@ -6,6 +6,7 @@ import DirectoryInformation from "../DirectoryInformation/"; import Assignment from "../Assignment/"; import TimelineActionCard from "../TimelineActionCard/"; import MessageView from "../MessageView/"; +import ParseError from "../ParseError/"; import { objectIsEmpty } from "../../utilities"; export default function ItemBodyView({ item }) { @@ -44,6 +45,8 @@ export default function ItemBodyView({ item }) { return case "reply_from_user": return + case "parse_error": + return default: return `No match found for type: ${section.type}`; };