From 2d42473910c7762c38df4df117158a59cdb871b3 Mon Sep 17 00:00:00 2001 From: zetaloop Date: Wed, 25 Feb 2026 15:34:33 +0800 Subject: [PATCH] chore(format): add prettier-plugin-organize-imports and sort imports --- .prettierrc.json | 3 +- app/(account)/notifications/page.tsx | 4 +-- app/(account)/settings/page.tsx | 6 ++-- app/(account)/verify/page.tsx | 4 +-- app/(account)/wallet/page.tsx | 16 +++++----- app/(auth)/login/page.tsx | 12 ++++---- app/(auth)/register/page.tsx | 12 ++++---- app/(dashboard)/dashboard/page.tsx | 4 +-- .../dashboard/services/new/page.tsx | 14 ++++----- app/(dashboard)/dashboard/services/page.tsx | 4 +-- .../dashboard/shop/employees/page.tsx | 6 ++-- .../dashboard/shop/income/page.tsx | 2 +- .../dashboard/shop/orders/page.tsx | 4 +-- app/(dashboard)/dashboard/shop/page.tsx | 6 ++-- app/(dashboard)/dashboard/shop/rules/page.tsx | 4 +-- .../dashboard/shop/templates/page.tsx | 6 ++-- app/(main)/community/page.tsx | 6 ++-- app/(main)/help/page.tsx | 2 +- app/(main)/page.tsx | 6 ++-- app/(main)/player/[id]/page.tsx | 6 ++-- app/(main)/post/[id]/page.tsx | 8 ++--- app/(main)/post/new/page.tsx | 14 ++++----- app/(main)/search/page.tsx | 30 +++++++++---------- app/(main)/shop/[id]/page.tsx | 8 ++--- app/(main)/terms/page.tsx | 2 +- app/(main)/user/[id]/page.tsx | 6 ++-- app/(order)/chat/[id]/page.tsx | 10 +++---- app/(order)/chat/page.tsx | 4 +-- app/(order)/dispute/[id]/page.tsx | 24 +++++++-------- app/(order)/layout.tsx | 2 +- app/(order)/order/[id]/page.tsx | 8 ++--- app/(order)/order/new/page.tsx | 8 ++--- app/(order)/orders/page.tsx | 6 ++-- app/(order)/review/[id]/page.tsx | 6 ++-- app/api/search/route.ts | 2 +- app/layout.tsx | 2 +- app/providers.tsx | 4 +-- components/account-sidebar.tsx | 4 +-- components/auth-guard.tsx | 2 +- components/dashboard-sidebar.tsx | 6 ++-- components/favorite-button.tsx | 2 +- components/header.tsx | 28 ++++++++--------- components/login-dialog.tsx | 8 ++--- components/order-actions.tsx | 22 +++++++------- components/post-comment-count.tsx | 2 +- components/post-comments.tsx | 4 +-- components/post-like-button.tsx | 2 +- components/role-guard.tsx | 4 +-- components/ui/avatar.tsx | 2 +- components/ui/card.tsx | 2 +- components/ui/command.tsx | 12 ++++---- components/ui/dialog.tsx | 4 +-- components/ui/dropdown-menu.tsx | 10 +++---- components/ui/form.tsx | 12 ++++---- components/ui/popover.tsx | 6 ++-- components/ui/sheet.tsx | 8 ++--- components/ui/table.tsx | 2 +- components/ui/tabs.tsx | 2 +- components/ui/tooltip.tsx | 2 +- eslint.config.mjs | 2 +- lib/api/chat.ts | 2 +- lib/api/comments.ts | 2 +- lib/api/orders.ts | 2 +- lib/api/posts.ts | 2 +- lib/domain/order-machine.ts | 2 +- lib/search/search-catalog.ts | 2 +- lib/use-require-auth.ts | 2 +- package.json | 1 + pnpm-lock.yaml | 18 +++++++++++ store/auth.ts | 2 +- store/chat.ts | 2 +- store/comments.ts | 2 +- store/disputes.ts | 8 ++--- store/favorites.ts | 2 +- store/notifications.ts | 2 +- store/orders.ts | 10 +++---- store/player-status.ts | 2 +- store/players.ts | 2 +- store/posts.ts | 2 +- store/reviews.ts | 4 +-- store/services.ts | 2 +- store/shops.ts | 2 +- store/wallet.ts | 4 +-- tests/income-calculation.test.ts | 2 +- tests/order-machine.test.ts | 2 +- tests/policy-decision.test.ts | 2 +- tests/search-catalog.test.ts | 6 ++-- tests/search-route.test.ts | 2 +- 88 files changed, 266 insertions(+), 246 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index b40d06c..a876c16 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,6 @@ "singleQuote": false, "tabWidth": 2, "printWidth": 100, - "trailingComma": "all" + "trailingComma": "all", + "plugins": ["prettier-plugin-organize-imports"] } diff --git a/app/(account)/notifications/page.tsx b/app/(account)/notifications/page.tsx index 50ad49a..9cc0584 100644 --- a/app/(account)/notifications/page.tsx +++ b/app/(account)/notifications/page.tsx @@ -1,13 +1,13 @@ "use client" -import { Bell, CheckCheck, MessageSquare, ShoppingBag } from "lucide-react" -import Link from "next/link" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent } from "@/components/ui/card" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import type { Notification } from "@/lib/types" import { useNotificationStore } from "@/store/notifications" +import { Bell, CheckCheck, MessageSquare, ShoppingBag } from "lucide-react" +import Link from "next/link" const typeIcons: Record = { order: ShoppingBag, diff --git a/app/(account)/settings/page.tsx b/app/(account)/settings/page.tsx index c43f085..3862ee0 100644 --- a/app/(account)/settings/page.tsx +++ b/app/(account)/settings/page.tsx @@ -1,8 +1,5 @@ "use client" -import { Camera } from "lucide-react" -import Link from "next/link" -import { useRef, useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -15,6 +12,9 @@ import { Textarea } from "@/components/ui/textarea" import { notifySuccess } from "@/lib/toast" import type { UserRole } from "@/lib/types" import { useAuthStore } from "@/store/auth" +import { Camera } from "lucide-react" +import Link from "next/link" +import { useRef, useState } from "react" export default function SettingsPage() { const { diff --git a/app/(account)/verify/page.tsx b/app/(account)/verify/page.tsx index ebb15da..859f1ff 100644 --- a/app/(account)/verify/page.tsx +++ b/app/(account)/verify/page.tsx @@ -1,7 +1,5 @@ "use client" -import { CheckCircle, Clock, ShieldCheck, Upload } from "lucide-react" -import { useEffect, useRef, useState } from "react" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -18,6 +16,8 @@ import { Separator } from "@/components/ui/separator" import { Textarea } from "@/components/ui/textarea" import type { UserRole } from "@/lib/types" import { useAuthStore } from "@/store/auth" +import { CheckCircle, Clock, ShieldCheck, Upload } from "lucide-react" +import { useEffect, useRef, useState } from "react" export default function VerifyPage() { const [verifyRole, setVerifyRole] = useState("") diff --git a/app/(account)/wallet/page.tsx b/app/(account)/wallet/page.tsx index 60d757f..2d4fd28 100644 --- a/app/(account)/wallet/page.tsx +++ b/app/(account)/wallet/page.tsx @@ -1,5 +1,13 @@ "use client" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Input } from "@/components/ui/input" +import { Separator } from "@/components/ui/separator" +import { notifySuccess } from "@/lib/toast" +import { useAuthStore } from "@/store/auth" +import { useWalletStore } from "@/store/wallet" import { ArrowDownLeft, ArrowUpRight, @@ -9,14 +17,6 @@ import { Wallet, } from "lucide-react" import { useState } from "react" -import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Input } from "@/components/ui/input" -import { Separator } from "@/components/ui/separator" -import { notifySuccess } from "@/lib/toast" -import { useAuthStore } from "@/store/auth" -import { useWalletStore } from "@/store/wallet" const typeLabels: Record = { topup: "充值", diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index c66e225..7831e7f 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -1,17 +1,17 @@ "use client" -import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" -import { Gamepad2 } from "lucide-react" -import Link from "next/link" -import { useRouter } from "next/navigation" -import { useForm } from "react-hook-form" -import { z } from "zod" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { getCurrentUserForLogin } from "@/lib/api" import { useAuthStore } from "@/store/auth" +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { Gamepad2 } from "lucide-react" +import Link from "next/link" +import { useRouter } from "next/navigation" +import { useForm } from "react-hook-form" +import { z } from "zod" const loginSchema = z.object({ phone: z.string().min(11, "请输入正确的手机号"), diff --git a/app/(auth)/register/page.tsx b/app/(auth)/register/page.tsx index 58ebad4..0cd9e45 100644 --- a/app/(auth)/register/page.tsx +++ b/app/(auth)/register/page.tsx @@ -1,17 +1,17 @@ "use client" -import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" -import { Gamepad2 } from "lucide-react" -import Link from "next/link" -import { useRouter } from "next/navigation" -import { useForm } from "react-hook-form" -import { z } from "zod" import { Button } from "@/components/ui/button" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { getCurrentUserForLogin } from "@/lib/api" import { useAuthStore } from "@/store/auth" +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { Gamepad2 } from "lucide-react" +import Link from "next/link" +import { useRouter } from "next/navigation" +import { useForm } from "react-hook-form" +import { z } from "zod" const registerSchema = z .object({ diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index d48edb4..432248b 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -1,7 +1,5 @@ "use client" -import { CheckCircle, Clock, DollarSign, ListOrdered, Star, TrendingUp, Users } from "lucide-react" -import Link from "next/link" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -9,6 +7,8 @@ import { Progress } from "@/components/ui/progress" import { listOrders, listPlayers, listServices, listShops } from "@/lib/api" import { statusLabels } from "@/lib/constants" import { useAuthStore } from "@/store/auth" +import { CheckCircle, Clock, DollarSign, ListOrdered, Star, TrendingUp, Users } from "lucide-react" +import Link from "next/link" export default function DashboardPage() { const { currentRole } = useAuthStore() diff --git a/app/(dashboard)/dashboard/services/new/page.tsx b/app/(dashboard)/dashboard/services/new/page.tsx index b613381..76d0703 100644 --- a/app/(dashboard)/dashboard/services/new/page.tsx +++ b/app/(dashboard)/dashboard/services/new/page.tsx @@ -1,12 +1,5 @@ "use client" -import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" -import { ArrowLeft } from "lucide-react" -import Link from "next/link" -import { useRouter, useSearchParams } from "next/navigation" -import { useEffect } from "react" -import { useForm, useWatch } from "react-hook-form" -import { z } from "zod" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" @@ -27,6 +20,13 @@ import { useAuthStore } from "@/store/auth" import { usePlayerStore } from "@/store/players" import { useServiceStore } from "@/store/services" import { useShopStore } from "@/store/shops" +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { ArrowLeft } from "lucide-react" +import Link from "next/link" +import { useRouter, useSearchParams } from "next/navigation" +import { useEffect } from "react" +import { useForm, useWatch } from "react-hook-form" +import { z } from "zod" const serviceSchema = z.object({ gameId: z.string().min(1, "请选择游戏"), diff --git a/app/(dashboard)/dashboard/services/page.tsx b/app/(dashboard)/dashboard/services/page.tsx index 1759885..ff5b83c 100644 --- a/app/(dashboard)/dashboard/services/page.tsx +++ b/app/(dashboard)/dashboard/services/page.tsx @@ -1,7 +1,5 @@ "use client" -import { Edit, Plus, Trash2 } from "lucide-react" -import Link from "next/link" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -18,6 +16,8 @@ import { useAuthStore } from "@/store/auth" import { usePlayerStore } from "@/store/players" import { useServiceStore } from "@/store/services" import { useShopStore } from "@/store/shops" +import { Edit, Plus, Trash2 } from "lucide-react" +import Link from "next/link" export default function ServicesPage() { const userId = useAuthStore((state) => state.user?.id) diff --git a/app/(dashboard)/dashboard/shop/employees/page.tsx b/app/(dashboard)/dashboard/shop/employees/page.tsx index 9294eee..c52f7de 100644 --- a/app/(dashboard)/dashboard/shop/employees/page.tsx +++ b/app/(dashboard)/dashboard/shop/employees/page.tsx @@ -1,8 +1,5 @@ "use client" -import { MoreHorizontal, Star, UserPlus } from "lucide-react" -import Link from "next/link" -import { useMemo, useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" @@ -26,6 +23,9 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import { useAuthStore } from "@/store/auth" import { usePlayerStore } from "@/store/players" import { useShopStore } from "@/store/shops" +import { MoreHorizontal, Star, UserPlus } from "lucide-react" +import Link from "next/link" +import { useMemo, useState } from "react" const statusLabels: Record = { available: "在线", diff --git a/app/(dashboard)/dashboard/shop/income/page.tsx b/app/(dashboard)/dashboard/shop/income/page.tsx index 0f5aa4a..6c06e06 100644 --- a/app/(dashboard)/dashboard/shop/income/page.tsx +++ b/app/(dashboard)/dashboard/shop/income/page.tsx @@ -1,6 +1,5 @@ "use client" -import { ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { @@ -17,6 +16,7 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import { useAuthStore } from "@/store/auth" import { useOrderStore } from "@/store/orders" import { useShopStore } from "@/store/shops" +import { ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react" export default function ShopIncomePage() { const userId = useAuthStore((state) => state.user?.id) diff --git a/app/(dashboard)/dashboard/shop/orders/page.tsx b/app/(dashboard)/dashboard/shop/orders/page.tsx index 18265c7..2a8cab6 100644 --- a/app/(dashboard)/dashboard/shop/orders/page.tsx +++ b/app/(dashboard)/dashboard/shop/orders/page.tsx @@ -1,7 +1,5 @@ "use client" -import { AlertCircle, CheckCircle, Clock, ListOrdered } from "lucide-react" -import Link from "next/link" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -19,6 +17,8 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import { useAuthStore } from "@/store/auth" import { useOrderStore } from "@/store/orders" import { useShopStore } from "@/store/shops" +import { AlertCircle, CheckCircle, Clock, ListOrdered } from "lucide-react" +import Link from "next/link" export default function ShopOrdersPage() { const userId = useAuthStore((state) => state.user?.id) diff --git a/app/(dashboard)/dashboard/shop/page.tsx b/app/(dashboard)/dashboard/shop/page.tsx index 98601bb..81d2983 100644 --- a/app/(dashboard)/dashboard/shop/page.tsx +++ b/app/(dashboard)/dashboard/shop/page.tsx @@ -1,8 +1,5 @@ "use client" -import { DollarSign, Edit, ExternalLink, ListOrdered, Star, Users } from "lucide-react" -import Link from "next/link" -import { useState } from "react" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -14,6 +11,9 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import type { Shop } from "@/lib/types" import { useAuthStore } from "@/store/auth" import { useShopStore } from "@/store/shops" +import { DollarSign, Edit, ExternalLink, ListOrdered, Star, Users } from "lucide-react" +import Link from "next/link" +import { useState } from "react" export default function ShopManagementPage() { const userId = useAuthStore((state) => state.user?.id) diff --git a/app/(dashboard)/dashboard/shop/rules/page.tsx b/app/(dashboard)/dashboard/shop/rules/page.tsx index 85f0ca5..6344e85 100644 --- a/app/(dashboard)/dashboard/shop/rules/page.tsx +++ b/app/(dashboard)/dashboard/shop/rules/page.tsx @@ -1,7 +1,5 @@ "use client" -import { Save } from "lucide-react" -import { useState } from "react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Input } from "@/components/ui/input" @@ -18,6 +16,8 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import type { Shop } from "@/lib/types" import { useAuthStore } from "@/store/auth" import { useShopStore } from "@/store/shops" +import { Save } from "lucide-react" +import { useState } from "react" export default function ShopRulesPage() { const userId = useAuthStore((state) => state.user?.id) diff --git a/app/(dashboard)/dashboard/shop/templates/page.tsx b/app/(dashboard)/dashboard/shop/templates/page.tsx index 03f2ace..95adcd3 100644 --- a/app/(dashboard)/dashboard/shop/templates/page.tsx +++ b/app/(dashboard)/dashboard/shop/templates/page.tsx @@ -1,8 +1,5 @@ "use client" -import { Eye, EyeOff, GripVertical } from "lucide-react" -import Link from "next/link" -import { type DragEvent, useEffect, useState } from "react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Switch } from "@/components/ui/switch" @@ -10,6 +7,9 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import type { Shop, ShopSection } from "@/lib/types" import { useAuthStore } from "@/store/auth" import { useShopStore } from "@/store/shops" +import { Eye, EyeOff, GripVertical } from "lucide-react" +import Link from "next/link" +import { type DragEvent, useEffect, useState } from "react" const sectionLabels: Record = { banner: "横幅图片", diff --git a/app/(main)/community/page.tsx b/app/(main)/community/page.tsx index 549d0f6..7592347 100644 --- a/app/(main)/community/page.tsx +++ b/app/(main)/community/page.tsx @@ -1,14 +1,14 @@ "use client" -import { ClipboardList, Heart, MessageCircle, PenSquare, Pin } from "lucide-react" -import Link from "next/link" -import { useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card" import { listGames, listOrders, listPlayers, listPosts } from "@/lib/api" import { roleLabels } from "@/lib/constants" +import { ClipboardList, Heart, MessageCircle, PenSquare, Pin } from "lucide-react" +import Link from "next/link" +import { useState } from "react" export default function CommunityPage() { const games = listGames() diff --git a/app/(main)/help/page.tsx b/app/(main)/help/page.tsx index 87429b4..9d71e7d 100644 --- a/app/(main)/help/page.tsx +++ b/app/(main)/help/page.tsx @@ -1,5 +1,5 @@ -import Link from "next/link" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import Link from "next/link" export default function HelpPage() { return ( diff --git a/app/(main)/page.tsx b/app/(main)/page.tsx index f10ee3a..cd64fcb 100644 --- a/app/(main)/page.tsx +++ b/app/(main)/page.tsx @@ -1,12 +1,12 @@ -import { ArrowRight, Search, ShoppingBag, Star } from "lucide-react" -import Link from "next/link" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" -import { Input } from "@/components/ui/input" import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +import { Input } from "@/components/ui/input" import { listGames, listPlayers, listShops } from "@/lib/api" import { GameIcon } from "@/lib/game-icons" +import { ArrowRight, Search, ShoppingBag, Star } from "lucide-react" +import Link from "next/link" export default function HomePage() { const games = listGames() diff --git a/app/(main)/player/[id]/page.tsx b/app/(main)/player/[id]/page.tsx index 727ded7..c5e06f4 100644 --- a/app/(main)/player/[id]/page.tsx +++ b/app/(main)/player/[id]/page.tsx @@ -1,6 +1,3 @@ -import { CheckCircle, Clock, MapPin, MessageSquare, ShoppingBag, Star } from "lucide-react" -import Link from "next/link" -import { notFound } from "next/navigation" import { FavoriteButton } from "@/components/favorite-button" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" @@ -16,6 +13,9 @@ import { import { Separator } from "@/components/ui/separator" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { listPlayers, listReviewsByTargetUser, listServicesByPlayer } from "@/lib/api" +import { CheckCircle, Clock, MapPin, MessageSquare, ShoppingBag, Star } from "lucide-react" +import Link from "next/link" +import { notFound } from "next/navigation" export default async function PlayerDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params diff --git a/app/(main)/post/[id]/page.tsx b/app/(main)/post/[id]/page.tsx index c432d5e..153fdfe 100644 --- a/app/(main)/post/[id]/page.tsx +++ b/app/(main)/post/[id]/page.tsx @@ -1,7 +1,3 @@ -import { ArrowLeft, Pin, Star } from "lucide-react" -import Image from "next/image" -import Link from "next/link" -import { notFound } from "next/navigation" import { PostCommentCount } from "@/components/post-comment-count" import { PostComments } from "@/components/post-comments" import { PostLikeButton } from "@/components/post-like-button" @@ -11,6 +7,10 @@ import { Card, CardContent, CardHeader } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { getOrderById, getPlayerById, getPostById } from "@/lib/api" import { roleLabels } from "@/lib/constants" +import { ArrowLeft, Pin, Star } from "lucide-react" +import Image from "next/image" +import Link from "next/link" +import { notFound } from "next/navigation" export default async function PostDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params diff --git a/app/(main)/post/new/page.tsx b/app/(main)/post/new/page.tsx index 02d657c..c9e2f85 100644 --- a/app/(main)/post/new/page.tsx +++ b/app/(main)/post/new/page.tsx @@ -1,12 +1,5 @@ "use client" -import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" -import { ArrowLeft, ImagePlus, X } from "lucide-react" -import Link from "next/link" -import { useRouter } from "next/navigation" -import { useState } from "react" -import { useForm } from "react-hook-form" -import { z } from "zod" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -24,6 +17,13 @@ import { useRequireAuth } from "@/lib/use-require-auth" import { useAuthStore } from "@/store/auth" import { useOrderStore } from "@/store/orders" import { usePostStore } from "@/store/posts" +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { ArrowLeft, ImagePlus, X } from "lucide-react" +import Link from "next/link" +import { useRouter } from "next/navigation" +import { useState } from "react" +import { useForm } from "react-hook-form" +import { z } from "zod" const postSchema = z.object({ title: z.string().min(2, "标题至少2个字符").max(50, "标题最多50个字符"), diff --git a/app/(main)/search/page.tsx b/app/(main)/search/page.tsx index bd43649..9b2f2f8 100644 --- a/app/(main)/search/page.tsx +++ b/app/(main)/search/page.tsx @@ -1,20 +1,5 @@ "use client" -import { - CheckCircle2, - Clock, - Filter, - Gamepad2, - Search, - SlidersHorizontal, - Star, - Store, - User, - XCircle, -} from "lucide-react" -import Link from "next/link" -import { useRouter, useSearchParams } from "next/navigation" -import { Suspense, useCallback, useEffect, useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" @@ -47,6 +32,21 @@ import { GameIcon } from "@/lib/game-icons" import type { SearchResponse, SearchResultItem, SearchSort } from "@/lib/search/types" import type { Game, Player } from "@/lib/types" import { cn } from "@/lib/utils" +import { + CheckCircle2, + Clock, + Filter, + Gamepad2, + Search, + SlidersHorizontal, + Star, + Store, + User, + XCircle, +} from "lucide-react" +import Link from "next/link" +import { useRouter, useSearchParams } from "next/navigation" +import { Suspense, useCallback, useEffect, useState } from "react" const SEARCH_SORTS: ReadonlySet = new Set([ "composite", diff --git a/app/(main)/shop/[id]/page.tsx b/app/(main)/shop/[id]/page.tsx index 740c7e5..299f5a1 100644 --- a/app/(main)/shop/[id]/page.tsx +++ b/app/(main)/shop/[id]/page.tsx @@ -1,7 +1,3 @@ -import { Gamepad2, Megaphone, ShoppingBag, Star, Users } from "lucide-react" -import Image from "next/image" -import Link from "next/link" -import { notFound } from "next/navigation" import { FavoriteButton } from "@/components/favorite-button" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" @@ -9,6 +5,10 @@ import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Separator } from "@/components/ui/separator" import { getShopById, listPlayersByShop, listReviews, listServices } from "@/lib/api" +import { Gamepad2, Megaphone, ShoppingBag, Star, Users } from "lucide-react" +import Image from "next/image" +import Link from "next/link" +import { notFound } from "next/navigation" interface PageProps { params: Promise<{ id: string }> diff --git a/app/(main)/terms/page.tsx b/app/(main)/terms/page.tsx index 1bf1f3d..9b18db7 100644 --- a/app/(main)/terms/page.tsx +++ b/app/(main)/terms/page.tsx @@ -1,5 +1,5 @@ -import Link from "next/link" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import Link from "next/link" export default function TermsPage() { return ( diff --git a/app/(main)/user/[id]/page.tsx b/app/(main)/user/[id]/page.tsx index 5e4095d..8dac74c 100644 --- a/app/(main)/user/[id]/page.tsx +++ b/app/(main)/user/[id]/page.tsx @@ -1,6 +1,3 @@ -import { MessageSquare, Star, ThumbsUp } from "lucide-react" -import Link from "next/link" -import { notFound } from "next/navigation" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -12,6 +9,9 @@ import { listPostsByAuthor, listShops, } from "@/lib/api" +import { MessageSquare, Star, ThumbsUp } from "lucide-react" +import Link from "next/link" +import { notFound } from "next/navigation" export default async function UserProfilePage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params diff --git a/app/(order)/chat/[id]/page.tsx b/app/(order)/chat/[id]/page.tsx index 347353f..6ec4d0d 100644 --- a/app/(order)/chat/[id]/page.tsx +++ b/app/(order)/chat/[id]/page.tsx @@ -1,9 +1,5 @@ "use client" -import { ArrowLeft, ImagePlus, Lock, Send } from "lucide-react" -import Image from "next/image" -import Link from "next/link" -import { use, useMemo, useRef, useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" @@ -11,10 +7,14 @@ import { Card } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { ScrollArea } from "@/components/ui/scroll-area" import { sendImageMessage, sendTextMessage } from "@/lib/api/chat" -import { cn } from "@/lib/utils" import { notifyInfo } from "@/lib/toast" +import { cn } from "@/lib/utils" import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" +import { ArrowLeft, ImagePlus, Lock, Send } from "lucide-react" +import Image from "next/image" +import Link from "next/link" +import { use, useMemo, useRef, useState } from "react" export default function ChatDetailPage({ params }: { params: Promise<{ id: string }> }) { const { id } = use(params) diff --git a/app/(order)/chat/page.tsx b/app/(order)/chat/page.tsx index e0c4e93..e57f867 100644 --- a/app/(order)/chat/page.tsx +++ b/app/(order)/chat/page.tsx @@ -1,12 +1,12 @@ "use client" -import { Lock, MessageSquare } from "lucide-react" -import Link from "next/link" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Card, CardContent } from "@/components/ui/card" import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" +import { Lock, MessageSquare } from "lucide-react" +import Link from "next/link" export default function ChatListPage() { const sessions = useChatStore((state) => state.sessions) diff --git a/app/(order)/dispute/[id]/page.tsx b/app/(order)/dispute/[id]/page.tsx index ca616f6..a420e2b 100644 --- a/app/(order)/dispute/[id]/page.tsx +++ b/app/(order)/dispute/[id]/page.tsx @@ -1,5 +1,17 @@ "use client" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Label } from "@/components/ui/label" +import { Separator } from "@/components/ui/separator" +import { Textarea } from "@/components/ui/textarea" +import { submitDispute, submitDisputeAppeal, submitDisputeResponse } from "@/lib/api/disputes" +import { DISPUTE_TO_RESOLVED_MS } from "@/lib/config/demo-timers" +import { notifyInfo } from "@/lib/toast" +import { useAuthStore } from "@/store/auth" +import { useDisputeStore } from "@/store/disputes" +import { useOrderStore } from "@/store/orders" import { AlertTriangle, ArrowLeft, Clock, FileText, Upload, X } from "lucide-react" import Image from "next/image" import Link from "next/link" @@ -13,18 +25,6 @@ import { useRef, useState, } from "react" -import { Badge } from "@/components/ui/badge" -import { Button } from "@/components/ui/button" -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { submitDispute, submitDisputeAppeal, submitDisputeResponse } from "@/lib/api/disputes" -import { DISPUTE_TO_RESOLVED_MS } from "@/lib/config/demo-timers" -import { notifyInfo } from "@/lib/toast" -import { Label } from "@/components/ui/label" -import { Separator } from "@/components/ui/separator" -import { Textarea } from "@/components/ui/textarea" -import { useAuthStore } from "@/store/auth" -import { useDisputeStore } from "@/store/disputes" -import { useOrderStore } from "@/store/orders" const disputeStatusLabels: Record = { open: "已提交", diff --git a/app/(order)/layout.tsx b/app/(order)/layout.tsx index f7f230f..a9f68a8 100644 --- a/app/(order)/layout.tsx +++ b/app/(order)/layout.tsx @@ -1,8 +1,8 @@ "use client" -import { usePathname } from "next/navigation" import { AuthGuard } from "@/components/auth-guard" import { Header } from "@/components/header" +import { usePathname } from "next/navigation" export default function OrderLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname() diff --git a/app/(order)/order/[id]/page.tsx b/app/(order)/order/[id]/page.tsx index f9ade78..154a1a8 100644 --- a/app/(order)/order/[id]/page.tsx +++ b/app/(order)/order/[id]/page.tsx @@ -1,18 +1,18 @@ "use client" -import { ArrowLeft, CheckCircle, Clock, Star } from "lucide-react" -import Link from "next/link" -import { use, useEffect, useMemo, useState } from "react" import OrderActions from "@/components/order-actions" import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { ORDER_ACCEPT_TIMEOUT_MS, ORDER_CLOSE_TIMEOUT_MS } from "@/lib/config/demo-timers" import { Separator } from "@/components/ui/separator" +import { ORDER_ACCEPT_TIMEOUT_MS, ORDER_CLOSE_TIMEOUT_MS } from "@/lib/config/demo-timers" import { statusLabels } from "@/lib/constants" import type { OrderStatus } from "@/lib/types" import { useChatStore } from "@/store/chat" import { useOrderStore } from "@/store/orders" import { useReviewStore } from "@/store/reviews" +import { ArrowLeft, CheckCircle, Clock, Star } from "lucide-react" +import Link from "next/link" +import { use, useEffect, useMemo, useState } from "react" const normalStatusSteps: OrderStatus[] = [ "pending_payment", diff --git a/app/(order)/order/new/page.tsx b/app/(order)/order/new/page.tsx index 25f6290..a9effaa 100644 --- a/app/(order)/order/new/page.tsx +++ b/app/(order)/order/new/page.tsx @@ -1,9 +1,5 @@ "use client" -import { ArrowLeft, CheckCircle, CreditCard, ShieldCheck } from "lucide-react" -import Link from "next/link" -import { useRouter, useSearchParams } from "next/navigation" -import { useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -18,6 +14,10 @@ import { useRequireAuth } from "@/lib/use-require-auth" import { useAuthStore } from "@/store/auth" import { useOrderStore } from "@/store/orders" import { useWalletStore } from "@/store/wallet" +import { ArrowLeft, CheckCircle, CreditCard, ShieldCheck } from "lucide-react" +import Link from "next/link" +import { useRouter, useSearchParams } from "next/navigation" +import { useState } from "react" export default function NewOrderPage() { const router = useRouter() diff --git a/app/(order)/orders/page.tsx b/app/(order)/orders/page.tsx index e8c9d9d..c211fc3 100644 --- a/app/(order)/orders/page.tsx +++ b/app/(order)/orders/page.tsx @@ -1,8 +1,5 @@ "use client" -import { Clock, MessageSquare, RefreshCw } from "lucide-react" -import Link from "next/link" -import { useState } from "react" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" @@ -21,6 +18,9 @@ import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" import { useOrderStore } from "@/store/orders" import { useShopStore } from "@/store/shops" +import { Clock, MessageSquare, RefreshCw } from "lucide-react" +import Link from "next/link" +import { useState } from "react" const statusColors: Record = { pending_payment: "bg-yellow-100 text-yellow-800", diff --git a/app/(order)/review/[id]/page.tsx b/app/(order)/review/[id]/page.tsx index ed7fcd9..2ae801e 100644 --- a/app/(order)/review/[id]/page.tsx +++ b/app/(order)/review/[id]/page.tsx @@ -1,8 +1,5 @@ "use client" -import { ArrowLeft, Lock, Star } from "lucide-react" -import Link from "next/link" -import { use, useMemo, useState } from "react" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Label } from "@/components/ui/label" @@ -12,6 +9,9 @@ import { notifyInfo, notifySuccess } from "@/lib/toast" import { useAuthStore } from "@/store/auth" import { useOrderStore } from "@/store/orders" import { useReviewStore } from "@/store/reviews" +import { ArrowLeft, Lock, Star } from "lucide-react" +import Link from "next/link" +import { use, useMemo, useState } from "react" export default function ReviewPage({ params }: { params: Promise<{ id: string }> }) { const { id } = use(params) diff --git a/app/api/search/route.ts b/app/api/search/route.ts index 3b33dcb..bf83825 100644 --- a/app/api/search/route.ts +++ b/app/api/search/route.ts @@ -1,7 +1,7 @@ -import { NextResponse } from "next/server" import { mockPlayers, mockServices, mockShops } from "@/lib/mock" import { searchCatalog } from "@/lib/search/search-catalog" import type { SearchSort } from "@/lib/search/types" +import { NextResponse } from "next/server" export const dynamic = "force-dynamic" diff --git a/app/layout.tsx b/app/layout.tsx index 9e5921c..a28a453 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,7 +1,7 @@ import type { Metadata } from "next" import { Geist, Geist_Mono } from "next/font/google" -import { Providers } from "./providers" import "./globals.css" +import { Providers } from "./providers" const geistSans = Geist({ variable: "--font-geist-sans", diff --git a/app/providers.tsx b/app/providers.tsx index df28850..cf92b5f 100644 --- a/app/providers.tsx +++ b/app/providers.tsx @@ -1,10 +1,10 @@ "use client" +import { GlobalLoginDialog } from "@/components/global-login-dialog" +import { TooltipProvider } from "@/components/ui/tooltip" import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import { useState } from "react" import { Toaster } from "sonner" -import { GlobalLoginDialog } from "@/components/global-login-dialog" -import { TooltipProvider } from "@/components/ui/tooltip" export function Providers({ children }: { children: React.ReactNode }) { const [queryClient] = useState( diff --git a/components/account-sidebar.tsx b/components/account-sidebar.tsx index f25c9fa..25d2f5b 100644 --- a/components/account-sidebar.tsx +++ b/components/account-sidebar.tsx @@ -1,10 +1,10 @@ "use client" +import { Button } from "@/components/ui/button" +import { cn } from "@/lib/utils" import { Bell, CreditCard, Settings, ShieldCheck } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" -import { Button } from "@/components/ui/button" -import { cn } from "@/lib/utils" const links = [ { href: "/settings", label: "个人设置", icon: Settings }, diff --git a/components/auth-guard.tsx b/components/auth-guard.tsx index 6c35d15..8aa9c67 100644 --- a/components/auth-guard.tsx +++ b/components/auth-guard.tsx @@ -1,9 +1,9 @@ "use client" -import { useEffect, useRef } from "react" import { Button } from "@/components/ui/button" import { useAuthStore } from "@/store/auth" import { useLoginDialogStore } from "@/store/login-dialog" +import { useEffect, useRef } from "react" interface AuthGuardProps { children: React.ReactNode diff --git a/components/dashboard-sidebar.tsx b/components/dashboard-sidebar.tsx index 5d06cd9..902348d 100644 --- a/components/dashboard-sidebar.tsx +++ b/components/dashboard-sidebar.tsx @@ -1,5 +1,8 @@ "use client" +import { Button } from "@/components/ui/button" +import { cn } from "@/lib/utils" +import { useAuthStore } from "@/store/auth" import { ClipboardList, Gamepad2, @@ -13,9 +16,6 @@ import { } from "lucide-react" import Link from "next/link" import { usePathname } from "next/navigation" -import { Button } from "@/components/ui/button" -import { cn } from "@/lib/utils" -import { useAuthStore } from "@/store/auth" export const playerLinks = [ { href: "/dashboard", label: "概览", icon: LayoutDashboard }, diff --git a/components/favorite-button.tsx b/components/favorite-button.tsx index e08ec9b..1d8ad09 100644 --- a/components/favorite-button.tsx +++ b/components/favorite-button.tsx @@ -1,10 +1,10 @@ "use client" -import { Heart } from "lucide-react" import { Button } from "@/components/ui/button" import { useRequireAuth } from "@/lib/use-require-auth" import { useAuthStore } from "@/store/auth" import { useFavoriteStore } from "@/store/favorites" +import { Heart } from "lucide-react" interface FavoriteButtonProps { initialFavorited: boolean diff --git a/components/header.tsx b/components/header.tsx index 0ec82ca..b5e8008 100644 --- a/components/header.tsx +++ b/components/header.tsx @@ -1,19 +1,5 @@ "use client" -import { - Bell, - Gamepad2, - LogOut, - Menu, - MessageSquare, - Settings, - ShoppingBag, - User, - Wallet, -} from "lucide-react" -import Link from "next/link" -import { usePathname, useRouter } from "next/navigation" -import { useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" @@ -32,6 +18,20 @@ import { cn } from "@/lib/utils" import { useAuthStore } from "@/store/auth" import { useNotificationStore } from "@/store/notifications" import { useShopStore } from "@/store/shops" +import { + Bell, + Gamepad2, + LogOut, + Menu, + MessageSquare, + Settings, + ShoppingBag, + User, + Wallet, +} from "lucide-react" +import Link from "next/link" +import { usePathname, useRouter } from "next/navigation" +import { useState } from "react" import { canAccessDashboard } from "@/components/role-guard" diff --git a/components/login-dialog.tsx b/components/login-dialog.tsx index 7ce9fe3..d76e0c1 100644 --- a/components/login-dialog.tsx +++ b/components/login-dialog.tsx @@ -1,9 +1,5 @@ "use client" -import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" -import { useRouter } from "next/navigation" -import { useForm } from "react-hook-form" -import { z } from "zod" import { Button } from "@/components/ui/button" import { Dialog, @@ -17,6 +13,10 @@ import { Label } from "@/components/ui/label" import { getCurrentUserForLogin } from "@/lib/api" import { useAuthStore } from "@/store/auth" import { useLoginDialogStore } from "@/store/login-dialog" +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { useRouter } from "next/navigation" +import { useForm } from "react-hook-form" +import { z } from "zod" const loginSchema = z.object({ phone: z.string().min(11, "请输入正确的手机号"), diff --git a/components/order-actions.tsx b/components/order-actions.tsx index af354e7..a0dc6a6 100644 --- a/components/order-actions.tsx +++ b/components/order-actions.tsx @@ -1,16 +1,5 @@ "use client" -import { - AlertTriangle, - CheckCircle2, - Clock, - MessageSquare, - RefreshCw, - Star, - XCircle, -} from "lucide-react" -import Link from "next/link" -import { useCallback } from "react" import { Button } from "@/components/ui/button" import { acceptOrder, @@ -25,6 +14,17 @@ import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" import { useOrderStore } from "@/store/orders" import { useShopStore } from "@/store/shops" +import { + AlertTriangle, + CheckCircle2, + Clock, + MessageSquare, + RefreshCw, + Star, + XCircle, +} from "lucide-react" +import Link from "next/link" +import { useCallback } from "react" interface OrderActionsProps { orderId: string diff --git a/components/post-comment-count.tsx b/components/post-comment-count.tsx index 0d6e28f..fdd63c6 100644 --- a/components/post-comment-count.tsx +++ b/components/post-comment-count.tsx @@ -1,7 +1,7 @@ "use client" -import { MessageCircle } from "lucide-react" import { useCommentStore } from "@/store/comments" +import { MessageCircle } from "lucide-react" interface PostCommentCountProps { postId: string diff --git a/components/post-comments.tsx b/components/post-comments.tsx index 4e03d17..bd0a476 100644 --- a/components/post-comments.tsx +++ b/components/post-comments.tsx @@ -1,10 +1,10 @@ "use client" -import { Heart } from "lucide-react" -import { useMemo, useState } from "react" import { addComment, toggleCommentLike } from "@/lib/api/comments" import { useRequireAuth } from "@/lib/use-require-auth" import { useCommentStore } from "@/store/comments" +import { Heart } from "lucide-react" +import { useMemo, useState } from "react" import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar" import { Button } from "./ui/button" import { Textarea } from "./ui/textarea" diff --git a/components/post-like-button.tsx b/components/post-like-button.tsx index efd7345..99d21aa 100644 --- a/components/post-like-button.tsx +++ b/components/post-like-button.tsx @@ -1,9 +1,9 @@ "use client" -import { Heart } from "lucide-react" import { togglePostLike } from "@/lib/api/posts" import { useRequireAuth } from "@/lib/use-require-auth" import { usePostStore } from "@/store/posts" +import { Heart } from "lucide-react" interface PostLikeButtonProps { postId: string diff --git a/components/role-guard.tsx b/components/role-guard.tsx index 815653c..75e463e 100644 --- a/components/role-guard.tsx +++ b/components/role-guard.tsx @@ -1,10 +1,10 @@ "use client" -import { usePathname, useRouter } from "next/navigation" -import { useEffect } from "react" import { ownerLinks, playerLinks } from "@/components/dashboard-sidebar" import type { UserRole } from "@/lib/types" import { useAuthStore } from "@/store/auth" +import { usePathname, useRouter } from "next/navigation" +import { useEffect } from "react" const dashboardRoutes: Record = { player: playerLinks, diff --git a/components/ui/avatar.tsx b/components/ui/avatar.tsx index 398813c..9e7f133 100644 --- a/components/ui/avatar.tsx +++ b/components/ui/avatar.tsx @@ -93,4 +93,4 @@ function AvatarGroupCount({ className, ...props }: React.ComponentProps<"div">) ) } -export { Avatar, AvatarImage, AvatarFallback, AvatarBadge, AvatarGroup, AvatarGroupCount } +export { Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage } diff --git a/components/ui/card.tsx b/components/ui/card.tsx index 0ab2c15..83b49b9 100644 --- a/components/ui/card.tsx +++ b/components/ui/card.tsx @@ -72,4 +72,4 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) { ) } -export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent } +export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } diff --git a/components/ui/command.tsx b/components/ui/command.tsx index ccc68ef..f4ec867 100644 --- a/components/ui/command.tsx +++ b/components/ui/command.tsx @@ -1,8 +1,5 @@ "use client" -import { Command as CommandPrimitive } from "cmdk" -import { SearchIcon } from "lucide-react" -import type * as React from "react" import { Dialog, DialogContent, @@ -11,6 +8,9 @@ import { DialogTitle, } from "@/components/ui/dialog" import { cn } from "@/lib/utils" +import { Command as CommandPrimitive } from "cmdk" +import { SearchIcon } from "lucide-react" +import type * as React from "react" function Command({ className, ...props }: React.ComponentProps) { return ( @@ -150,11 +150,11 @@ function CommandShortcut({ className, ...props }: React.ComponentProps<"span">) export { Command, CommandDialog, - CommandInput, - CommandList, CommandEmpty, CommandGroup, + CommandInput, CommandItem, - CommandShortcut, + CommandList, CommandSeparator, + CommandShortcut, } diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 2be0233..7c7eaad 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -1,10 +1,10 @@ "use client" +import { Button } from "@/components/ui/button" +import { cn } from "@/lib/utils" import { XIcon } from "lucide-react" import { Dialog as DialogPrimitive } from "radix-ui" import type * as React from "react" -import { Button } from "@/components/ui/button" -import { cn } from "@/lib/utils" function Dialog({ ...props }: React.ComponentProps) { return diff --git a/components/ui/dropdown-menu.tsx b/components/ui/dropdown-menu.tsx index 88c5e00..3a7a889 100644 --- a/components/ui/dropdown-menu.tsx +++ b/components/ui/dropdown-menu.tsx @@ -211,18 +211,18 @@ function DropdownMenuSubContent({ export { DropdownMenu, - DropdownMenuPortal, - DropdownMenuTrigger, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, - DropdownMenuLabel, DropdownMenuItem, - DropdownMenuCheckboxItem, + DropdownMenuLabel, + DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, - DropdownMenuSubTrigger, DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuTrigger, } diff --git a/components/ui/form.tsx b/components/ui/form.tsx index 4919c1f..145cc13 100644 --- a/components/ui/form.tsx +++ b/components/ui/form.tsx @@ -1,5 +1,7 @@ "use client" +import { Label } from "@/components/ui/label" +import { cn } from "@/lib/utils" import type { Label as LabelPrimitive } from "radix-ui" import { Slot } from "radix-ui" import * as React from "react" @@ -12,8 +14,6 @@ import { useFormContext, useFormState, } from "react-hook-form" -import { Label } from "@/components/ui/label" -import { cn } from "@/lib/utils" const Form = FormProvider @@ -140,12 +140,12 @@ function FormMessage({ className, ...props }: React.ComponentProps<"p">) { } export { - useFormField, Form, - FormItem, - FormLabel, FormControl, FormDescription, - FormMessage, FormField, + FormItem, + FormLabel, + FormMessage, + useFormField, } diff --git a/components/ui/popover.tsx b/components/ui/popover.tsx index eba6048..2f6f053 100644 --- a/components/ui/popover.tsx +++ b/components/ui/popover.tsx @@ -65,10 +65,10 @@ function PopoverDescription({ className, ...props }: React.ComponentProps<"p">) export { Popover, - PopoverTrigger, - PopoverContent, PopoverAnchor, + PopoverContent, + PopoverDescription, PopoverHeader, PopoverTitle, - PopoverDescription, + PopoverTrigger, } diff --git a/components/ui/sheet.tsx b/components/ui/sheet.tsx index f754123..6f494b8 100644 --- a/components/ui/sheet.tsx +++ b/components/ui/sheet.tsx @@ -124,11 +124,11 @@ function SheetDescription({ export { Sheet, - SheetTrigger, SheetClose, SheetContent, - SheetHeader, - SheetFooter, - SheetTitle, SheetDescription, + SheetFooter, + SheetHeader, + SheetTitle, + SheetTrigger, } diff --git a/components/ui/table.tsx b/components/ui/table.tsx index dad1983..fbb420c 100644 --- a/components/ui/table.tsx +++ b/components/ui/table.tsx @@ -89,4 +89,4 @@ function TableCaption({ className, ...props }: React.ComponentProps<"caption">) ) } -export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption } +export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } diff --git a/components/ui/tabs.tsx b/components/ui/tabs.tsx index a825d41..95cb4f9 100644 --- a/components/ui/tabs.tsx +++ b/components/ui/tabs.tsx @@ -78,4 +78,4 @@ function TabsContent({ className, ...props }: React.ComponentProps s.isAuthenticated) diff --git a/package.json b/package.json index a8ec5d4..9c33c9e 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "eslint-config-prettier": "^10.1.8", "eslint-plugin-react-hooks": "^7.0.1", "prettier": "^3.8.1", + "prettier-plugin-organize-imports": "^4.3.0", "shadcn": "^3.8.5", "tailwindcss": "^4", "tw-animate-css": "^1.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 457f552..6b6e343 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -90,6 +90,9 @@ importers: prettier: specifier: ^3.8.1 version: 3.8.1 + prettier-plugin-organize-imports: + specifier: ^4.3.0 + version: 4.3.0(prettier@3.8.1)(typescript@5.9.3) shadcn: specifier: ^3.8.5 version: 3.8.5(@types/node@20.19.33)(typescript@5.9.3) @@ -3516,6 +3519,16 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} + prettier-plugin-organize-imports@4.3.0: + resolution: {integrity: sha512-FxFz0qFhyBsGdIsb697f/EkvHzi5SZOhWAjxcx2dLt+Q532bAlhswcXGYB1yzjZ69kW8UoadFBw7TyNwlq96Iw==} + peerDependencies: + prettier: '>=2.0' + typescript: '>=2.9' + vue-tsc: ^2.1.0 || 3 + peerDependenciesMeta: + vue-tsc: + optional: true + prettier@3.8.1: resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} engines: {node: '>=14'} @@ -7734,6 +7747,11 @@ snapshots: prelude-ls@1.2.1: {} + prettier-plugin-organize-imports@4.3.0(prettier@3.8.1)(typescript@5.9.3): + dependencies: + prettier: 3.8.1 + typescript: 5.9.3 + prettier@3.8.1: {} pretty-ms@9.3.0: diff --git a/store/auth.ts b/store/auth.ts index a712ca5..c023553 100644 --- a/store/auth.ts +++ b/store/auth.ts @@ -1,5 +1,5 @@ -import { create } from "zustand" import type { User, UserRole, VerificationStatus } from "@/lib/types" +import { create } from "zustand" interface NotificationPrefs { order: boolean diff --git a/store/chat.ts b/store/chat.ts index e4f1aed..d48b488 100644 --- a/store/chat.ts +++ b/store/chat.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockChatMessages, mockChatSessions, mockUsers } from "@/lib/mock" import type { ChatMessage, ChatSession, Order } from "@/lib/types" +import { create } from "zustand" interface ChatState { sessions: ChatSession[] diff --git a/store/comments.ts b/store/comments.ts index 72b4af2..ddfad4d 100644 --- a/store/comments.ts +++ b/store/comments.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockComments } from "@/lib/mock" import type { Comment, User } from "@/lib/types" +import { create } from "zustand" interface CommentState { comments: Comment[] diff --git a/store/disputes.ts b/store/disputes.ts index 042230e..f622521 100644 --- a/store/disputes.ts +++ b/store/disputes.ts @@ -1,14 +1,14 @@ -import { create } from "zustand" import { DISPUTE_TO_RESOLVED_MS, DISPUTE_TO_REVIEWING_MS } from "@/lib/config/demo-timers" import { generateId } from "@/lib/id" -import { allow, deny } from "@/lib/policy/assert" -import type { Actor } from "@/lib/policy/actor" -import type { PolicyDecision } from "@/lib/policy/decision" import { mockDisputes } from "@/lib/mock" +import type { Actor } from "@/lib/policy/actor" +import { allow, deny } from "@/lib/policy/assert" +import type { PolicyDecision } from "@/lib/policy/decision" import type { Dispute } from "@/lib/types" import { useAuthStore } from "@/store/auth" import { useNotificationStore } from "@/store/notifications" import { useOrderStore } from "@/store/orders" +import { create } from "zustand" type DisputeTimelineType = "created" | "response" | "reviewing" | "resolved" | "appealed" diff --git a/store/favorites.ts b/store/favorites.ts index 77dee7e..d39227c 100644 --- a/store/favorites.ts +++ b/store/favorites.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockFavorites } from "@/lib/mock" import type { Favorite } from "@/lib/types" +import { create } from "zustand" interface FavoriteState { favorites: Favorite[] diff --git a/store/notifications.ts b/store/notifications.ts index 9b354af..11a980b 100644 --- a/store/notifications.ts +++ b/store/notifications.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockNotifications } from "@/lib/mock" import type { Notification } from "@/lib/types" +import { create } from "zustand" interface CreateNotificationInput { type: Notification["type"] diff --git a/store/orders.ts b/store/orders.ts index 1aa7448..08b9e0a 100644 --- a/store/orders.ts +++ b/store/orders.ts @@ -1,4 +1,3 @@ -import { create } from "zustand" import { ORDER_ACCEPT_TIMEOUT_MS, ORDER_CLOSE_TIMEOUT_MS, @@ -6,16 +5,17 @@ import { } from "@/lib/config/demo-timers" import { evaluateOrderTransition, type OrderAction } from "@/lib/domain/order-machine" import { generateId } from "@/lib/id" -import { allow, deny } from "@/lib/policy/assert" -import type { Actor } from "@/lib/policy/actor" -import type { PolicyDecision } from "@/lib/policy/decision" import { mockOrders } from "@/lib/mock" +import type { Actor } from "@/lib/policy/actor" +import { allow, deny } from "@/lib/policy/assert" +import type { PolicyDecision } from "@/lib/policy/decision" import type { Order, OrderStatus, PlayerService } from "@/lib/types" import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" import { useNotificationStore } from "@/store/notifications" -import { useWalletStore } from "@/store/wallet" import { useShopStore } from "@/store/shops" +import { useWalletStore } from "@/store/wallet" +import { create } from "zustand" interface CreateOrderInput { consumerId: string diff --git a/store/player-status.ts b/store/player-status.ts index c18fcfe..1473238 100644 --- a/store/player-status.ts +++ b/store/player-status.ts @@ -1,5 +1,5 @@ -import { create } from "zustand" import type { Player } from "@/lib/types" +import { create } from "zustand" type PlayerStatus = Player["status"] diff --git a/store/players.ts b/store/players.ts index f22c7e5..9d3f714 100644 --- a/store/players.ts +++ b/store/players.ts @@ -1,6 +1,6 @@ -import { create } from "zustand" import { mockPlayers } from "@/lib/mock" import type { Player } from "@/lib/types" +import { create } from "zustand" interface PlayerState { players: Player[] diff --git a/store/posts.ts b/store/posts.ts index b414383..e08c45b 100644 --- a/store/posts.ts +++ b/store/posts.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockPosts } from "@/lib/mock" import type { Post, User, UserRole } from "@/lib/types" +import { create } from "zustand" interface CreatePostInput { author: User diff --git a/store/reviews.ts b/store/reviews.ts index f97efc0..5e926dc 100644 --- a/store/reviews.ts +++ b/store/reviews.ts @@ -1,10 +1,10 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" +import { mockReviews, mockUsers } from "@/lib/mock" import { allow, deny } from "@/lib/policy/assert" import type { PolicyDecision } from "@/lib/policy/decision" -import { mockReviews, mockUsers } from "@/lib/mock" import type { Review } from "@/lib/types" import { useOrderStore } from "@/store/orders" +import { create } from "zustand" interface SubmitReviewInput { orderId: string diff --git a/store/services.ts b/store/services.ts index f0be479..d841e78 100644 --- a/store/services.ts +++ b/store/services.ts @@ -1,7 +1,7 @@ -import { create } from "zustand" import { generateId } from "@/lib/id" import { mockServices } from "@/lib/mock" import type { PlayerService } from "@/lib/types" +import { create } from "zustand" interface ServiceState { services: PlayerService[] diff --git a/store/shops.ts b/store/shops.ts index b05289a..d5f7b9e 100644 --- a/store/shops.ts +++ b/store/shops.ts @@ -1,6 +1,6 @@ -import { create } from "zustand" import { mockShops } from "@/lib/mock" import type { Shop, ShopSection } from "@/lib/types" +import { create } from "zustand" interface ShopState { shops: Shop[] diff --git a/store/wallet.ts b/store/wallet.ts index 8882e64..3a111f1 100644 --- a/store/wallet.ts +++ b/store/wallet.ts @@ -1,9 +1,9 @@ -import { create } from "zustand" import { calculateOrderIncome } from "@/lib/domain/income" import { generateId } from "@/lib/id" import { mockTransactions, walletBalance } from "@/lib/mock" -import { useShopStore } from "@/store/shops" import type { WalletTransaction } from "@/lib/types" +import { useShopStore } from "@/store/shops" +import { create } from "zustand" interface WalletState { balance: number diff --git a/tests/income-calculation.test.ts b/tests/income-calculation.test.ts index 6a002a6..11cf0af 100644 --- a/tests/income-calculation.test.ts +++ b/tests/income-calculation.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest" import { calculateOrderIncome } from "@/lib/domain/income" +import { describe, expect, it } from "vitest" describe("calculateOrderIncome", () => { it("calculates percentage commission income", () => { diff --git a/tests/order-machine.test.ts b/tests/order-machine.test.ts index 6b76a79..0dcd263 100644 --- a/tests/order-machine.test.ts +++ b/tests/order-machine.test.ts @@ -1,7 +1,7 @@ -import { describe, expect, it } from "vitest" import { evaluateOrderTransition } from "@/lib/domain/order-machine" import type { Actor } from "@/lib/policy/actor" import type { UserRole } from "@/lib/types" +import { describe, expect, it } from "vitest" function actor(role: UserRole, userId = "u1"): Actor { return { role, userId } diff --git a/tests/policy-decision.test.ts b/tests/policy-decision.test.ts index 1ab1a47..63b8084 100644 --- a/tests/policy-decision.test.ts +++ b/tests/policy-decision.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest" import { allow, deny, requireAuth } from "@/lib/policy/assert" +import { describe, expect, it } from "vitest" describe("policy decision helpers", () => { it("returns ok for allow", () => { diff --git a/tests/search-catalog.test.ts b/tests/search-catalog.test.ts index 7f6f00f..9664245 100644 --- a/tests/search-catalog.test.ts +++ b/tests/search-catalog.test.ts @@ -1,9 +1,9 @@ -import { describe, expect, it } from "vitest" -import { searchCatalog } from "@/lib/search/search-catalog" import { mockPlayers } from "@/lib/mock/players" -import { mockShops } from "@/lib/mock/shops" import { mockServices } from "@/lib/mock/services" +import { mockShops } from "@/lib/mock/shops" import type { SearchCatalogData } from "@/lib/search/search-catalog" +import { searchCatalog } from "@/lib/search/search-catalog" +import { describe, expect, it } from "vitest" const data: SearchCatalogData = { players: mockPlayers, diff --git a/tests/search-route.test.ts b/tests/search-route.test.ts index ddb70be..21d93ac 100644 --- a/tests/search-route.test.ts +++ b/tests/search-route.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, it } from "vitest" import { GET } from "@/app/api/search/route" +import { describe, expect, it } from "vitest" describe("GET /api/search", () => { it("returns 200 with items and meta", async () => {