Fix more build errors

This commit is contained in:
Darren Clarke 2023-03-15 12:17:43 +00:00
parent 1bdc1e60db
commit 30ce47826f
61 changed files with 1161 additions and 541 deletions

View file

@ -3,26 +3,26 @@ import Head from "next/head";
import useSWR from "swr";
import { request, gql } from "graphql-request";
import { NextPage } from "next";
import { Grid, } from "@mui/material";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { TicketDetail } from "components/TicketDetail";
import { TicketEdit } from "components/TicketEdit";
type TicketProps = {
id: string;
};
const Ticket: NextPage<TicketProps> = ({ id }) => {
const origin = typeof window !== 'undefined' && window.location.origin
? window.location.origin
: '';
const origin =
typeof window !== "undefined" && window.location.origin
? window.location.origin
: "";
const graphQLFetcher = async ({ document, variables }: any) => {
const data = await request({
url: `${origin}/graphql`,
document,
variables
})
console.log({ data })
variables,
});
console.log({ data });
return data;
};
@ -31,32 +31,31 @@ const Ticket: NextPage<TicketProps> = ({ id }) => {
{
document: gql`
query getTicket($ticketId: Int!) {
ticket(
ticket: {
ticketInternalId: $ticketId
}
) {
id,
internalId,
title,
note,
number,
createdAt,
updatedAt,
closeAt,
articles {
edges {
node {
id,
body,
internal,
sender {
name
ticket(ticket: { ticketInternalId: $ticketId }) {
id
internalId
title
note
number
createdAt
updatedAt
closeAt
articles {
edges {
node {
id
body
internal
sender {
name
}
}
}
}
}
}}`, variables: { ticketId: parseInt(id, 10) }
}
`,
variables: { ticketId: parseInt(id, 10) },
},
graphQLFetcher,
{ refreshInterval: 1000 }
@ -65,8 +64,7 @@ const Ticket: NextPage<TicketProps> = ({ id }) => {
const { data: graphqlData2, error: graphqlError2 } = useSWR(
{
document: gql`
{
{
__schema {
queryType {
name
@ -75,8 +73,9 @@ const Ticket: NextPage<TicketProps> = ({ id }) => {
}
}
}
}`, variables: {}
}
`,
variables: {},
},
graphQLFetcher
);
@ -91,22 +90,23 @@ const Ticket: NextPage<TicketProps> = ({ id }) => {
{shouldRender && (
<Grid container spacing={0} sx={{ height: "100vh" }} direction="row">
<Grid item sx={{ height: "100vh" }} xs={12}>
<TicketDetail ticket={ticketData.ticket} />
</Grid>
{/*<Grid item xs={0} sx={{ height: "100vh" }}>
<TicketEdit ticket={ticketData.ticket} />
</Grid>*/}
</Grid>)}
</Grid>
)}
{ticketError && <div>{ticketError.toString()}</div>}
</Layout>
);
}
};
export const getServerSideProps: GetServerSideProps = async (
context: GetServerSidePropsContext) => {
context: GetServerSidePropsContext
) => {
const { id } = context.query;
return { props: { id } };
}
};
export default Ticket;

View file

@ -1,9 +1,10 @@
import { FC } from "react";
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
const Assigned: FC = () => (
<Layout>
<Head>
<title>Link Shell</title>
@ -27,4 +28,4 @@ const Link = () => (
</Layout>
);
export default Link;
export default Assigned;

View file

@ -1,9 +1,10 @@
import { FC } from "react";
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
const Pending: FC = () => (
<Layout>
<Head>
<title>Link Shell</title>
@ -27,4 +28,4 @@ const Link = () => (
</Layout>
);
export default Link;
export default Pending;

View file

@ -1,9 +1,10 @@
import { FC } from "react";
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
const Unassigned: FC = () => (
<Layout>
<Head>
<title>Link Shell</title>
@ -27,4 +28,4 @@ const Link = () => (
</Layout>
);
export default Link;
export default Unassigned;

View file

@ -1,9 +1,10 @@
import { FC } from "react";
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
const Urgent: FC = () => (
<Layout>
<Head>
<title>Link Shell</title>
@ -27,4 +28,4 @@ const Link = () => (
</Layout>
);
export default Link;
export default Urgent;