2023-06-26 10:07:12 +00:00
|
|
|
type PageProps = {
|
|
|
|
|
params: {
|
|
|
|
|
id: string;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function Page({ params: { id } }: PageProps) {
|
|
|
|
|
return <div>Page</div>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2023-02-22 13:05:52 +00:00
|
|
|
import { GetServerSideProps, GetServerSidePropsContext } from "next";
|
|
|
|
|
import Head from "next/head";
|
|
|
|
|
import useSWR from "swr";
|
|
|
|
|
import { NextPage } from "next";
|
2023-03-15 12:17:43 +00:00
|
|
|
import { Grid } from "@mui/material";
|
2023-07-18 08:16:16 +00:00
|
|
|
import { TicketDetail } from "../_components/TicketDetail";
|
|
|
|
|
import { TicketEdit } from "../_components/TicketEdit";
|
|
|
|
|
import { getTicketQuery } from "../_graphql/getTicketQuery";
|
2023-02-22 13:05:52 +00:00
|
|
|
|
|
|
|
|
type TicketProps = {
|
|
|
|
|
id: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const Ticket: NextPage<TicketProps> = ({ id }) => {
|
2023-03-07 14:09:49 +00:00
|
|
|
const { data: ticketData, error: ticketError }: any = useSWR(
|
|
|
|
|
{
|
2023-03-29 14:43:27 +02:00
|
|
|
document: getTicketQuery,
|
|
|
|
|
variables: { ticketId: `gid://zammad/Ticket/${id}` },
|
2023-03-07 14:09:49 +00:00
|
|
|
},
|
2023-03-29 14:43:27 +02:00
|
|
|
{ refreshInterval: 100000 }
|
2023-02-22 13:05:52 +00:00
|
|
|
);
|
|
|
|
|
|
2023-03-07 14:09:49 +00:00
|
|
|
const shouldRender = !ticketError && ticketData;
|
2023-02-22 13:05:52 +00:00
|
|
|
|
|
|
|
|
return (
|
2023-06-26 10:07:12 +00:00
|
|
|
<>
|
2023-02-22 13:05:52 +00:00
|
|
|
{shouldRender && (
|
|
|
|
|
<Grid container spacing={0} sx={{ height: "100vh" }} direction="row">
|
2023-03-22 11:55:14 +00:00
|
|
|
<Grid item sx={{ height: "100vh" }} xs={9}>
|
2023-03-07 14:09:49 +00:00
|
|
|
<TicketDetail ticket={ticketData.ticket} />
|
2023-02-22 13:05:52 +00:00
|
|
|
</Grid>
|
2023-03-22 11:55:14 +00:00
|
|
|
<Grid item xs={3} sx={{ height: "100vh" }}>
|
2023-03-07 14:09:49 +00:00
|
|
|
<TicketEdit ticket={ticketData.ticket} />
|
2023-03-22 11:55:14 +00:00
|
|
|
</Grid>
|
2023-03-15 12:17:43 +00:00
|
|
|
</Grid>
|
|
|
|
|
)}
|
2023-02-22 13:05:52 +00:00
|
|
|
{ticketError && <div>{ticketError.toString()}</div>}
|
2023-06-26 10:07:12 +00:00
|
|
|
</>
|
2023-02-22 13:05:52 +00:00
|
|
|
);
|
2023-03-15 12:17:43 +00:00
|
|
|
};
|
2023-02-22 13:05:52 +00:00
|
|
|
|
|
|
|
|
export const getServerSideProps: GetServerSideProps = async (
|
2023-03-15 12:17:43 +00:00
|
|
|
context: GetServerSidePropsContext
|
|
|
|
|
) => {
|
2023-02-22 13:05:52 +00:00
|
|
|
const { id } = context.query;
|
|
|
|
|
return { props: { id } };
|
2023-03-15 12:17:43 +00:00
|
|
|
};
|
2023-02-22 13:05:52 +00:00
|
|
|
|
2023-06-26 10:07:12 +00:00
|
|
|
|
2023-02-22 13:05:52 +00:00
|
|
|
export default Ticket;
|
2023-06-26 10:07:12 +00:00
|
|
|
*/
|