-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a specific loader to each suspended server compoentn. (#38)
- Loading branch information
1 parent
0364236
commit 5ea8d1e
Showing
13 changed files
with
214 additions
and
71 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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,9 @@ | ||
const ButtonSkeleton = () => { | ||
return ( | ||
<button className="inline-block cursor-not-allowed rounded-md bg-gray-300 px-16 py-5 text-lg font-semibold text-gray-300 opacity-50 transition-opacity duration-300 ease-in-out hover:opacity-50 focus:outline-none focus:ring-2 focus:ring-gray-300 focus:ring-opacity-50"> | ||
<span className="block h-full w-full animate-pulse" /> | ||
</button> | ||
); | ||
}; | ||
|
||
export default ButtonSkeleton; |
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,49 @@ | ||
import { Fragment } from "react"; | ||
import { type Role } from "~/models/types"; | ||
|
||
const NavigationSkeleton = ({ roles }: { roles: Role[] }) => { | ||
return ( | ||
<nav className="relative mt-8 p-4" style={{ padding: "100px 40px 40px" }}> | ||
<div className="mt-4"> | ||
{/* Progress bar */} | ||
<div | ||
className="flex items-center justify-between" | ||
style={{ width: "90%" }} | ||
> | ||
{roles.map((section, index) => ( | ||
<Fragment key={section.id}> | ||
{/* Circle with clickable area */} | ||
<div className="relative flex items-center justify-center"> | ||
<div | ||
className={`mb-1 h-6 w-6 animate-pulse rounded-full border-2 bg-gray-300`} | ||
/> | ||
<div | ||
className="absolute -rotate-45 whitespace-nowrap text-xs font-semibold" | ||
style={{ | ||
transformOrigin: "bottom left", | ||
top: "-22px", | ||
left: "calc(100% - 0px)", | ||
}} | ||
> | ||
<span className="block h-4 w-16 animate-pulse bg-gray-300" /> | ||
</div> | ||
</div> | ||
{/* Line (except for the last section) */} | ||
{index !== roles.length - 1 && ( | ||
<div | ||
className={`mx-2 h-0.5 flex-1 animate-pulse bg-gray-300`} | ||
/> | ||
)} | ||
</Fragment> | ||
))} | ||
</div> | ||
</div> | ||
<div className="flex items-center justify-between"> | ||
<h3 className="hidden animate-pulse text-lg font-semibold">Progress</h3> | ||
<span className="animate-pulse text-sm">0.00% Completed</span> | ||
</div> | ||
</nav> | ||
); | ||
}; | ||
|
||
export default NavigationSkeleton; |
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,41 @@ | ||
"use client"; | ||
|
||
import { ResponsiveContainer } from "recharts"; | ||
|
||
const LegendSkeleton = () => { | ||
return ( | ||
<div className="grid gap-4"> | ||
<h2 className="mb-4 animate-pulse text-lg font-semibold">Legend</h2> | ||
<div className="flex flex-wrap gap-4"> | ||
{[...Array<number>(5)].map((_, index) => ( | ||
<div key={index} className="flex items-center"> | ||
<div className="mr-4 h-6 w-6 animate-pulse rounded-full bg-gray-300"></div> | ||
<span className="h-6 w-24 animate-pulse bg-gray-300"></span> | ||
</div> | ||
))} | ||
</div> | ||
{[...Array<number>(3)].map((_, index) => ( | ||
<div key={index} className="grid gap-4 md:grid-cols-2"> | ||
<div className="rounded-md p-4 shadow-md"> | ||
<h3 className="mb-4 animate-pulse text-lg font-medium">Question</h3> | ||
<div className="chart-container"> | ||
<ResponsiveContainer width="100%" height={300}> | ||
<div className="h-full w-full animate-pulse bg-gray-300"></div> | ||
</ResponsiveContainer> | ||
</div> | ||
</div> | ||
<div className="rounded-md p-4 shadow-md"> | ||
<h3 className="mb-4 animate-pulse text-lg font-medium">Question</h3> | ||
<div className="chart-container"> | ||
<ResponsiveContainer width="100%" height={300}> | ||
<div className="h-full w-full animate-pulse bg-gray-300"></div> | ||
</ResponsiveContainer> | ||
</div> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default LegendSkeleton; |
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,27 @@ | ||
import ButtonSkeleton from "./button-loader"; | ||
|
||
const RoleSelectionSkeleton = () => { | ||
return ( | ||
<div className="container mx-auto py-8"> | ||
<h1 className="mb-4 animate-pulse text-2xl font-bold">Select Roles</h1> | ||
<ul className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"> | ||
{Array.from({ length: 15 }).map((_, index) => ( | ||
<li | ||
key={index} | ||
className={`cursor-not-allowed rounded-lg border p-4 opacity-50 hover:bg-gray-100 hover:bg-opacity-25`} | ||
> | ||
<div className="flex items-center"> | ||
<div className="mr-2 h-5 w-5 animate-pulse rounded-full bg-gray-300"></div> | ||
<div className="h-4 w-20 animate-pulse bg-gray-300"></div> | ||
</div> | ||
</li> | ||
))} | ||
</ul> | ||
<div className="mt-8 flex"> | ||
<ButtonSkeleton /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RoleSelectionSkeleton; |
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,59 @@ | ||
import { Skeleton } from "~/components/ui/skeleton"; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from "~/components/ui/table"; | ||
import NavigationSkeleton from "./progression-bar-loader"; | ||
|
||
export default function SurveyQuestionLoader() { | ||
const answerOptions = [{ id: 0 }, { id: 1 }, { id: 2 }, { id: 3 }]; | ||
|
||
// create 6 roles of type Role[] | ||
const roles = Array.from({ length: 6 }, (_, index) => ({ | ||
id: index.toString(), | ||
role: `Role ${index}`, | ||
default: index === 0, | ||
})); | ||
|
||
return ( | ||
<div> | ||
<NavigationSkeleton roles={roles} /> | ||
<div className="container flex h-full flex-col items-center justify-center gap-12 px-4 py-16"> | ||
<div> | ||
<Table> | ||
<TableHeader className="sticky top-0 z-10 h-10 w-full bg-slate-100 dark:bg-slate-900"> | ||
<TableRow> | ||
<TableHead className="w-[400px]"> | ||
<Skeleton className="h-4 w-full" /> | ||
</TableHead> | ||
{answerOptions.map((option) => ( | ||
<TableHead key={option.id}> | ||
<Skeleton className="h-4 w-full" /> | ||
</TableHead> | ||
))} | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
{Array.from({ length: 20 }).map((_, index) => ( | ||
<TableRow key={index}> | ||
<TableCell> | ||
<Skeleton className="h-4 w-[250px]" /> | ||
</TableCell> | ||
{answerOptions.map((option) => ( | ||
<TableCell className="h-[40px]" key={option.id}> | ||
<Skeleton className="h-4 w-[300px] " /> | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.