publicKey.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {motion} from 'framer-motion';
  2. import LoadingIndicator from 'sentry/components/loadingIndicator';
  3. import {IconFile} from 'sentry/icons/iconFile';
  4. import {t} from 'sentry/locale';
  5. import testableTransition from 'sentry/utils/testableTransition';
  6. import ContinueButton from 'sentry/views/relocation/components/continueButton';
  7. import RelocationCodeBlock from 'sentry/views/relocation/components/relocationCodeBlock';
  8. import StepHeading from 'sentry/views/relocation/components/stepHeading';
  9. import Wrapper from 'sentry/views/relocation/components/wrapper';
  10. import type {StepProps} from './types';
  11. export function PublicKey({publicKey, onComplete}: StepProps) {
  12. const handleContinue = (event: any) => {
  13. event.preventDefault();
  14. onComplete();
  15. };
  16. const loaded = (
  17. <motion.div
  18. transition={testableTransition()}
  19. variants={{
  20. initial: {y: 30, opacity: 0},
  21. animate: {y: 0, opacity: 1},
  22. exit: {opacity: 0},
  23. }}
  24. >
  25. <p>
  26. {t(
  27. "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."
  28. )}
  29. </p>
  30. <RelocationCodeBlock
  31. dark
  32. filename="key.pub"
  33. icon={<IconFile />}
  34. hideCopyButton={false}
  35. >
  36. {publicKey}
  37. </RelocationCodeBlock>
  38. <ContinueButton priority="primary" type="submit" onClick={handleContinue} />
  39. </motion.div>
  40. );
  41. const unloaded = (
  42. <motion.div
  43. transition={testableTransition()}
  44. variants={{
  45. initial: {y: 30, opacity: 0},
  46. animate: {y: 0, opacity: 1},
  47. exit: {opacity: 0},
  48. }}
  49. >
  50. <LoadingIndicator />
  51. </motion.div>
  52. );
  53. return (
  54. <Wrapper data-test-id="public-key">
  55. <StepHeading step={2}>{t("Save Sentry's public key to your machine")}</StepHeading>
  56. {publicKey ? loaded : unloaded}
  57. </Wrapper>
  58. );
  59. }
  60. export default PublicKey;