-
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.
fix(SupportCenter): improve ticket view layout
- Loading branch information
1 parent
6ea1bec
commit 67c2c8f
Showing
20 changed files
with
552 additions
and
203 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
const DefaultLayout = ({ children }: { children: JSX.Element[] | JSX.Element }) => { | ||
return <div className="bg-white min-h-screen">{children}</div>; | ||
const DefaultLayout = ({ | ||
children, | ||
altBackground, | ||
}: { | ||
children: JSX.Element[] | JSX.Element; | ||
altBackground?: boolean; | ||
}) => { | ||
return ( | ||
<div | ||
className={`${altBackground ? "" : "bg-white"} min-h-screen`} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default DefaultLayout; |
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
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,47 @@ | ||
import { Label } from "semantic-ui-react"; | ||
import { SupportTicket } from "../../types"; | ||
import { format, parseISO } from "date-fns"; | ||
|
||
interface TicketDetailsProps { | ||
ticket: SupportTicket; | ||
} | ||
|
||
const TicketDetails: React.FC<TicketDetailsProps> = ({ ticket }) => { | ||
return ( | ||
<div className="flex flex-col border rounded-md p-4 shadow-md bg-white"> | ||
<p className="2xl:text-xl"> | ||
<span className="font-semibold">Requester:</span>{" "} | ||
{ticket.user && ( | ||
<> | ||
<span> | ||
`${ticket.user.firstName} ${ticket.user.lastName} ($ | ||
{ticket.user.email})` | ||
</span> | ||
<Label>Authenticated</Label> | ||
</> | ||
)} | ||
{ticket.guest && | ||
`${ticket.guest.firstName} ${ticket.guest.lastName} (${ticket.guest.email})`} | ||
</p> | ||
<p className="2xl:text-xl"> | ||
<span className="font-semibold">Subject:</span> {ticket?.title} | ||
</p> | ||
<p className="2xl:text-xl"> | ||
<span className="font-semibold">Date Opened:</span>{" "} | ||
{format(parseISO(ticket.timeOpened), "MM/dd/yyyy hh:mm aa")} | ||
</p> | ||
{ticket.status === "closed" && ( | ||
<p className="2xl:text-xl"> | ||
<span className="font-semibold">Date Closed:</span>{" "} | ||
{format(parseISO(ticket.timeClosed ?? ""), "MM/dd/yyyy hh:mm aa")} | ||
</p> | ||
)} | ||
<p className="2xl:text-xl"> | ||
<span className="font-semibold">Description:</span>{" "} | ||
{ticket?.description} | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TicketDetails; |
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,77 @@ | ||
import { useState, useEffect } from "react"; | ||
import { | ||
Button, | ||
Comment, | ||
Feed, | ||
FeedContent, | ||
FeedDate, | ||
FeedEvent, | ||
FeedLabel, | ||
FeedLike, | ||
FeedMeta, | ||
FeedSummary, | ||
FeedUser, | ||
Form, | ||
Header, | ||
Icon, | ||
TextArea, | ||
} from "semantic-ui-react"; | ||
import { | ||
SupportTicket, | ||
SupportTicketFeedEntry, | ||
SupportTicketMessage, | ||
} from "../../types"; | ||
import { format, parseISO } from "date-fns"; | ||
import useGlobalError from "../error/ErrorHooks"; | ||
import axios from "axios"; | ||
import { useForm } from "react-hook-form"; | ||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; | ||
|
||
interface TicketFeedProps { | ||
ticket: SupportTicket; | ||
} | ||
|
||
const TicketFeed: React.FC<TicketFeedProps> = ({ ticket }) => { | ||
const { handleGlobalError } = useGlobalError(); | ||
|
||
const getEntryTimestamp = (entry: SupportTicketFeedEntry) => { | ||
return format(parseISO(entry.date), "MM/dd/yyyy hh:mm aa"); | ||
} | ||
|
||
const TicketFeedEntry = ({ entry }: { entry: SupportTicketFeedEntry }) => { | ||
return ( | ||
<div className="flex flex-row items-center"> | ||
<div className="flex flex-row items-center mb-4"> | ||
<Icon name="circle" color="blue" /> | ||
</div> | ||
<div className="ml-2 mb-2"> | ||
<div> | ||
<p>{entry.action}</p> | ||
<p className="text-sm text-slate-500">{entry.blame} - {getEntryTimestamp(entry)}</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<div className="flex flex-col w-full bg-white"> | ||
<div className="flex flex-col border shadow-md rounded-md p-4"> | ||
<p className="text-2xl font-semibold text-center">Ticket Feed</p> | ||
<div className="flex flex-col mt-8"> | ||
{ticket.feed?.length === 0 && ( | ||
<p className="text-lg text-center text-gray-500 italic"> | ||
No history yet... | ||
</p> | ||
)} | ||
<Feed> | ||
{ticket.feed?.map((f) => ( | ||
<TicketFeedEntry entry={f} /> | ||
))} | ||
</Feed> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default TicketFeed; |
Oops, something went wrong.