-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create waitlist page for superadmin user - team starlight #872
Closed
Pharm-ack
wants to merge
7
commits into
hngprojects:dev
from
Pharm-ack:feat/create-waitlist-page-for-superadmin-user-team-STARLIGHT
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6ee068f
feat waitlist page
Pharm-ack 717d197
Merge remote-tracking branch 'upstream/dev' into feat/HNG-create-wait…
Pharm-ack 210b9bf
feat create waitlist page for superadmin user
Pharm-ack 179f4f1
feat create waitlists page for superadmin user
Pharm-ack ca90e63
Merge branch 'dev' into feat/create-waitlist-page-for-superadmin-user…
Maiqel1 6639793
Merge branch 'dev' into feat/create-waitlist-page-for-superadmin-user…
Maiqel1 b3e4409
Merge branch 'dev' into feat/create-waitlist-page-for-superadmin-user…
PrudentBird File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
src/app/dashboard/(admin)/admin/(overview)/waitlist-page/_components/waitList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
import clsx from "clsx"; | ||
import { EllipsisVertical } from "lucide-react"; | ||
import { useState } from "react"; | ||
|
||
import { Button } from "~/components/ui/button"; | ||
import { Checkbox } from "~/components/ui/checkbox"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuLabel, | ||
DropdownMenuTrigger, | ||
} from "~/components/ui/dropdown-menu"; | ||
import { Switch } from "~/components/ui/switch"; | ||
import { waitListData } from "../data/waitlist-dummy"; | ||
import DeleteDialog from "./waitListModal"; | ||
|
||
const tableHeadData: string[] = [ | ||
"name", | ||
"email", | ||
"status", | ||
"activate", | ||
"created at", | ||
"action", | ||
]; | ||
const WaitListPage = () => { | ||
const [isDialogOpen, setIsDialogOpen] = useState(false); | ||
const handleOpenDialog = () => setIsDialogOpen(true); | ||
const handleCloseDialog = () => setIsDialogOpen(false); | ||
|
||
return ( | ||
<> | ||
<thead> | ||
<tr className="bg-[#FFF7F2]"> | ||
{tableHeadData.map((data, index) => { | ||
return ( | ||
<th | ||
key={index} | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2 ${data === "name" ? "w-[300px]" : data === "action" ? "w-[86px]" : "w-[202px]"}`} | ||
> | ||
{data} | ||
</th> | ||
); | ||
})} | ||
</tr> | ||
</thead> | ||
<tbody className="user-table z-10"> | ||
{waitListData.map((data, index) => { | ||
const { activate, createdDate, pageTitle, status, urlSlug } = data; | ||
|
||
return ( | ||
<tr key={index} className="w-full border-b border-b-border"> | ||
<td | ||
className={`whitespace-nowrap p-4 text-left text-base font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
<div className="flex flex-row items-center gap-2"> | ||
<Checkbox className="border-2 border-gray-300 data-[state=checked]:border-primary data-[state=checked]:bg-primary" /> | ||
|
||
<div> | ||
<h3 className="text-sm font-[500] leading-6 text-neutral-dark-2"> | ||
{pageTitle} | ||
</h3> | ||
<div className="text-xs font-normal lowercase leading-4 text-neutral-dark-1"></div> | ||
</div> | ||
</div> | ||
</td> | ||
|
||
<td> | ||
<div className="whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2"> | ||
{urlSlug} | ||
</div> | ||
</td> | ||
|
||
<td | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal leading-4 text-neutral-dark-2`} | ||
> | ||
<div | ||
className={clsx( | ||
status === "active" | ||
? "border-lime-500 text-lime-500" | ||
: "border-black text-black", | ||
"inline-flex h-[27px] w-[85px] items-center justify-center gap-2.5 rounded-[80px] border", | ||
)} | ||
> | ||
<span className="text-xs">{status}</span> | ||
</div> | ||
</td> | ||
|
||
<td | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
<Switch | ||
className="scale-[0.75] transform" | ||
defaultChecked={activate} | ||
/> | ||
</td> | ||
<td | ||
className={`gap-2 whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
{createdDate} | ||
</td> | ||
|
||
<td className="whitespace-nowrap p-4 text-center text-base font-normal capitalize leading-4 text-neutral-dark-2"> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button | ||
className="bg-transparent text-neutral-dark-2 hover:bg-transparent focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0" | ||
size={"icon"} | ||
> | ||
<EllipsisVertical size={16} color="#09090b" /> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent align="end"> | ||
<DropdownMenuLabel className="sr-only"> | ||
Actions | ||
</DropdownMenuLabel> | ||
<DropdownMenuItem>Edit</DropdownMenuItem> | ||
<DropdownMenuItem onClick={handleOpenDialog}> | ||
Delete | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
{isDialogOpen && <DeleteDialog onClose={handleCloseDialog} />} | ||
</> | ||
); | ||
}; | ||
|
||
export default WaitListPage; |
43 changes: 43 additions & 0 deletions
43
src/app/dashboard/(admin)/admin/(overview)/waitlist-page/_components/waitListModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Button } from "~/components/common/common-button"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogHeader, | ||
DialogTitle, | ||
} from "~/components/ui/dialog"; | ||
|
||
const DeleteDialog = ({ onClose }: { onClose: () => void }) => { | ||
return ( | ||
<Dialog open onOpenChange={onClose}> | ||
<DialogContent> | ||
<DialogHeader> | ||
<DialogTitle className="text-lg font-semibold leading-7 text-slate-900"> | ||
Are you absolutely sure? | ||
</DialogTitle> | ||
<DialogDescription className="text-sm font-normal leading-tight text-slate-500"> | ||
This action cannot be undone. This will permanently delete this | ||
product from the database. | ||
</DialogDescription> | ||
</DialogHeader> | ||
<div className="flex w-full"> | ||
<Button | ||
variant="outline" | ||
className="ml-auto flex items-center justify-center gap-2.5 rounded-md px-4 py-2 text-sm font-medium leading-normal" | ||
onClick={onClose} | ||
> | ||
Cancel | ||
</Button> | ||
<Button | ||
onClick={onClose} | ||
className="ml-2 flex items-center justify-center gap-2.5 rounded-md bg-red-600 px-4 py-2 text-sm font-medium leading-normal text-white" | ||
> | ||
Delete | ||
</Button> | ||
</div> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
export default DeleteDialog; |
15 changes: 15 additions & 0 deletions
15
src/app/dashboard/(admin)/admin/(overview)/waitlist-page/_components/waitListTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import WaitListTableBody from "./waitListTableBody"; | ||
import WaitListTableHead from "./waitListTableHead"; | ||
|
||
const WaitListTable = () => { | ||
return ( | ||
<> | ||
<table className="user-table z-10 h-full w-full overflow-hidden"> | ||
<WaitListTableHead /> | ||
<WaitListTableBody /> | ||
</table> | ||
</> | ||
); | ||
}; | ||
|
||
export default WaitListTable; |
107 changes: 107 additions & 0 deletions
107
src/app/dashboard/(admin)/admin/(overview)/waitlist-page/_components/waitListTableBody.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import clsx from "clsx"; | ||
import { EllipsisVertical } from "lucide-react"; | ||
import { useState } from "react"; | ||
|
||
import { Button } from "~/components/ui/button"; | ||
import { Checkbox } from "~/components/ui/checkbox"; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuItem, | ||
DropdownMenuLabel, | ||
DropdownMenuTrigger, | ||
} from "~/components/ui/dropdown-menu"; | ||
import { dummyUsers } from "../data/waitlist-dummy"; | ||
import DeleteDialog from "./waitListModal"; | ||
|
||
const WaitListTableBody = () => { | ||
const [isDialogOpen, setIsDialogOpen] = useState(false); | ||
const handleOpenDialog = () => setIsDialogOpen(true); | ||
const handleCloseDialog = () => setIsDialogOpen(false); | ||
|
||
return ( | ||
<> | ||
<tbody className="user-table z-10"> | ||
{dummyUsers.map((data, index) => { | ||
const { name, date, email, notes, status } = data; | ||
|
||
return ( | ||
<tr key={index} className="w-full border-b border-b-border"> | ||
<td | ||
className={`whitespace-nowrap p-4 text-left text-base font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
<div className="flex flex-row items-center gap-2"> | ||
<Checkbox className="border-2 border-gray-300 data-[state=checked]:border-primary data-[state=checked]:bg-primary" /> | ||
|
||
<div> | ||
<h3 className="text-sm font-[500] leading-6 text-neutral-dark-2"> | ||
{name} | ||
</h3> | ||
<div className="text-xs font-normal lowercase leading-4 text-neutral-dark-1"></div> | ||
</div> | ||
</div> | ||
</td> | ||
|
||
<td> | ||
<div className="whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2"> | ||
{email} | ||
</div> | ||
</td> | ||
|
||
<td | ||
className={`gap-2 whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
{notes} | ||
</td> | ||
<td | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal leading-4 text-neutral-dark-2`} | ||
> | ||
<div | ||
className={clsx( | ||
status === "Online" | ||
? "border-lime-500 text-lime-500" | ||
: "border-black text-black", | ||
"inline-flex h-[27px] w-[85px] items-center justify-center gap-2.5 rounded-[80px] border", | ||
)} | ||
> | ||
<span className="text-xs">{status}</span> | ||
</div> | ||
</td> | ||
|
||
<td | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2`} | ||
> | ||
{date} | ||
</td> | ||
|
||
<td className="whitespace-nowrap p-4 text-center text-base font-normal capitalize leading-4 text-neutral-dark-2"> | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button | ||
className="bg-transparent text-neutral-dark-2 hover:bg-transparent focus:outline-none focus:ring-0 focus-visible:ring-0 focus-visible:ring-offset-0" | ||
size={"icon"} | ||
> | ||
<EllipsisVertical size={16} color="#09090b" /> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
<DropdownMenuContent align="end"> | ||
<DropdownMenuLabel className="sr-only"> | ||
Actions | ||
</DropdownMenuLabel> | ||
<DropdownMenuItem>Edit</DropdownMenuItem> | ||
<DropdownMenuItem onClick={handleOpenDialog}> | ||
Delete | ||
</DropdownMenuItem> | ||
</DropdownMenuContent> | ||
</DropdownMenu> | ||
</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
{isDialogOpen && <DeleteDialog onClose={handleCloseDialog} />} | ||
</> | ||
); | ||
}; | ||
|
||
export default WaitListTableBody; |
31 changes: 31 additions & 0 deletions
31
src/app/dashboard/(admin)/admin/(overview)/waitlist-page/_components/waitListTableHead.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const tableHeadData: string[] = [ | ||
"name", | ||
"email", | ||
"notes", | ||
"status", | ||
"created at", | ||
"action", | ||
]; | ||
|
||
const WaitListTableHead = () => { | ||
return ( | ||
<> | ||
<thead> | ||
<tr className="bg-[#FFF7F2]"> | ||
{tableHeadData.map((data, index) => { | ||
return ( | ||
<th | ||
key={index} | ||
className={`whitespace-nowrap p-4 text-left text-sm font-normal capitalize leading-4 text-neutral-dark-2 ${data === "name" ? "w-[300px]" : data === "action" ? "w-[86px]" : "w-[202px]"}`} | ||
> | ||
{data} | ||
</th> | ||
); | ||
})} | ||
</tr> | ||
</thead> | ||
</> | ||
); | ||
}; | ||
|
||
export default WaitListTableHead; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend no gree send endpoint........so i was like i will push this first when the endpoint is ready i willl update it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure brother. my backend are on it