publicKey.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import styled from '@emotion/styled';
  2. import {motion} from 'framer-motion';
  3. import {Button} from 'sentry/components/button';
  4. import LoadingIndicator from 'sentry/components/loadingIndicator';
  5. import {IconFile} from 'sentry/icons/iconFile';
  6. import {t} from 'sentry/locale';
  7. import {space} from 'sentry/styles/space';
  8. import testableTransition from 'sentry/utils/testableTransition';
  9. import RelocationCodeBlock from 'sentry/views/relocation/components/relocationCodeBlock';
  10. import StepHeading from 'sentry/views/relocation/components/stepHeading';
  11. import Wrapper from 'sentry/views/relocation/components/wrapper';
  12. import {StepProps} from './types';
  13. export function PublicKey({publicKey, onComplete}: StepProps) {
  14. const handleContinue = (event: any) => {
  15. event.preventDefault();
  16. onComplete();
  17. };
  18. const loaded = (
  19. <motion.div
  20. transition={testableTransition()}
  21. variants={{
  22. initial: {y: 30, opacity: 0},
  23. animate: {y: 0, opacity: 1},
  24. exit: {opacity: 0},
  25. }}
  26. >
  27. <p>
  28. {t(
  29. "To do so, you'll need to save the following public key to a file accessible from wherever your self-hosted repository is currently installed. You'll need to have this public key file available for the next step."
  30. )}
  31. </p>
  32. <RelocationCodeBlock
  33. dark
  34. filename="key.pub"
  35. icon={<IconFile />}
  36. hideCopyButton={false}
  37. >
  38. {publicKey}
  39. </RelocationCodeBlock>
  40. <ContinueButton priority="primary" type="submit" onClick={handleContinue}>
  41. {t('Continue')}
  42. </ContinueButton>
  43. </motion.div>
  44. );
  45. const unloaded = (
  46. <motion.div
  47. transition={testableTransition()}
  48. variants={{
  49. initial: {y: 30, opacity: 0},
  50. animate: {y: 0, opacity: 1},
  51. exit: {opacity: 0},
  52. }}
  53. >
  54. <LoadingIndicator />
  55. </motion.div>
  56. );
  57. return (
  58. <Wrapper>
  59. <StepHeading step={2}>{t("Save Sentry's public key to your machine")}</StepHeading>
  60. {publicKey ? loaded : unloaded}
  61. </Wrapper>
  62. );
  63. }
  64. export default PublicKey;
  65. const ContinueButton = styled(Button)`
  66. margin-top: ${space(1.5)};
  67. `;