Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a message when certificate failed #521

Merged
merged 1 commit into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions app/components/certificate/certificate-request.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import { Flex, Heading, Text, Button } from '@chakra-ui/react';
import {
Flex,
Heading,
Text,
Button,
Alert,
AlertIcon,
AlertTitle,
AlertDescription,
} from '@chakra-ui/react';
import { Form } from '@remix-run/react';
import { useState } from 'react';

import Description from './description';

interface CertificateRequestViewProps {
domain: string;
isFailed: boolean;
}

export default function CertificateRequestView({ domain }: CertificateRequestViewProps) {
export default function CertificateRequestView({ domain, isFailed }: CertificateRequestViewProps) {
const [isDisabled, setIsDisabled] = useState(false);

return (
Expand Down Expand Up @@ -51,6 +61,15 @@ export default function CertificateRequestView({ domain }: CertificateRequestVie
Request a Certificate
</Button>
</Form>
{isFailed && (
<Alert status="error">
<AlertIcon />
<AlertTitle mr={2}>Request Unsuccessful: </AlertTitle>
<AlertDescription>
Unfortunately, your previous request was not successful.
</AlertDescription>
</Alert>
)}
</Flex>
);
}
5 changes: 4 additions & 1 deletion app/routes/__index/certificate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export default function CertificateIndexRoute() {
validToFormatted={formatDate(certificate.validTo!)}
/>
) : (
<CertificateRequestView domain={user.baseDomain} />
<CertificateRequestView
domain={user.baseDomain}
isFailed={certificate?.status === 'failed'}
/>
)}
</Flex>
</Center>
Expand Down