Organize directories

This commit is contained in:
Darren Clarke 2023-02-13 13:10:48 +00:00
parent 8a91c9b89b
commit 4898382f78
433 changed files with 0 additions and 0 deletions

BIN
apps/link/pages/.DS_Store vendored Normal file

Binary file not shown.

44
apps/link/pages/_app.tsx Normal file
View file

@ -0,0 +1,44 @@
/* eslint-disable react/jsx-props-no-spreading */
import { AppProps } from "next/app";
import { SessionProvider } from "next-auth/react";
import { CssBaseline } from "@mui/material";
import { CacheProvider, EmotionCache } from "@emotion/react";
import { AdapterDateFns } from "@mui/x-date-pickers-pro/AdapterDateFns";
import { LocalizationProvider } from "@mui/x-date-pickers-pro";
import createEmotionCache from "lib/createEmotionCache";
import "@fontsource/poppins/400.css";
import "@fontsource/poppins/700.css";
import "@fontsource/roboto/400.css";
import "@fontsource/roboto/700.css";
import "@fontsource/playfair-display/900.css";
import "styles/global.css";
import { LicenseInfo } from "@mui/x-data-grid-pro";
LicenseInfo.setLicenseKey(
"fd009c623acc055adb16370731be92e4T1JERVI6NDA3NTQsRVhQSVJZPTE2ODAyNTAwMTUwMDAsS0VZVkVSU0lPTj0x"
);
const clientSideEmotionCache: any = createEmotionCache();
interface LinkWebProps extends AppProps {
// eslint-disable-next-line react/require-default-props
emotionCache?: EmotionCache;
}
const LinkWeb = (props: LinkWebProps) => {
const { Component, emotionCache = clientSideEmotionCache, pageProps } = props;
return (
<SessionProvider session={(pageProps as any).session}>
<CacheProvider value={emotionCache}>
<CssBaseline />
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Component {...pageProps} />
</LocalizationProvider>
</CacheProvider>
</SessionProvider>
);
};
export default LinkWeb;

View file

@ -0,0 +1,50 @@
// eslint-disable-next-line no-use-before-define
import * as React from "react";
import Document, { Html, Head, Main, NextScript } from "next/document";
import createEmotionServer from "@emotion/server/create-instance";
import createEmotionCache from "lib/createEmotionCache";
export default class LinkDocument extends Document {
render() {
return (
<Html lang="en">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
LinkDocument.getInitialProps = async (ctx) => {
const originalRenderPage = ctx.renderPage;
const cache = createEmotionCache();
const { extractCriticalToChunks } = createEmotionServer(cache as any);
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App: any) => (props) =>
<App emotionCache={cache} {...props} />,
});
const initialProps = await Document.getInitialProps(ctx);
const emotionStyles = extractCriticalToChunks(initialProps.html);
const emotionStyleTags = emotionStyles.styles.map((style) => (
<style
data-emotion={`${style.key} ${style.ids.join(" ")}`}
key={style.key}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: style.css }}
/>
));
return {
...initialProps,
styles: [
...React.Children.toArray(initialProps.styles),
...emotionStyleTags,
],
};
};

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Metamigo = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={"https://quepasa.link.smex.org"}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
export default Metamigo;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Metamigo = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={"https://sigarillo.link.smex.org"}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
export default Metamigo;

View file

@ -0,0 +1,33 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper
url="http://localhost:3000/zammad/#manage"
hideSidebar={false}
/>
</Grid>
</Grid>
</Layout>
);
export default Link;

View file

@ -0,0 +1,17 @@
import NextAuth from "next-auth";
import Google from "next-auth/providers/google";
import Apple from "next-auth/providers/apple";
export default NextAuth({
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}),
Apple({
clientId: process.env.APPLE_CLIENT_ID,
clientSecret: process.env.APPLE_CLIENT_SECRET
}),
],
secret: process.env.NEXTAUTH_SECRET,
});

30
apps/link/pages/index.tsx Normal file
View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Home = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="https://8003-digiresilienc-linkshell-c2tqwgcccbs.ws-eu86.gitpod.io/zammad/#dashboard" />
</Grid>
</Grid>
</Layout>
);
export default Home;

View file

