chore(baseModal): add support for x-small size option to make the modal smaller in width and height
feat(deleteAccountPage): create a new page for deleting user account with a confirmation modal feat(routes): add route for delete account page under /account/delete path
This commit is contained in:
parent
d5a1fda457
commit
303f1862c5
3 changed files with 68 additions and 1 deletions
|
|
@ -47,7 +47,7 @@ interface BaseModalProps {
|
||||||
open?: boolean;
|
open?: boolean;
|
||||||
setOpen?: (open: boolean) => void;
|
setOpen?: (open: boolean) => void;
|
||||||
disable?: boolean;
|
disable?: boolean;
|
||||||
size?: "smaller" | "small" | "medium" | "large" | "large-h-full";
|
size?: "x-small" | "smaller" | "small" | "medium" | "large" | "large-h-full";
|
||||||
}
|
}
|
||||||
function BaseModal({
|
function BaseModal({
|
||||||
open,
|
open,
|
||||||
|
|
@ -73,6 +73,10 @@ function BaseModal({
|
||||||
let height: string;
|
let height: string;
|
||||||
|
|
||||||
switch (size) {
|
switch (size) {
|
||||||
|
case "x-small":
|
||||||
|
minWidth = "min-w-[20vw]";
|
||||||
|
height = "h-[10vh]";
|
||||||
|
break;
|
||||||
case "smaller":
|
case "smaller":
|
||||||
minWidth = "min-w-[40vw]";
|
minWidth = "min-w-[40vw]";
|
||||||
height = "h-[27vh]";
|
height = "h-[27vh]";
|
||||||
|
|
|
||||||
59
src/frontend/src/pages/deleteAccountPage/index.tsx
Normal file
59
src/frontend/src/pages/deleteAccountPage/index.tsx
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Button } from "../../components/ui/button";
|
||||||
|
import { Input } from "../../components/ui/input";
|
||||||
|
import BaseModal from "../../modals/baseModal";
|
||||||
|
|
||||||
|
export default function DeleteAccountPage() {
|
||||||
|
const [showConfirmation, setShowConfirmation] = useState(false);
|
||||||
|
|
||||||
|
const handleDeleteAccount = () => {
|
||||||
|
// Implement your account deletion logic here
|
||||||
|
// For example, make an API call to delete the account
|
||||||
|
// Upon successful deletion, you can redirect the user to another page
|
||||||
|
console.log("Account deleted!");
|
||||||
|
// Implement the logic to redirect the user after account deletion.
|
||||||
|
// For example, use react-router-dom's useHistory hook.
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex h-full w-full flex-col items-center justify-center bg-muted">
|
||||||
|
<div className="flex w-72 flex-col items-center justify-center gap-2">
|
||||||
|
<span className="mb-4 text-5xl">⛓️</span>
|
||||||
|
<span className="mb-4 text-center text-2xl font-semibold text-primary">
|
||||||
|
Delete your account
|
||||||
|
</span>
|
||||||
|
<Input className="bg-background" placeholder="Confirm password" />
|
||||||
|
|
||||||
|
<BaseModal
|
||||||
|
open={showConfirmation}
|
||||||
|
setOpen={setShowConfirmation}
|
||||||
|
size="x-small"
|
||||||
|
>
|
||||||
|
<BaseModal.Header description="This action is irreversible and will permanently erase all your data and information associated with the account. ">
|
||||||
|
<h3>Are you sure ?</h3>
|
||||||
|
</BaseModal.Header>
|
||||||
|
<BaseModal.Trigger>
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
className="w-full hover:bg-status-red"
|
||||||
|
onClick={() => setShowConfirmation(true)}
|
||||||
|
>
|
||||||
|
Delete account
|
||||||
|
</Button>
|
||||||
|
</BaseModal.Trigger>
|
||||||
|
<BaseModal.Content>
|
||||||
|
<div className="flex h-full w-full flex-col justify-end">
|
||||||
|
<Button
|
||||||
|
variant="default"
|
||||||
|
className="w-full hover:bg-status-red"
|
||||||
|
onClick={() => handleDeleteAccount()}
|
||||||
|
>
|
||||||
|
Delete account
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</BaseModal.Content>
|
||||||
|
</BaseModal>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ import { Route, Routes } from "react-router-dom";
|
||||||
import CommunityPage from "./pages/CommunityPage";
|
import CommunityPage from "./pages/CommunityPage";
|
||||||
import FlowPage from "./pages/FlowPage";
|
import FlowPage from "./pages/FlowPage";
|
||||||
import HomePage from "./pages/MainPage";
|
import HomePage from "./pages/MainPage";
|
||||||
|
import DeleteAccountPage from "./pages/deleteAccountPage";
|
||||||
import LoginPage from "./pages/loginPage";
|
import LoginPage from "./pages/loginPage";
|
||||||
|
|
||||||
const Router = () => {
|
const Router = () => {
|
||||||
|
|
@ -14,6 +15,9 @@ const Router = () => {
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="*" element={<HomePage />} />
|
<Route path="*" element={<HomePage />} />
|
||||||
<Route path="/login" element={<LoginPage />} />
|
<Route path="/login" element={<LoginPage />} />
|
||||||
|
<Route path="/account">
|
||||||
|
<Route path="delete" element={<DeleteAccountPage />}></Route>
|
||||||
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue