-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EES-5469: Move full feedback details to a modal, truncate long text i…
…n the table.
- Loading branch information
Tom Jones
committed
Jan 15, 2025
1 parent
6cc26c7
commit ed30a90
Showing
2 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
76 changes: 76 additions & 0 deletions
76
...-education-statistics-admin/src/pages/admin-dashboard/components/FeedbackDetailsModal.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,76 @@ | ||
import React from 'react'; | ||
import ButtonText from '@common/components/ButtonText'; | ||
import Modal from '@common/components/Modal'; | ||
import { FeedbackViewModel } from '@common/services/types/feedback'; | ||
import FormattedDate from '@common/components/FormattedDate'; | ||
|
||
interface Props { | ||
feedback: FeedbackViewModel; | ||
getResponseText: ( | ||
response: FeedbackViewModel['response'], | ||
) => 'Useful' | 'Not useful' | 'Problem encountered' | ''; | ||
} | ||
|
||
export default function FeedbackDetailsModal({ | ||
feedback, | ||
getResponseText, | ||
}: Props) { | ||
return ( | ||
<Modal | ||
title="Feedback details" | ||
showClose | ||
triggerButton={ | ||
<ButtonText className="dfe-white-space--nowrap"> | ||
View details | ||
</ButtonText> | ||
} | ||
> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th scope="row">Date</th> | ||
<td> | ||
<FormattedDate format="d MMM yyyy, HH:mm"> | ||
{feedback.created} | ||
</FormattedDate> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">URL</th> | ||
<td>{feedback.url}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row">Response</th> | ||
<td>{getResponseText(feedback.response)}</td> | ||
</tr> | ||
{feedback.response !== 'Useful' && ( | ||
<> | ||
<tr> | ||
<th scope="row" className="dfe-white-space--nowrap"> | ||
What were you doing? | ||
</th> | ||
<td>{feedback.context ?? '-'}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row" className="dfe-white-space--nowrap"> | ||
What went wrong? | ||
</th> | ||
<td>{feedback.issue ?? '-'}</td> | ||
</tr> | ||
<tr> | ||
<th scope="row" className="dfe-white-space--nowrap"> | ||
What did you hope to achieve? | ||
</th> | ||
<td>{feedback.intent ?? '-'}</td> | ||
</tr> | ||
</> | ||
)} | ||
<tr> | ||
<th scope="row">User agent</th> | ||
<td>{feedback.userAgent}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</Modal> | ||
); | ||
} |
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