refactor: add animations
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 10m27s

This commit is contained in:
2025-09-24 19:33:48 +05:00
parent f8774f51e6
commit 9ad1887f88
10 changed files with 994 additions and 993 deletions

View File

@@ -27,11 +27,16 @@ export default async function DeviceDetails({
<div> <div>
<div className="flex items-center justify-between title-bg title-bg ring-2 ring-sarLinkOrange/50 rounded-lg p-4"> <div className="flex items-center justify-between title-bg title-bg ring-2 ring-sarLinkOrange/50 rounded-lg p-4">
<div className="flex flex-col justify-between items-start"> <div className="flex flex-col justify-between items-start">
<h3 className="text-2xl text-sarLinkOrange font-bold"> <h3 className="text-2xl text-sarLinkOrange motion-preset-slide-down-md font-bold">
{device?.name} {device?.name}
</h3> </h3>
<Badge variant={"secondary"}>{device?.mac}</Badge> <Badge
<p className="text-muted-foreground text-sm mt-2"> className="motion-preset-slide-down-md motion-delay-75"
variant={"secondary"}
>
{device?.mac}
</Badge>
<p className="text-muted-foreground text-sm mt-2 motion-preset-slide-down-md motion-delay-100">
Device active until{" "} Device active until{" "}
{new Date(device?.expiry_date || "").toLocaleDateString("en-US", { {new Date(device?.expiry_date || "").toLocaleDateString("en-US", {
month: "short", month: "short",
@@ -40,7 +45,7 @@ export default async function DeviceDetails({
})} })}
</p> </p>
</div> </div>
<div className="flex items-center gap-2 flex-col"> <div className="flex items-center gap-2 flex-col motion-preset-fade">
{device?.expiry_date && new Date() < new Date(device.expiry_date) && ( {device?.expiry_date && new Date() < new Date(device.expiry_date) && (
<p className="text-base font-semibold font-mono w-full text-center px-2 p-1 rounded-md bg-green-500/10 text-green-900 dark:text-green-400"> <p className="text-base font-semibold font-mono w-full text-center px-2 p-1 rounded-md bg-green-500/10 text-green-900 dark:text-green-400">
ACTIVE ACTIVE

View File

@@ -12,10 +12,12 @@ export default function ClickableRow({
device, device,
parentalControl, parentalControl,
admin = false, admin = false,
idx,
}: { }: {
device: Device; device: Device;
parentalControl?: boolean; parentalControl?: boolean;
admin?: boolean; admin?: boolean;
idx?: number;
}) { }) {
const [devices, setDeviceCart] = useAtom(deviceCartAtom); const [devices, setDeviceCart] = useAtom(deviceCartAtom);
@@ -26,6 +28,7 @@ export default function ClickableRow({
(parentalControl === false && device.blocked) || device.is_active (parentalControl === false && device.blocked) || device.is_active
? "cursor-not-allowed hover:bg-accent-foreground/10" ? "cursor-not-allowed hover:bg-accent-foreground/10"
: "cursor-pointer hover:bg-muted-foreground/10", : "cursor-pointer hover:bg-muted-foreground/10",
`motion-preset-fade-md motion-delay-${(idx || 1) * 75}ms`,
)} )}
onClick={() => { onClick={() => {
if (device.blocked) return; if (device.blocked) return;

View File

@@ -41,7 +41,7 @@ export default function DeviceCard({
> >
<div <div
className={cn( className={cn(
"flex text-sm justify-between items-center my-2 p-4 border rounded-md", "flex text-sm justify-between items-center my-2 p-4 border rounded-md motion-preset-fade-md",
isChecked ? "bg-accent" : "", isChecked ? "bg-accent" : "",
device.is_active device.is_active
? "cursor-not-allowed text-green-600 hover:bg-accent-foreground/10" ? "cursor-not-allowed text-green-600 hover:bg-accent-foreground/10"

View File

@@ -79,12 +79,13 @@ export async function DevicesTable({
</TableRow> </TableRow>
</TableHeader> </TableHeader>
<TableBody className="overflow-scroll"> <TableBody className="overflow-scroll">
{data?.map((device) => ( {data?.map((device, idx) => (
<ClickableRow <ClickableRow
admin={isAdmin} admin={isAdmin}
key={device.id} key={device.id}
device={device} device={device}
parentalControl={parentalControl} parentalControl={parentalControl}
idx={idx + 1}
/> />
))} ))}
</TableBody> </TableBody>

View File

@@ -126,6 +126,7 @@ export default function DevicesToPay({
type="submit" type="submit"
variant={"secondary"} variant={"secondary"}
size={"lg"} size={"lg"}
className="w-full"
> >
{isPending {isPending
? "Processing payment..." ? "Processing payment..."
@@ -145,7 +146,7 @@ export default function DevicesToPay({
disabled={isPending || disabled} disabled={isPending || disabled}
type="submit" type="submit"
size={"lg"} size={"lg"}
className="mb-4" className="mb-4 w-full"
> >
{isPending ? "Processing payment..." : "I have paid"} {isPending ? "Processing payment..." : "I have paid"}
{isPending ? ( {isPending ? (
@@ -162,10 +163,8 @@ export default function DevicesToPay({
</TableCaption> </TableCaption>
<TableBody className=""> <TableBody className="">
<TableRow> <TableRow>
<TableCell className="motion-preset-slide-left-sm"> <TableCell>Payment created</TableCell>
Payment created <TableCell className="text-right motion-preset-slide-up-sm">
</TableCell>
<TableCell className="text-right motion-preset-slide-right-sm">
{new Date(payment?.created_at ?? "").toLocaleDateString( {new Date(payment?.created_at ?? "").toLocaleDateString(
"en-US", "en-US",
{ {
@@ -180,31 +179,22 @@ export default function DevicesToPay({
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell className="motion-preset-slide-left-sm motion-delay-75"> <TableCell>Total Devices</TableCell>
Total Devices <TableCell className="text-right text-xl motion-preset-slide-up-sm motion-delay-75">
</TableCell>
<TableCell className="text-right text-xl motion-preset-slide-right-sm motion-delay-75">
{devices?.length} {devices?.length}
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
<TableCell className="motion-preset-slide-left-sm motion-delay-100"> <TableCell>Duration</TableCell>
Duration <TableCell className="text-right text-xl motion-preset-slide-up-sm motion-delay-100">
</TableCell>
<TableCell className="text-right text-xl motion-preset-slide-right-sm motion-delay-100">
{payment?.number_of_months} Months {payment?.number_of_months} Months
</TableCell> </TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
<TableFooter> <TableFooter>
<TableRow className=""> <TableRow className="">
<TableCell <TableCell colSpan={1}>Total Due</TableCell>
className="motion-preset-slide-left-sm motion-delay-150" <TableCell className="text-right text-3xl font-bold motion-preset-slide-up-sm motion-delay-150">
colSpan={1}
>
Total Due
</TableCell>
<TableCell className="text-right text-3xl font-bold motion-preset-slide-right-sm motion-delay-150">
{payment?.amount?.toFixed(2)} {payment?.amount?.toFixed(2)}
</TableCell> </TableCell>
</TableRow> </TableRow>

View File

@@ -68,7 +68,7 @@ export async function PaymentsTable({
</TableHeader> </TableHeader>
<TableBody className="overflow-scroll"> <TableBody className="overflow-scroll">
{payments?.data?.map((payment) => ( {payments?.data?.map((payment) => (
<TableRow key={payment.id}> <TableRow className="motion-preset-fade-md" key={payment.id}>
<TableCell> <TableCell>
<div <div
className={cn( className={cn(
@@ -197,7 +197,7 @@ export function MobilePaymentDetails({
return ( return (
<div <div
className={cn( className={cn(
"flex flex-col items-start border rounded p-2 my-2", "flex flex-col items-start border rounded p-2 my-2 motion-preset-fade-md",
payment?.paid payment?.paid
? "bg-green-500/10 border-dashed border-green-500" ? "bg-green-500/10 border-dashed border-green-500"
: payment?.is_expired : payment?.is_expired

View File

@@ -71,7 +71,7 @@ export async function TopupsTable({
<TableCell> <TableCell>
<div <div
className={cn( className={cn(
"flex flex-col items-start border rounded p-2", "flex flex-col items-start border rounded p-2 motion-preset-fade-md",
topup?.paid topup?.paid
? "bg-green-500/10 border-dashed border-green-500" ? "bg-green-500/10 border-dashed border-green-500"
: topup?.is_expired : topup?.is_expired
@@ -165,9 +165,11 @@ function MobileTopupDetails({ topup }: { topup: Topup }) {
return ( return (
<div <div
className={cn( className={cn(
"flex flex-col items-start border rounded p-2 my-2", "flex flex-col items-start border rounded p-2 my-2 motion-preset-fade-md",
topup?.paid topup?.paid
? "bg-green-500/10 border-dashed border-green=500" ? "bg-green-500/10 border-dashed border-green-500"
: topup?.is_expired
? "bg-gray-500/10 border-dashed border-gray-500 dark:border-gray-500/50"
: "bg-yellow-500/10 border-dashed border-yellow-500 dark:border-yellow-500/50", : "bg-yellow-500/10 border-dashed border-yellow-500 dark:border-yellow-500/50",
)} )}
> >

View File

@@ -204,7 +204,7 @@ export async function AppSidebar({
<Link className="text-md" href={item.link}> <Link className="text-md" href={item.link}>
{item.icon} {item.icon}
<span <span
className={`opacity-70 motion-preset-slide-left-md ml-2`} className={`opacity-70 motion-preset-fade motion-duration-300 ml-2`}
> >
{item.title} {item.title}
</span> </span>

View File

@@ -66,7 +66,7 @@ export async function WalletTransactionsTable({
</div> </div>
) : ( ) : (
<div> <div>
<div className="flex gap-4 mb-4 w-full"> <div className="flex gap-4 mb-4 w-full motion-preset-fade-md">
<div className="bg-red-300 ring-4 ring-red-500/20 w-full sm:w-fit dark:bg-red-950 dark:text-red-400 text-red-900 p-2 px-4 rounded-md mb-2"> <div className="bg-red-300 ring-4 ring-red-500/20 w-full sm:w-fit dark:bg-red-950 dark:text-red-400 text-red-900 p-2 px-4 rounded-md mb-2">
<h5 className="text-lg font-semibold uppercase font-barlow"> <h5 className="text-lg font-semibold uppercase font-barlow">
Total Debit Total Debit
@@ -95,7 +95,7 @@ export async function WalletTransactionsTable({
{transactions?.data?.map((trx) => ( {transactions?.data?.map((trx) => (
<TableRow <TableRow
className={cn( className={cn(
"items-start border rounded p-2", "items-start border rounded p-2 motion-preset-slide-down-sm",
trx?.transaction_type === "TOPUP" trx?.transaction_type === "TOPUP"
? "credit-bg" ? "credit-bg"
: "debit-bg", : "debit-bg",

View File

@@ -29,7 +29,7 @@ export function WelcomeBanner({ firstName, lastName }: WelcomeBannerProps) {
exit={{ opacity: 0 }} exit={{ opacity: 0 }}
> >
Welcome,{" "} Welcome,{" "}
<p className="font-semibold motion-preset-slide-down inline-block motion-delay-200"> <p className="font-semibold motion-preset-fade inline-block motion-delay-200">
{firstName} {lastName} {firstName} {lastName}
</p> </p>
</motion.div> </motion.div>