feat(charge-points): add pricing mode for charge points with validation
feat(pricing): implement tariff management with peak, valley, and flat pricing feat(api): add tariff API for fetching and updating pricing configurations feat(tariff-schema): create database schema for tariff configuration feat(pricing-page): create UI for displaying and managing pricing tiers fix(sidebar): update sidebar to include pricing settings link
This commit is contained in:
@@ -20,19 +20,20 @@ import { useSession } from "@/lib/auth-client";
|
||||
|
||||
const chargeItems = [
|
||||
{ href: "/dashboard/charge", label: "立即充电", icon: ThunderboltFill, adminOnly: false },
|
||||
{ href: "/dashboard/pricing", label: "电价标准", icon: TagDollar, adminOnly: false },
|
||||
];
|
||||
|
||||
const navItems = [
|
||||
{ href: "/dashboard", label: "概览", icon: Thunderbolt, exact: true, adminOnly: false },
|
||||
{ href: "/dashboard/charge-points", label: "充电桩", icon: PlugConnection, adminOnly: false },
|
||||
{ href: "/dashboard/transactions", label: "充电记录", icon: ListCheck, adminOnly: false },
|
||||
{ href: "/dashboard/id-tags", label: "储值卡", icon: CreditCard, adminOnly: false },
|
||||
{ href: "/dashboard/transactions", label: "充电记录", icon: ListCheck, adminOnly: false },
|
||||
{ href: "/dashboard/settings/pricing", label: "峰谷电价", icon: TagDollar, adminOnly: true },
|
||||
{ href: "/dashboard/users", label: "用户管理", icon: Person, adminOnly: true },
|
||||
];
|
||||
|
||||
const settingsItems = [
|
||||
{ href: "/dashboard/settings/user", label: "账号设置", icon: Gear, adminOnly: false },
|
||||
{ href: "/dashboard/settings/pricing", label: "峰谷电价", icon: TagDollar, adminOnly: true },
|
||||
];
|
||||
|
||||
function NavContent({
|
||||
@@ -114,27 +115,29 @@ function NavContent({
|
||||
<p className="mb-1 mt-3 px-2 text-[11px] font-semibold uppercase tracking-widest text-muted">
|
||||
设置
|
||||
</p>
|
||||
{settingsItems.filter((item) => !item.adminOnly || isAdmin).map((item) => {
|
||||
const isActive = pathname === item.href || pathname.startsWith(item.href + "/");
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
onClick={onNavigate}
|
||||
className={[
|
||||
"flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",
|
||||
isActive
|
||||
? "bg-accent/10 text-accent"
|
||||
: "text-muted hover:bg-surface-tertiary hover:text-foreground",
|
||||
].join(" ")}
|
||||
>
|
||||
<Icon className="size-4 shrink-0" />
|
||||
<span>{item.label}</span>
|
||||
{isActive && <span className="ml-auto h-1.5 w-1.5 rounded-full bg-accent" />}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
{settingsItems
|
||||
.filter((item) => !item.adminOnly || isAdmin)
|
||||
.map((item) => {
|
||||
const isActive = pathname === item.href || pathname.startsWith(item.href + "/");
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
onClick={onNavigate}
|
||||
className={[
|
||||
"flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",
|
||||
isActive
|
||||
? "bg-accent/10 text-accent"
|
||||
: "text-muted hover:bg-surface-tertiary hover:text-foreground",
|
||||
].join(" ")}
|
||||
>
|
||||
<Icon className="size-4 shrink-0" />
|
||||
<span>{item.label}</span>
|
||||
{isActive && <span className="ml-auto h-1.5 w-1.5 rounded-full bg-accent" />}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
{/* Footer */}
|
||||
|
||||
Reference in New Issue
Block a user