Improve business details page layout and styling

The changes focus on improving the layout, styling and UX of the
business details pages by:
- Streamlining the edit page layout
- Adding consistent card styling and spacing
- Improving header structure and actions
- Enhancing content organization with separators
- Updating icon styles and colors
- Refining typography and spacing
This commit is contained in:
2025-07-16 13:43:45 -04:00
parent 572a10f30f
commit 4976c13f32
8 changed files with 521 additions and 462 deletions
@@ -1,24 +1,12 @@
"use client";
import Link from "next/link";
import { useParams } from "next/navigation";
import { BusinessForm } from "~/components/forms/business-form";
import { PageHeader } from "~/components/layout/page-header";
export default function EditBusinessPage() {
const params = useParams();
const businessId = Array.isArray(params?.id) ? params.id[0] : params?.id;
if (!businessId) return null;
return (
<div>
<PageHeader
title="Edit Business"
description="Update business information below."
variant="gradient"
/>
<BusinessForm businessId={businessId} mode="edit" />
</div>
);
return <BusinessForm businessId={businessId} mode="edit" />;
}
+203 -165
View File
@@ -4,6 +4,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card";
import { Button } from "~/components/ui/button";
import { Badge } from "~/components/ui/badge";
import { PageHeader } from "~/components/layout/page-header";
import { Separator } from "~/components/ui/separator";
import Link from "next/link";
import {
Edit,
@@ -15,6 +16,7 @@ import {
DollarSign,
Globe,
Hash,
ArrowLeft,
} from "lucide-react";
interface BusinessDetailPageProps {
@@ -41,72 +43,91 @@ export default async function BusinessDetailPage({
};
return (
<div>
<div className="mx-auto max-w-4xl space-y-6">
<PageHeader
title={business.name}
description="Business Details"
variant="gradient"
>
<Link href={`/dashboard/businesses/${business.id}/edit`}>
<Button variant="brand">
<Edit className="mr-2 h-4 w-4" />
Edit Business
</Button>
<div className="space-y-6 pb-32">
<PageHeader
title={business.name}
description="View business details and information"
variant="gradient"
>
<Button asChild variant="outline" className="shadow-sm">
<Link href="/dashboard/businesses">
<ArrowLeft className="mr-2 h-4 w-4" />
<span>Back to Businesses</span>
</Link>
</PageHeader>
</Button>
<Button asChild className="btn-brand-primary shadow-md">
<Link href={`/dashboard/businesses/${business.id}/edit`}>
<Edit className="mr-2 h-4 w-4" />
<span>Edit Business</span>
</Link>
</Button>
</PageHeader>
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
{/* Business Information Card */}
<div className="lg:col-span-2">
<Card className="card-primary">
<CardHeader>
<CardTitle className="card-title-success">
<Building className="h-5 w-5" />
<span>Business Information</span>
</CardTitle>
</CardHeader>
<CardContent className="space-y-6">
{/* Basic Info */}
<div className="grid grid-cols-1 gap-6 md:grid-cols-2">
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
{/* Business Information Card */}
<div className="lg:col-span-2">
<Card className="card-primary">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<div className="bg-blue-subtle rounded-lg p-2">
<Building className="text-icon-blue h-5 w-5" />
</div>
<span>Business Information</span>
</CardTitle>
</CardHeader>
<CardContent className="space-y-6">
{/* Contact Information */}
<div>
<h3 className="mb-4 text-lg font-semibold">
Contact Information
</h3>
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
{business.email && (
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Mail className="text-icon-emerald h-4 w-4" />
<div className="bg-green-subtle rounded-lg p-2">
<Mail className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">Email</p>
<p className="text-accent text-sm">{business.email}</p>
<p className="text-muted-foreground text-sm font-medium">
Email
</p>
<p className="text-foreground text-sm">
{business.email}
</p>
</div>
</div>
)}
{business.phone && (
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Phone className="text-icon-emerald h-4 w-4" />
<div className="bg-green-subtle rounded-lg p-2">
<Phone className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">Phone</p>
<p className="text-accent text-sm">{business.phone}</p>
<p className="text-muted-foreground text-sm font-medium">
Phone
</p>
<p className="text-foreground text-sm">
{business.phone}
</p>
</div>
</div>
)}
{business.website && (
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Globe className="text-icon-emerald h-4 w-4" />
<div className="bg-green-subtle rounded-lg p-2">
<Globe className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">
<p className="text-muted-foreground text-sm font-medium">
Website
</p>
<a
href={business.website}
target="_blank"
rel="noopener noreferrer"
className="link-primary text-sm"
className="text-primary text-sm hover:underline"
>
{business.website}
</a>
@@ -116,152 +137,169 @@ export default async function BusinessDetailPage({
{business.taxId && (
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Hash className="text-icon-emerald h-4 w-4" />
<div className="bg-green-subtle rounded-lg p-2">
<Hash className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">Tax ID</p>
<p className="text-accent text-sm">{business.taxId}</p>
<p className="text-muted-foreground text-sm font-medium">
Tax ID
</p>
<p className="text-foreground text-sm">
{business.taxId}
</p>
</div>
</div>
)}
</div>
</div>
{/* Address */}
{(business.addressLine1 ?? business.city ?? business.state) && (
<div className="space-y-4">
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<MapPin className="text-icon-emerald h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">
Address
</p>
</div>
</div>
<div className="text-accent ml-11 space-y-1 text-sm">
{business.addressLine1 && <p>{business.addressLine1}</p>}
{business.addressLine2 && <p>{business.addressLine2}</p>}
{(business.city ??
business.state ??
business.postalCode) && (
<p>
{[business.city, business.state, business.postalCode]
.filter(Boolean)
.join(", ")}
</p>
)}
{business.country && <p>{business.country}</p>}
</div>
</div>
)}
{/* Business Since */}
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Calendar className="text-icon-emerald h-4 w-4" />
</div>
{/* Address */}
{(business.addressLine1 ?? business.city ?? business.state) && (
<>
<Separator />
<div>
<p className="text-muted text-sm font-medium">
Business Added
</p>
<p className="text-secondary text-sm">
{formatDate(business.createdAt)}
</p>
<h3 className="mb-4 text-lg font-semibold">
Business Address
</h3>
<div className="flex items-start space-x-3">
<div className="bg-green-subtle rounded-lg p-2">
<MapPin className="text-icon-green h-4 w-4" />
</div>
<div className="space-y-1 text-sm">
{business.addressLine1 && (
<p className="text-foreground">
{business.addressLine1}
</p>
)}
{business.addressLine2 && (
<p className="text-foreground">
{business.addressLine2}
</p>
)}
{(business.city ??
business.state ??
business.postalCode) && (
<p className="text-foreground">
{[
business.city,
business.state,
business.postalCode,
]
.filter(Boolean)
.join(", ")}
</p>
)}
{business.country && (
<p className="text-foreground">{business.country}</p>
)}
</div>
</div>
</div>
</div>
</>
)}
{/* Default Business Badge */}
{business.isDefault && (
<Separator />
{/* Business Metadata */}
<div>
<h3 className="mb-4 text-lg font-semibold">Business Details</h3>
<div className="space-y-4">
<div className="flex items-center space-x-3">
<div className="icon-bg-emerald">
<Building className="text-icon-emerald h-4 w-4" />
<div className="bg-green-subtle rounded-lg p-2">
<Calendar className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted text-sm font-medium">Status</p>
<Badge className="badge-success">Default Business</Badge>
<p className="text-muted-foreground text-sm font-medium">
Business Added
</p>
<p className="text-foreground text-sm">
{formatDate(business.createdAt)}
</p>
</div>
</div>
)}
</CardContent>
</Card>
</div>
{/* Settings & Actions Card */}
<div className="space-y-6">
<Card className="card-secondary">
<CardHeader>
<CardTitle className="card-title-primary">
<Building className="h-5 w-5" />
<span>Business Settings</span>
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="text-center">
<p className="text-muted text-sm">Default Business</p>
<p className="text-lg font-semibold">
{business.isDefault ? (
<Badge className="badge-success">Yes</Badge>
) : (
<Badge variant="outline">No</Badge>
)}
</p>
</div>
<div className="space-y-3">
<p className="text-muted text-sm font-medium">
Quick Actions
</p>
<div className="space-y-2">
<Link href={`/dashboard/businesses/${business.id}/edit`}>
<Button
variant="outline"
size="sm"
className="w-full justify-start"
>
<Edit className="mr-2 h-4 w-4" />
Edit Business
</Button>
</Link>
<Link href="/dashboard/invoices/new">
<Button
variant="outline"
size="sm"
className="w-full justify-start"
>
<DollarSign className="mr-2 h-4 w-4" />
Create Invoice
</Button>
</Link>
</div>
</div>
</CardContent>
</Card>
{/* Information Card */}
<Card className="card-secondary">
<CardHeader>
<CardTitle className="text-accent text-lg">
About This Business
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-secondary space-y-3 text-sm">
<p>
This business profile is used for generating invoices and
represents your company information to clients.
</p>
{/* Default Business Badge */}
{business.isDefault && (
<p className="text-icon-emerald">
This is your default business and will be automatically
selected when creating new invoices.
</p>
<div className="flex items-center space-x-3">
<div className="bg-green-subtle rounded-lg p-2">
<Building className="text-icon-green h-4 w-4" />
</div>
<div>
<p className="text-muted-foreground text-sm font-medium">
Status
</p>
<Badge
variant="default"
className="bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"
>
Default Business
</Badge>
</div>
</div>
)}
</div>
</CardContent>
</Card>
</div>
</div>
</CardContent>
</Card>
</div>
{/* Settings & Actions Card */}
<div className="space-y-6">
<Card className="card-primary">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<div className="bg-blue-subtle rounded-lg p-2">
<Building className="text-icon-blue h-5 w-5" />
</div>
<span>Quick Actions</span>
</CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-2">
<Button
asChild
variant="outline"
className="w-full justify-start"
>
<Link href={`/dashboard/businesses/${business.id}/edit`}>
<Edit className="mr-2 h-4 w-4" />
Edit Business
</Link>
</Button>
<Button
asChild
variant="outline"
className="w-full justify-start"
>
<Link href="/dashboard/invoices/new">
<DollarSign className="mr-2 h-4 w-4" />
Create Invoice
</Link>
</Button>
</div>
</CardContent>
</Card>
{/* Information Card */}
<Card className="card-primary">
<CardHeader>
<CardTitle className="text-lg">About This Business</CardTitle>
</CardHeader>
<CardContent>
<div className="text-muted-foreground space-y-3 text-sm">
<p>
This business profile is used for generating invoices and
represents your company information to clients.
</p>
{business.isDefault && (
<p className="text-green-600 dark:text-green-400">
This is your default business and will be automatically
selected when creating new invoices.
</p>
)}
</div>
</CardContent>
</Card>
</div>
</div>
</div>