Skip to content

Commit

Permalink
redirect upd
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed May 27, 2021
1 parent db5c5a3 commit b037c4c
Showing 1 changed file with 71 additions and 49 deletions.
120 changes: 71 additions & 49 deletions src/nextapp/pages/redirect/[id].tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,94 @@
import * as React from 'react';
import { Container, Alert, AlertIcon, AlertTitle, AlertDescription, Link, VStack } from '@chakra-ui/react';
import {
Container,
Alert,
AlertIcon,
AlertTitle,
AlertDescription,
Link,
VStack,
} from '@chakra-ui/react';
import Head from 'next/head';
import { useAuth } from '@/shared/services/auth';
import { GetServerSideProps, InferGetServerSidePropsType } from 'next';
import { Box, Center, Heading, Icon } from '@chakra-ui/react';
import { FaExclamationCircle } from 'react-icons/fa';

export const getServerSideProps: GetServerSideProps = async (context) => {
const { id } = context.params;
return {
props: {
id
},
}
}
const { id } = context.params;
return {
props: {
id,
},
};
};

const RedirectPage: React.FC<InferGetServerSidePropsType<typeof getServerSideProps>> = ({id}) => {
const RedirectPage: React.FC<
InferGetServerSidePropsType<typeof getServerSideProps>
> = ({ id }) => {
const sources = {
"kq": {
title: "Key Requester (KQ) End-of-Life",
description: "The KQ application has been demised and replaced with the API Services Portal. To get a key to an API, go to the <a href='/devportal/api-discovery'>Directory</a> page and request access."
},
"argg": {
title: "API Registration Generator (ARGG) End-of-Life",
description: "The ARGG application has been demised and replaced with the API Services Portal. To register an API so that it is discoverable, find the 'Gateway Administration API' in the Directory and Request access to get started.",
moreDetails: '/devportal/docs/news-portal-release'
},
"api-spec-editor": {
title: "API Spec Editor End-of-Life",
description: "The API Spec Editor application has been demised and replaced with a Swagger Console."
},
"api-console": {
title: "API Console End-of-Life",
description: "The API Console application has been demised and replaced with a Swagger Console."
}
}
kq: {
title: 'API Key Request (KQ) End-of-Life',
description:
"The KQ application has been demised and replaced with the API Services Portal. To get a key to an API, go to the <a href='/devportal/api-discovery'>Directory</a> page and request access.",
moreDetails: '/devportal/docs/news-portal-release-1',
},
argg: {
title: 'API Registration Generator (ARGG) End-of-Life',
description:
"The ARGG application has been demised and replaced with the API Services Portal. To register an API so that it is discoverable, find the 'Gateway Administration API' in the Directory and Request access to get started.",
moreDetails: '/devportal/docs/news-portal-release-1',
},
'api-spec-editor': {
title: 'API Spec Editor End-of-Life',
description:
'The API Spec Editor application has been demised and replaced with an API Swagger Console.',
moreDetails: '/devportal/docs/news-portal-release-1',
},
'api-console': {
title: 'API Console End-of-Life',
description:
'The API Console application has been demised and replaced with a Swagger Console.',
moreDetails: '/devportal/docs/news-portal-release-1',
},
};
if (!(id in sources)) {
return <></>
return <></>;
}
return (
<>
<Head>
<title>API Services Portal | Redirect</title>
</Head>
<Container maxW="12xl" fontSize="lg" p={0}>
<Alert
variant="subtle"
status="warning"
flexDirection="column"
alignItems="center"
justifyContent="center"
textAlign="center"
minHeight="300px"
>
<AlertIcon boxSize="60px" mr={0}/>
<AlertTitle pb={3} pt={3}>
{sources[id].title}
</AlertTitle>
<AlertDescription maxWidth="lg" pb={5} dangerouslySetInnerHTML={{__html:sources[id].description}}>
</AlertDescription>
{sources[id].moreDetails && (
<Link fontWeight="bold" href={sources[id].moreDetails}>{`More Details...`}</Link>
)}

<Alert
variant="subtle"
status="warning"
flexDirection="column"
alignItems="center"
justifyContent="center"
textAlign="center"
minHeight="300px"
>
<AlertIcon boxSize="60px" mr={0} />
<AlertTitle pb={3} pt={3}>
{sources[id].title}
</AlertTitle>
<AlertDescription
maxWidth="lg"
pb={5}
dangerouslySetInnerHTML={{ __html: sources[id].description }}
></AlertDescription>
{sources[id].moreDetails && (
<Link
fontWeight="bold"
href={sources[id].moreDetails}
>{`More Details...`}</Link>
)}
</Alert>
</Container>
</>
)
}
);
};

export default RedirectPage;

0 comments on commit b037c4c

Please sign in to comment.