feat(agreements): implement agreement fetching and display with error handling
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 13m34s

feat(agreement-card): create AgreementCard component for displaying user agreements
fix(devices-table): update no devices message for clarity based on parental control
fix(payments-table): update no payments message for consistency
fix(topups-table): update no topups message for consistency
feat(user): add agreement field to User interface
This commit is contained in:
2025-07-27 19:42:15 +05:00
parent dcf58c4349
commit 171b1d4d7c
9 changed files with 9675 additions and 9811 deletions

View File

@ -0,0 +1,30 @@
import { EyeIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Card,
CardDescription,
CardFooter,
CardHeader,
CardTitle
} from "@/components/ui/card"
export function AgreementCard({ agreement }: { agreement: string }) {
return (
<Card className="w-full max-w-sm">
<CardHeader>
<CardTitle>Sarlink User Agreement</CardTitle>
<CardDescription>
User agreement for Sarlink services.
</CardDescription>
</CardHeader>
<CardFooter className="flex-col gap-2">
<a target="_blank" rel="noopener noreferrer" className="w-full hover:cursor-pointer" href={agreement}>
<Button type="button" className="w-full hover:cursor-pointer">
<EyeIcon />
View Agreement
</Button>
</a>
</CardFooter>
</Card>
)
}

View File

@ -65,7 +65,7 @@ export async function DevicesTable({
<div>
{data?.length === 0 ? (
<div className="h-[calc(100svh-400px)] text-muted-foreground flex flex-col items-center justify-center my-4">
<h3>No devices.</h3>
<h3>{parentalControl ? "No active devices" : "No devices."}</h3>
</div>
) : (
<>

View File

@ -52,8 +52,8 @@ export async function PaymentsTable({
return (
<div>
{data?.length === 0 ? (
<div className="h-[calc(100svh-400px)] flex flex-col items-center justify-center my-4">
<h3>No Payments yet.</h3>
<div className="h-[calc(100svh-400px)] text-muted-foreground flex flex-col items-center justify-center my-4">
<h3>No Payments.</h3>
</div>
) : (
<>

View File

@ -52,8 +52,8 @@ export async function TopupsTable({
return (
<div>
{data?.length === 0 ? (
<div className="h-[calc(100svh-400px)] flex flex-col items-center justify-center my-4">
<h3>No topups yet.</h3>
<div className="h-[calc(100svh-400px)] flex text-muted-foreground flex-col items-center justify-center my-4">
<h3>No topups.</h3>
</div>
) : (
<>

View File

@ -1,7 +1,6 @@
"use client";
import { useAtom } from "jotai";
import { CircleDollarSign, Loader2, Wallet2 } from "lucide-react";
import millify from "millify";
import { usePathname, useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";
@ -40,10 +39,7 @@ export function Wallet({ walletBalance }: { walletBalance: number }) {
<Drawer open={isOpen} onOpenChange={setIsOpen}>
<DrawerTrigger asChild>
<Button onClick={() => setIsOpen(!isOpen)} variant="outline">
{millify(walletBalance, {
precision: 2,
lowercase: true,
})}{" "}
{walletBalance}{" "}
MVR
<Wallet2 />
</Button>