-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
132 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/FeedbackLog.tsx
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,80 @@ | ||
import Container from "@mui/material/Container"; | ||
import Table from "@mui/material/Table"; | ||
import TableBody from "@mui/material/TableBody"; | ||
import TableCell from "@mui/material/TableCell"; | ||
import TableHead from "@mui/material/TableHead"; | ||
import TableRow from "@mui/material/TableRow"; | ||
import Typography from "@mui/material/Typography"; | ||
import React from "react"; | ||
import { Feedback } from "routes/feedback"; | ||
import SettingsSection from "ui/editor/SettingsSection"; | ||
import ErrorSummary from "ui/shared/ErrorSummary/ErrorSummary"; | ||
|
||
import { CollapsibleRow } from "./components/CollapsibleRow"; | ||
import { Feed } from "./styled"; | ||
|
||
interface Props { | ||
feedback: Feedback[]; | ||
} | ||
|
||
export const FeedbackLog: React.FC<Props> = ({ feedback }) => { | ||
const displayFeedbackItems = [ | ||
"userComment", | ||
"address", | ||
"projectType", | ||
"where", | ||
"browserPlatform", | ||
]; | ||
|
||
return ( | ||
<Container maxWidth="contentWrap"> | ||
<SettingsSection> | ||
<Typography variant="h2" component="h3" gutterBottom> | ||
Feedback log | ||
</Typography> | ||
<Typography variant="body1"> | ||
Feedback from users about this service. | ||
</Typography> | ||
</SettingsSection> | ||
<SettingsSection> | ||
{feedback.length === 0 ? ( | ||
<ErrorSummary | ||
format="info" | ||
heading="No feedback found for this service" | ||
message="If you're looking for feedback from more than six months ago, please contact a PlanX developer" | ||
/> | ||
) : ( | ||
<Feed> | ||
<Table stickyHeader sx={{ tableLayout: "fixed" }}> | ||
<TableHead> | ||
<TableRow | ||
sx={{ "& > *": { borderBottomColor: "black !important" } }} | ||
> | ||
<TableCell sx={{ width: 160 }}> | ||
<strong>Type</strong> | ||
</TableCell> | ||
<TableCell sx={{ width: 100 }}> | ||
<strong>Date</strong> | ||
</TableCell> | ||
<TableCell sx={{ width: 340 }}> | ||
<strong>Comment</strong> | ||
</TableCell> | ||
<TableCell sx={{ width: 60 }} /> | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{feedback.map((item) => ( | ||
<CollapsibleRow | ||
key={item.id} | ||
{...item} | ||
displayFeedbackItems={displayFeedbackItems} | ||
/> | ||
))} | ||
</TableBody> | ||
</Table> | ||
</Feed> | ||
)} | ||
</SettingsSection> | ||
</Container> | ||
); | ||
}; |
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
30 changes: 30 additions & 0 deletions
30
editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/queries/getFeedbackById.ts
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 @@ | ||
import gql from "graphql-tag"; | ||
|
||
export const GET_FEEDBACK_BY_ID_QUERY = gql` | ||
query GetFeedbackById($feedbackId: Int!) { | ||
feedback: feedback_summary(where: { feedback_id: { _eq: $feedbackId } }) { | ||
address | ||
createdAt: created_at | ||
platform: device(path: "platform.type") | ||
browser: device(path: "browser.name") | ||
feedbackId: feedback_id | ||
type: feedback_type | ||
helpDefinition: help_definition | ||
helpSources: help_sources | ||
helpText: help_text | ||
intersectingConstraints: intersecting_constraints | ||
nodeData: node_data | ||
nodeId: node_id | ||
nodeText: node_text | ||
nodeTitle: node_title | ||
nodeType: node_type | ||
projectType: project_type | ||
serviceSlug: service_slug | ||
teamSlug: team_slug | ||
status | ||
uprn | ||
userComment: user_comment | ||
userContext: user_context | ||
} | ||
} | ||
`; |
25 changes: 25 additions & 0 deletions
25
editor.planx.uk/src/pages/FlowEditor/components/Flow/FeedbackLog/styled.ts
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,25 @@ | ||
import Box from "@mui/material/Box"; | ||
import { styled } from "@mui/material/styles"; | ||
import TableContainer from "@mui/material/TableContainer"; | ||
import { SummaryListTable } from "@planx/components/shared/Preview/SummaryList"; | ||
|
||
export const Feed = styled(TableContainer)(() => ({ | ||
maxHeight: "60vh", | ||
overflow: "auto", | ||
display: "flex", | ||
flexDirection: "column-reverse", | ||
readingOrder: "flex-visual", | ||
})); | ||
|
||
export const DetailedFeedback = styled(Box)(({ theme }) => ({ | ||
fontSize: "1em", | ||
margin: 1, | ||
maxWidth: "100%", | ||
padding: theme.spacing(2, 1), | ||
})); | ||
|
||
export const StyledSummaryListTable = styled(SummaryListTable)(() => ({ | ||
"& p": { | ||
margin: 0, | ||
}, | ||
})); |
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