@ -0,0 +1,36 @@
import { useState } from "react";
import Head from "next/head";
import { Grid, Button } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Leafcutter = () => {
const [leafcutterURL, setLeafcutterURL] = useState(
"https://lc.digiresilience.org/about"
);
return (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={leafcutterURL}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
};
export default Leafcutter;

View file

@ -0,0 +1,36 @@
import { useState } from "react";
import Head from "next/head";
import { Grid, Button } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Leafcutter = () => {
const [leafcutterURL, setLeafcutterURL] = useState(
"https://lc.digiresilience.org/create"
);
return (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={leafcutterURL}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
};
export default Leafcutter;

View file

@ -0,0 +1,36 @@
import { useState } from "react";
import Head from "next/head";
import { Grid, Button } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Leafcutter = () => {
const [leafcutterURL, setLeafcutterURL] = useState(
"https://lc.digiresilience.org/faq"
);
return (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={leafcutterURL}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
};
export default Leafcutter;

View file

@ -0,0 +1,36 @@
import { useState } from "react";
import Head from "next/head";
import { Grid, Button } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Leafcutter = () => {
const [leafcutterURL, setLeafcutterURL] = useState(
"https://lc.digiresilience.org"
);
return (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={leafcutterURL}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
};
export default Leafcutter;

View file

@ -0,0 +1,36 @@
import { useState } from "react";
import Head from "next/head";
import { Grid, Button } from "@mui/material";
import { Layout } from "components/Layout";
import Iframe from "react-iframe";
const Leafcutter = () => {
const [leafcutterURL, setLeafcutterURL] = useState(
"https://lc.digiresilience.org/trends"
);
return (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid item sx={{ height: "100vh", width: "100%" }}>
<Iframe
id="link"
url={leafcutterURL}
width="100%"
height="100%"
frameBorder={0}
/>
</Grid>
</Grid>
</Layout>
);
};
export default Leafcutter;

30
apps/link/pages/link.tsx Normal file
View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/zoom/518/1490" />
</Grid>
</Grid>
</Layout>
);
export default Link;

85
apps/link/pages/login.tsx Normal file
View file

@ -0,0 +1,85 @@
import Head from "next/head";
import { Box, Grid, Container, IconButton } from "@mui/material";
import { Apple as AppleIcon, Google as GoogleIcon } from "@mui/icons-material";
import { signIn, getSession } from "next-auth/react";
const Login = ({ session }) => {
const buttonStyles = {
borderRadius: 500,
width: "100%",
fontSize: "16px",
fontWeight: "bold",
};
return (
<>
<Head>
<title>Login</title>
</Head>
<Grid container direction="row-reverse" sx={{ p: 3 }}>
<Grid item />
</Grid>
<Container maxWidth="md" sx={{ mt: 3, mb: 20 }}>
<Grid container spacing={2} direction="column" alignItems="center">
<Grid item>
<Box sx={{ maxWidth: 200 }} />
</Grid>
<Grid item sx={{ textAlign: "center" }} />
<Grid item>
{!session ? (
<Grid
container
spacing={3}
direction="column"
alignItems="center"
sx={{ width: 450, mt: 1 }}
>
<Grid item sx={{ width: "100%" }}>
<IconButton
sx={buttonStyles}
onClick={() =>
signIn("google", {
callbackUrl: `${window.location.origin}/setup`,
})
}
>
<GoogleIcon sx={{ mr: 1 }} />
</IconButton>
</Grid>
<Grid item sx={{ width: "100%" }}>
<IconButton
sx={buttonStyles}
onClick={() =>
signIn("apple", {
callbackUrl: `${window.location.origin}/setup`,
})
}
>
<AppleIcon sx={{ mr: 1 }} />
</IconButton>
</Grid>
<Grid item sx={{ mt: 2 }} />
</Grid>
) : null}
{session ? (
<Box component="h4">
{` ${session.user.name ?? session.user.email}.`}
</Box>
) : null}
</Grid>
</Grid>
</Container>
</>
);
};
export default Login;
export async function getServerSideProps(context) {
const session = (await getSession(context)) ?? null;
return {
props: { session },
};
}

View file

@ -0,0 +1,33 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Profile = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper
url="http://localhost:3000/zammad/#profile"
hideSidebar={false}
/>
</Grid>
</Grid>
</Layout>
);
export default Profile;

View file

@ -0,0 +1,54 @@
import Head from "next/head";
import { NextPage, GetServerSideProps, GetServerSidePropsContext } from "next";
import { Grid, Box } from "@mui/material";
import { Layout } from "components/Layout";
import { TicketDetail } from "components/TicketDetail";
import { TicketEdit } from "components/TicketEdit";
const Link: NextPage = ({ ticket, articles }: any) => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid container spacing={0} sx={{ height: "100vh" }} direction="row">
<Grid item sx={{ height: "100vh" }} xs={10}>
<TicketDetail ticket={ticket} articles={articles} />
</Grid>
<Grid item xs={2} sx={{ height: "100vh" }}>
<TicketEdit ticket={ticket} />
</Grid>
</Grid>
</Layout>
);
export const getServerSideProps: GetServerSideProps = async (
context: GetServerSidePropsContext
) => {
const {
params: { id },
} = context;
const baseURL = `${process.env.ZAMMAD_URL}/api/v1`;
const token = process.env.ZAMMAD_API_TOKEN;
const headers = { Authorization: `Token ${token}` };
const rawTicket = await fetch(`${baseURL}/tickets/${id}`, {
headers,
});
const ticket = await rawTicket.json();
const rawArticles = await fetch(
`${baseURL}/ticket_articles/by_ticket/${id}`,
{
headers,
}
);
const articles = await rawArticles.json();
console.log({ ticket, articles });
return {
props: {
ticket,
articles,
},
};
};
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:8003/zammad/#ticket/view/my_tickets" />
</Grid>
</Grid>
</Layout>
);
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/my_pending_reached" />
</Grid>
</Grid>
</Layout>
);
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/all_unassigned" />
</Grid>
</Grid>
</Layout>
);
export default Link;

View file

@ -0,0 +1,30 @@
import Head from "next/head";
import { Grid } from "@mui/material";
import { Layout } from "components/Layout";
import { ZammadWrapper } from "components/ZammadWrapper";
const Link = () => (
<Layout>
<Head>
<title>Link Shell</title>
</Head>
<Grid
container
spacing={0}
sx={{ height: "100%", width: "100%" }}
direction="column"
>
<Grid
item
sx={{
height: "100%",
width: "100%",
}}
>
<ZammadWrapper url="http://localhost:3000/zammad/#ticket/view/all_escalated" />
</Grid>
</Grid>
</Layout>
);
export default Link;