Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/develop/resources/scripts/components/dashboard/ApiKeyModal.tsx
7428 views
1
import { useContext } from 'react';
2
import tw from 'twin.macro';
3
import Button from '@/components/elements/Button';
4
import asModal from '@/hoc/asModal';
5
import ModalContext from '@/context/ModalContext';
6
import CopyOnClick from '@/components/elements/CopyOnClick';
7
8
interface Props {
9
apiKey: string;
10
}
11
12
const ApiKeyModal = ({ apiKey }: Props) => {
13
const { dismiss } = useContext(ModalContext);
14
15
return (
16
<>
17
<h3 css={tw`mb-6 text-2xl`}>Your API Key</h3>
18
<p css={tw`text-sm mb-6`}>
19
The API key you have requested is shown below. Please store this in a safe location, it will not be
20
shown again.
21
</p>
22
<pre css={tw`text-sm bg-neutral-900 rounded py-2 px-4 font-mono`}>
23
<CopyOnClick text={apiKey}>
24
<code css={tw`font-mono`}>{apiKey}</code>
25
</CopyOnClick>
26
</pre>
27
<div css={tw`flex justify-end mt-6`}>
28
<Button type={'button'} onClick={() => dismiss()}>
29
Close
30
</Button>
31
</div>
32
</>
33
);
34
};
35
36
ApiKeyModal.displayName = 'ApiKeyModal';
37
38
export default asModal<Props>({
39
closeOnEscape: false,
40
closeOnBackground: false,
41
})(ApiKeyModal);
42
43