diff --git a/src/pages/AccountSettings/tabs/Admin/Admin.jsx b/src/pages/AccountSettings/tabs/Admin/Admin.jsx index cea1a9f3f3..4f236c7748 100644 --- a/src/pages/AccountSettings/tabs/Admin/Admin.jsx +++ b/src/pages/AccountSettings/tabs/Admin/Admin.jsx @@ -2,12 +2,13 @@ import { useParams } from 'react-router-dom' import { useUser } from 'services/user' -import DeletionCard from './DeletionCard' import DetailsSection from './DetailsSection' import GithubIntegrationSection from './GithubIntegrationSection' import ManageAdminCard from './ManageAdminCard' import StudentSection from './StudentSection' +import DeletionCard from '../DeletionCard' + function Admin() { const { owner } = useParams() const { data: currentUser } = useUser() diff --git a/src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.tsx b/src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.tsx deleted file mode 100644 index da9cb9d21f..0000000000 --- a/src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import Card from 'old_ui/Card' -import A from 'ui/A' - -interface EraseSectionProps { - isPersonalSettings: boolean -} - -function EraseSection({ isPersonalSettings }: EraseSectionProps) { - if (isPersonalSettings) { - return ( -

- Erase all my personal content and projects.{' '} - - Contact support - -

- ) - } - - return ( -

- Erase all my organization content and projects.{' '} - - Contact support - -

- ) -} - -interface DeletionCardProps { - isPersonalSettings: boolean -} - -function DeletionCard({ isPersonalSettings }: DeletionCardProps) { - return ( -
-

Delete account

- - - -
- ) -} - -export default DeletionCard diff --git a/src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.test.tsx b/src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.test.tsx similarity index 91% rename from src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.test.tsx rename to src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.test.tsx index be4662087e..909838b001 100644 --- a/src/pages/AccountSettings/tabs/Admin/DeletionCard/DeletionCard.test.tsx +++ b/src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.test.tsx @@ -22,7 +22,7 @@ describe('DeletionCard', () => { render(, { wrapper }) const message = screen.getByText( - /Erase all my personal content and projects./ + /Erase my personal account and all my repositories./ ) expect(message).toBeInTheDocument() }) @@ -33,7 +33,7 @@ describe('DeletionCard', () => { render(, { wrapper }) const message = screen.getByText( - /Erase all my organization content and projects./ + /Erase organization and all its repositories./ ) expect(message).toBeInTheDocument() }) diff --git a/src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.tsx b/src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.tsx new file mode 100644 index 0000000000..55d8864049 --- /dev/null +++ b/src/pages/AccountSettings/tabs/DeletionCard/DeletionCard.tsx @@ -0,0 +1,32 @@ +import Card from 'old_ui/Card' +import A from 'ui/A' + +interface DeletionCardProps { + isPersonalSettings: boolean +} + +function DeletionCard({ isPersonalSettings }: DeletionCardProps) { + return ( +
+

+ {isPersonalSettings ? 'Delete account' : 'Delete organization'} +

+ +

+ {isPersonalSettings + ? 'Erase my personal account and all my repositories. ' + : 'Erase organization and all its repositories. '} + + Contact support + +

+
+
+ ) +} + +export default DeletionCard diff --git a/src/pages/AccountSettings/tabs/Admin/DeletionCard/index.ts b/src/pages/AccountSettings/tabs/DeletionCard/index.ts similarity index 100% rename from src/pages/AccountSettings/tabs/Admin/DeletionCard/index.ts rename to src/pages/AccountSettings/tabs/DeletionCard/index.ts diff --git a/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.test.tsx b/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.test.tsx deleted file mode 100644 index d607588661..0000000000 --- a/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.test.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { render, screen } from '@testing-library/react' -import { MemoryRouter, Route } from 'react-router-dom' - -import DeletionCard from './DeletionCard' - -const wrapper: React.FC = ({ children }) => ( - - {children} - -) - -describe('DeletionCard', () => { - it('renders header', () => { - render(, { wrapper }) - - const header = screen.getByRole('heading', { name: 'Delete account' }) - expect(header).toBeInTheDocument() - }) - - it('renders account deletion message', () => { - render(, { wrapper }) - - const message = screen.getByText( - /Erase all my personal content and projects./ - ) - expect(message).toBeInTheDocument() - }) -}) diff --git a/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.tsx b/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.tsx deleted file mode 100644 index 1440fe5ddf..0000000000 --- a/src/pages/AccountSettings/tabs/Profile/DeletionCard/DeletionCard.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import Card from 'old_ui/Card' -import A from 'ui/A' - -function DeletionCard() { - return ( -
-

Delete account

- -

- Erase all my personal content and projects.{' '} - - Contact support - -

-
-
- ) -} - -export default DeletionCard diff --git a/src/pages/AccountSettings/tabs/Profile/DeletionCard/index.ts b/src/pages/AccountSettings/tabs/Profile/DeletionCard/index.ts deleted file mode 100644 index e08c78caa4..0000000000 --- a/src/pages/AccountSettings/tabs/Profile/DeletionCard/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from './DeletionCard' diff --git a/src/pages/AccountSettings/tabs/Profile/Profile.jsx b/src/pages/AccountSettings/tabs/Profile/Profile.jsx index 46ede595db..90270e326b 100644 --- a/src/pages/AccountSettings/tabs/Profile/Profile.jsx +++ b/src/pages/AccountSettings/tabs/Profile/Profile.jsx @@ -6,9 +6,10 @@ import { SelfHostedCurrentUserQueryOpts } from 'services/selfHosted/SelfHostedCu import ActivationBanner from './ActivationBanner' import AdminBanner from './AdminBanner' -import DeletionCard from './DeletionCard' import NameEmailCard from './NameEmailCard' +import DeletionCard from '../DeletionCard' + function Profile({ provider, owner }) { const yamlTab = `/account/${provider}/${owner}/yaml/` const { data: currentUser } = useSuspenseQueryV5( @@ -27,7 +28,7 @@ function Profile({ provider, owner }) { {currentUser?.isAdmin && } - + ) }