|
3 | 3 | import React from 'react' |
4 | 4 | import { FetchingBoundary } from '../FetchingBoundary' |
5 | 5 | import { Modal, ModalProps } from './Modal' |
6 | | -import { Icon } from '../common' |
| 6 | +import { Icon, GraphicalIcon } from '../common' |
7 | 7 | import { useRequestQuery } from '../../hooks/request-query' |
8 | 8 | import { ExerciseUpdateForm } from './exercise-update-modal/ExerciseUpdateForm' |
9 | 9 | import { Exercise } from '../types' |
@@ -43,13 +43,47 @@ export const ExerciseUpdateModal = ({ |
43 | 43 | defaultError={DEFAULT_ERROR} |
44 | 44 | > |
45 | 45 | {data ? ( |
46 | | - <ExerciseUpdateForm diff={data.diff} onCancel={props.onClose} /> |
| 46 | + data.diff.files.length > 0 ? ( |
| 47 | + <ExerciseUpdateForm diff={data.diff} onCancel={props.onClose} /> |
| 48 | + ) : ( |
| 49 | + <AutoUpdatedNotice onClose={props.onClose} /> |
| 50 | + ) |
47 | 51 | ) : null} |
48 | 52 | </FetchingBoundary> |
49 | 53 | </Modal> |
50 | 54 | ) |
51 | 55 | } |
52 | 56 |
|
| 57 | +const AutoUpdatedNotice = ({ onClose }: { onClose: () => void }) => { |
| 58 | + const { t } = useAppTranslation('components/modals/ExerciseUpdateModal.tsx') |
| 59 | + return ( |
| 60 | + <div className="auto-updated-notice flex flex-col items-center text-center"> |
| 61 | + <GraphicalIcon |
| 62 | + icon="completed-check-circle" |
| 63 | + height={64} |
| 64 | + width={64} |
| 65 | + className="mb-20" |
| 66 | + /> |
| 67 | + <h2 className="text-h3 mb-8"> |
| 68 | + {t('exerciseUpdateModal.autoUpdatedTitle')} |
| 69 | + </h2> |
| 70 | + <p className="text-p-large mb-24"> |
| 71 | + {t('exerciseUpdateModal.autoUpdatedBody')} |
| 72 | + </p> |
| 73 | + <button |
| 74 | + type="button" |
| 75 | + className="btn-primary btn-m" |
| 76 | + onClick={() => { |
| 77 | + onClose() |
| 78 | + window.location.reload() |
| 79 | + }} |
| 80 | + > |
| 81 | + {t('exerciseUpdateModal.continue')} |
| 82 | + </button> |
| 83 | + </div> |
| 84 | + ) |
| 85 | +} |
| 86 | + |
53 | 87 | const LoadingComponent = () => { |
54 | 88 | const { t } = useAppTranslation('components/modals/ExerciseUpdateModal.tsx') |
55 | 89 | return ( |
|
0 commit comments