chore(format): add prettier-plugin-organize-imports and sort imports

This commit is contained in:
zetaloop
2026-02-25 15:34:33 +08:00
parent d4a0765cad
commit 2d42473910
88 changed files with 266 additions and 246 deletions
+2 -1
View File
@@ -3,5 +3,6 @@
"singleQuote": false, "singleQuote": false,
"tabWidth": 2, "tabWidth": 2,
"printWidth": 100, "printWidth": 100,
"trailingComma": "all" "trailingComma": "all",
"plugins": ["prettier-plugin-organize-imports"]
} }
+2 -2
View File
@@ -1,13 +1,13 @@
"use client" "use client"
import { Bell, CheckCheck, MessageSquare, ShoppingBag } from "lucide-react"
import Link from "next/link"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import type { Notification } from "@/lib/types" import type { Notification } from "@/lib/types"
import { useNotificationStore } from "@/store/notifications" import { useNotificationStore } from "@/store/notifications"
import { Bell, CheckCheck, MessageSquare, ShoppingBag } from "lucide-react"
import Link from "next/link"
const typeIcons: Record<Notification["type"], typeof Bell> = { const typeIcons: Record<Notification["type"], typeof Bell> = {
order: ShoppingBag, order: ShoppingBag,
+3 -3
View File
@@ -1,8 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { notifySuccess } from "@/lib/toast"
import type { UserRole } from "@/lib/types" import type { UserRole } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { Camera } from "lucide-react"
import Link from "next/link"
import { useRef, useState } from "react"
export default function SettingsPage() { export default function SettingsPage() {
const { const {
+2 -2
View File
@@ -1,7 +1,5 @@
"use client" "use client"
import { CheckCircle, Clock, ShieldCheck, Upload } from "lucide-react"
import { useEffect, useRef, useState } from "react"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { Textarea } from "@/components/ui/textarea"
import type { UserRole } from "@/lib/types" import type { UserRole } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { CheckCircle, Clock, ShieldCheck, Upload } from "lucide-react"
import { useEffect, useRef, useState } from "react"
export default function VerifyPage() { export default function VerifyPage() {
const [verifyRole, setVerifyRole] = useState<UserRole | "">("") const [verifyRole, setVerifyRole] = useState<UserRole | "">("")
+8 -8
View File
@@ -1,5 +1,13 @@
"use client" "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 { import {
ArrowDownLeft, ArrowDownLeft,
ArrowUpRight, ArrowUpRight,
@@ -9,14 +17,6 @@ import {
Wallet, Wallet,
} from "lucide-react" } from "lucide-react"
import { useState } from "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<string, string> = { const typeLabels: Record<string, string> = {
topup: "充值", topup: "充值",
+6 -6
View File
@@ -1,17 +1,17 @@
"use client" "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 { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label" import { Label } from "@/components/ui/label"
import { getCurrentUserForLogin } from "@/lib/api" import { getCurrentUserForLogin } from "@/lib/api"
import { useAuthStore } from "@/store/auth" 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({ const loginSchema = z.object({
phone: z.string().min(11, "请输入正确的手机号"), phone: z.string().min(11, "请输入正确的手机号"),
+6 -6
View File
@@ -1,17 +1,17 @@
"use client" "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 { Button } from "@/components/ui/button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label" import { Label } from "@/components/ui/label"
import { getCurrentUserForLogin } from "@/lib/api" import { getCurrentUserForLogin } from "@/lib/api"
import { useAuthStore } from "@/store/auth" 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 const registerSchema = z
.object({ .object({
+2 -2
View File
@@ -1,7 +1,5 @@
"use client" "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 { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { listOrders, listPlayers, listServices, listShops } from "@/lib/api"
import { statusLabels } from "@/lib/constants" import { statusLabels } from "@/lib/constants"
import { useAuthStore } from "@/store/auth" 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() { export default function DashboardPage() {
const { currentRole } = useAuthStore() const { currentRole } = useAuthStore()
@@ -1,12 +1,5 @@
"use client" "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 { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
@@ -27,6 +20,13 @@ import { useAuthStore } from "@/store/auth"
import { usePlayerStore } from "@/store/players" import { usePlayerStore } from "@/store/players"
import { useServiceStore } from "@/store/services" import { useServiceStore } from "@/store/services"
import { useShopStore } from "@/store/shops" 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({ const serviceSchema = z.object({
gameId: z.string().min(1, "请选择游戏"), gameId: z.string().min(1, "请选择游戏"),
+2 -2
View File
@@ -1,7 +1,5 @@
"use client" "use client"
import { Edit, Plus, Trash2 } from "lucide-react"
import Link from "next/link"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
@@ -18,6 +16,8 @@ import { useAuthStore } from "@/store/auth"
import { usePlayerStore } from "@/store/players" import { usePlayerStore } from "@/store/players"
import { useServiceStore } from "@/store/services" import { useServiceStore } from "@/store/services"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { Edit, Plus, Trash2 } from "lucide-react"
import Link from "next/link"
export default function ServicesPage() { export default function ServicesPage() {
const userId = useAuthStore((state) => state.user?.id) const userId = useAuthStore((state) => state.user?.id)
@@ -1,8 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
@@ -26,6 +23,9 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { usePlayerStore } from "@/store/players" import { usePlayerStore } from "@/store/players"
import { useShopStore } from "@/store/shops" 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<string, string> = { const statusLabels: Record<string, string> = {
available: "在线", available: "在线",
@@ -1,6 +1,5 @@
"use client" "use client"
import { ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { import {
@@ -17,6 +16,7 @@ import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react"
export default function ShopIncomePage() { export default function ShopIncomePage() {
const userId = useAuthStore((state) => state.user?.id) const userId = useAuthStore((state) => state.user?.id)
@@ -1,7 +1,5 @@
"use client" "use client"
import { AlertCircle, CheckCircle, Clock, ListOrdered } from "lucide-react"
import Link from "next/link"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { AlertCircle, CheckCircle, Clock, ListOrdered } from "lucide-react"
import Link from "next/link"
export default function ShopOrdersPage() { export default function ShopOrdersPage() {
const userId = useAuthStore((state) => state.user?.id) const userId = useAuthStore((state) => state.user?.id)
+3 -3
View File
@@ -1,8 +1,5 @@
"use client" "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 { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 type { Shop } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useShopStore } from "@/store/shops" 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() { export default function ShopManagementPage() {
const userId = useAuthStore((state) => state.user?.id) const userId = useAuthStore((state) => state.user?.id)
@@ -1,7 +1,5 @@
"use client" "use client"
import { Save } from "lucide-react"
import { useState } from "react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input" 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 type { Shop } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { Save } from "lucide-react"
import { useState } from "react"
export default function ShopRulesPage() { export default function ShopRulesPage() {
const userId = useAuthStore((state) => state.user?.id) const userId = useAuthStore((state) => state.user?.id)
@@ -1,8 +1,5 @@
"use client" "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 { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Switch } from "@/components/ui/switch" 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 type { Shop, ShopSection } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useShopStore } from "@/store/shops" 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<ShopSection["type"], string> = { const sectionLabels: Record<ShopSection["type"], string> = {
banner: "横幅图片", banner: "横幅图片",
+3 -3
View File
@@ -1,14 +1,14 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card" import { Card, CardContent, CardFooter, CardHeader } from "@/components/ui/card"
import { listGames, listOrders, listPlayers, listPosts } from "@/lib/api" import { listGames, listOrders, listPlayers, listPosts } from "@/lib/api"
import { roleLabels } from "@/lib/constants" 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() { export default function CommunityPage() {
const games = listGames() const games = listGames()
+1 -1
View File
@@ -1,5 +1,5 @@
import Link from "next/link"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import Link from "next/link"
export default function HelpPage() { export default function HelpPage() {
return ( return (
+3 -3
View File
@@ -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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { listGames, listPlayers, listShops } from "@/lib/api" import { listGames, listPlayers, listShops } from "@/lib/api"
import { GameIcon } from "@/lib/game-icons" import { GameIcon } from "@/lib/game-icons"
import { ArrowRight, Search, ShoppingBag, Star } from "lucide-react"
import Link from "next/link"
export default function HomePage() { export default function HomePage() {
const games = listGames() const games = listGames()
+3 -3
View File
@@ -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 { FavoriteButton } from "@/components/favorite-button"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
@@ -16,6 +13,9 @@ import {
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { listPlayers, listReviewsByTargetUser, listServicesByPlayer } from "@/lib/api" 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 }> }) { export default async function PlayerDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params const { id } = await params
+4 -4
View File
@@ -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 { PostCommentCount } from "@/components/post-comment-count"
import { PostComments } from "@/components/post-comments" import { PostComments } from "@/components/post-comments"
import { PostLikeButton } from "@/components/post-like-button" 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 { Separator } from "@/components/ui/separator"
import { getOrderById, getPlayerById, getPostById } from "@/lib/api" import { getOrderById, getPlayerById, getPostById } from "@/lib/api"
import { roleLabels } from "@/lib/constants" 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 }> }) { export default async function PostDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params const { id } = await params
+7 -7
View File
@@ -1,12 +1,5 @@
"use client" "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 { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { usePostStore } from "@/store/posts" 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({ const postSchema = z.object({
title: z.string().min(2, "标题至少2个字符").max(50, "标题最多50个字符"), title: z.string().min(2, "标题至少2个字符").max(50, "标题最多50个字符"),
+15 -15
View File
@@ -1,20 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" 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 { SearchResponse, SearchResultItem, SearchSort } from "@/lib/search/types"
import type { Game, Player } from "@/lib/types" import type { Game, Player } from "@/lib/types"
import { cn } from "@/lib/utils" 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<SearchSort> = new Set([ const SEARCH_SORTS: ReadonlySet<SearchSort> = new Set([
"composite", "composite",
+4 -4
View File
@@ -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 { FavoriteButton } from "@/components/favorite-button"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" 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 { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Separator } from "@/components/ui/separator" import { Separator } from "@/components/ui/separator"
import { getShopById, listPlayersByShop, listReviews, listServices } from "@/lib/api" 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 { interface PageProps {
params: Promise<{ id: string }> params: Promise<{ id: string }>
+1 -1
View File
@@ -1,5 +1,5 @@
import Link from "next/link"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import Link from "next/link"
export default function TermsPage() { export default function TermsPage() {
return ( return (
+3 -3
View File
@@ -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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
@@ -12,6 +9,9 @@ import {
listPostsByAuthor, listPostsByAuthor,
listShops, listShops,
} from "@/lib/api" } 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 }> }) { export default async function UserProfilePage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params const { id } = await params
+5 -5
View File
@@ -1,9 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
@@ -11,10 +7,14 @@ import { Card } from "@/components/ui/card"
import { Input } from "@/components/ui/input" import { Input } from "@/components/ui/input"
import { ScrollArea } from "@/components/ui/scroll-area" import { ScrollArea } from "@/components/ui/scroll-area"
import { sendImageMessage, sendTextMessage } from "@/lib/api/chat" import { sendImageMessage, sendTextMessage } from "@/lib/api/chat"
import { cn } from "@/lib/utils"
import { notifyInfo } from "@/lib/toast" import { notifyInfo } from "@/lib/toast"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat" 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 }> }) { export default function ChatDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = use(params) const { id } = use(params)
+2 -2
View File
@@ -1,12 +1,12 @@
"use client" "use client"
import { Lock, MessageSquare } from "lucide-react"
import Link from "next/link"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Card, CardContent } from "@/components/ui/card" import { Card, CardContent } from "@/components/ui/card"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat" import { useChatStore } from "@/store/chat"
import { Lock, MessageSquare } from "lucide-react"
import Link from "next/link"
export default function ChatListPage() { export default function ChatListPage() {
const sessions = useChatStore((state) => state.sessions) const sessions = useChatStore((state) => state.sessions)
+12 -12
View File
@@ -1,5 +1,17 @@
"use client" "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 { AlertTriangle, ArrowLeft, Clock, FileText, Upload, X } from "lucide-react"
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
@@ -13,18 +25,6 @@ import {
useRef, useRef,
useState, useState,
} from "react" } 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<string, string> = { const disputeStatusLabels: Record<string, string> = {
open: "已提交", open: "已提交",
+1 -1
View File
@@ -1,8 +1,8 @@
"use client" "use client"
import { usePathname } from "next/navigation"
import { AuthGuard } from "@/components/auth-guard" import { AuthGuard } from "@/components/auth-guard"
import { Header } from "@/components/header" import { Header } from "@/components/header"
import { usePathname } from "next/navigation"
export default function OrderLayout({ children }: { children: React.ReactNode }) { export default function OrderLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname() const pathname = usePathname()
+4 -4
View File
@@ -1,18 +1,18 @@
"use client" "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 OrderActions from "@/components/order-actions"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { 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 { statusLabels } from "@/lib/constants"
import type { OrderStatus } from "@/lib/types" import type { OrderStatus } from "@/lib/types"
import { useChatStore } from "@/store/chat" import { useChatStore } from "@/store/chat"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useReviewStore } from "@/store/reviews" 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[] = [ const normalStatusSteps: OrderStatus[] = [
"pending_payment", "pending_payment",
+4 -4
View File
@@ -1,9 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" 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 { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useWalletStore } from "@/store/wallet" 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() { export default function NewOrderPage() {
const router = useRouter() const router = useRouter()
+3 -3
View File
@@ -1,8 +1,5 @@
"use client" "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 { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
@@ -21,6 +18,9 @@ import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat" import { useChatStore } from "@/store/chat"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { Clock, MessageSquare, RefreshCw } from "lucide-react"
import Link from "next/link"
import { useState } from "react"
const statusColors: Record<OrderStatus, string> = { const statusColors: Record<OrderStatus, string> = {
pending_payment: "bg-yellow-100 text-yellow-800", pending_payment: "bg-yellow-100 text-yellow-800",
+3 -3
View File
@@ -1,8 +1,5 @@
"use client" "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 { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { Label } from "@/components/ui/label" import { Label } from "@/components/ui/label"
@@ -12,6 +9,9 @@ import { notifyInfo, notifySuccess } from "@/lib/toast"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useReviewStore } from "@/store/reviews" 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 }> }) { export default function ReviewPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = use(params) const { id } = use(params)
+1 -1
View File
@@ -1,7 +1,7 @@
import { NextResponse } from "next/server"
import { mockPlayers, mockServices, mockShops } from "@/lib/mock" import { mockPlayers, mockServices, mockShops } from "@/lib/mock"
import { searchCatalog } from "@/lib/search/search-catalog" import { searchCatalog } from "@/lib/search/search-catalog"
import type { SearchSort } from "@/lib/search/types" import type { SearchSort } from "@/lib/search/types"
import { NextResponse } from "next/server"
export const dynamic = "force-dynamic" export const dynamic = "force-dynamic"
+1 -1
View File
@@ -1,7 +1,7 @@
import type { Metadata } from "next" import type { Metadata } from "next"
import { Geist, Geist_Mono } from "next/font/google" import { Geist, Geist_Mono } from "next/font/google"
import { Providers } from "./providers"
import "./globals.css" import "./globals.css"
import { Providers } from "./providers"
const geistSans = Geist({ const geistSans = Geist({
variable: "--font-geist-sans", variable: "--font-geist-sans",
+2 -2
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { GlobalLoginDialog } from "@/components/global-login-dialog"
import { TooltipProvider } from "@/components/ui/tooltip"
import { QueryClient, QueryClientProvider } from "@tanstack/react-query" import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { useState } from "react" import { useState } from "react"
import { Toaster } from "sonner" import { Toaster } from "sonner"
import { GlobalLoginDialog } from "@/components/global-login-dialog"
import { TooltipProvider } from "@/components/ui/tooltip"
export function Providers({ children }: { children: React.ReactNode }) { export function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = useState( const [queryClient] = useState(
+2 -2
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { Bell, CreditCard, Settings, ShieldCheck } from "lucide-react" import { Bell, CreditCard, Settings, ShieldCheck } from "lucide-react"
import Link from "next/link" import Link from "next/link"
import { usePathname } from "next/navigation" import { usePathname } from "next/navigation"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
const links = [ const links = [
{ href: "/settings", label: "个人设置", icon: Settings }, { href: "/settings", label: "个人设置", icon: Settings },
+1 -1
View File
@@ -1,9 +1,9 @@
"use client" "use client"
import { useEffect, useRef } from "react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useLoginDialogStore } from "@/store/login-dialog" import { useLoginDialogStore } from "@/store/login-dialog"
import { useEffect, useRef } from "react"
interface AuthGuardProps { interface AuthGuardProps {
children: React.ReactNode children: React.ReactNode
+3 -3
View File
@@ -1,5 +1,8 @@
"use client" "use client"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
import { import {
ClipboardList, ClipboardList,
Gamepad2, Gamepad2,
@@ -13,9 +16,6 @@ import {
} from "lucide-react" } from "lucide-react"
import Link from "next/link" import Link from "next/link"
import { usePathname } from "next/navigation" import { usePathname } from "next/navigation"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth"
export const playerLinks = [ export const playerLinks = [
{ href: "/dashboard", label: "概览", icon: LayoutDashboard }, { href: "/dashboard", label: "概览", icon: LayoutDashboard },
+1 -1
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { Heart } from "lucide-react"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import { useRequireAuth } from "@/lib/use-require-auth" import { useRequireAuth } from "@/lib/use-require-auth"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useFavoriteStore } from "@/store/favorites" import { useFavoriteStore } from "@/store/favorites"
import { Heart } from "lucide-react"
interface FavoriteButtonProps { interface FavoriteButtonProps {
initialFavorited: boolean initialFavorited: boolean
+14 -14
View File
@@ -1,19 +1,5 @@
"use client" "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 { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
@@ -32,6 +18,20 @@ import { cn } from "@/lib/utils"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useNotificationStore } from "@/store/notifications" import { useNotificationStore } from "@/store/notifications"
import { useShopStore } from "@/store/shops" 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" import { canAccessDashboard } from "@/components/role-guard"
+4 -4
View File
@@ -1,9 +1,5 @@
"use client" "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 { Button } from "@/components/ui/button"
import { import {
Dialog, Dialog,
@@ -17,6 +13,10 @@ import { Label } from "@/components/ui/label"
import { getCurrentUserForLogin } from "@/lib/api" import { getCurrentUserForLogin } from "@/lib/api"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useLoginDialogStore } from "@/store/login-dialog" 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({ const loginSchema = z.object({
phone: z.string().min(11, "请输入正确的手机号"), phone: z.string().min(11, "请输入正确的手机号"),
+11 -11
View File
@@ -1,16 +1,5 @@
"use client" "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 { Button } from "@/components/ui/button"
import { import {
acceptOrder, acceptOrder,
@@ -25,6 +14,17 @@ import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat" import { useChatStore } from "@/store/chat"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { useShopStore } from "@/store/shops" 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 { interface OrderActionsProps {
orderId: string orderId: string
+1 -1
View File
@@ -1,7 +1,7 @@
"use client" "use client"
import { MessageCircle } from "lucide-react"
import { useCommentStore } from "@/store/comments" import { useCommentStore } from "@/store/comments"
import { MessageCircle } from "lucide-react"
interface PostCommentCountProps { interface PostCommentCountProps {
postId: string postId: string
+2 -2
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { Heart } from "lucide-react"
import { useMemo, useState } from "react"
import { addComment, toggleCommentLike } from "@/lib/api/comments" import { addComment, toggleCommentLike } from "@/lib/api/comments"
import { useRequireAuth } from "@/lib/use-require-auth" import { useRequireAuth } from "@/lib/use-require-auth"
import { useCommentStore } from "@/store/comments" import { useCommentStore } from "@/store/comments"
import { Heart } from "lucide-react"
import { useMemo, useState } from "react"
import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar" import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar"
import { Button } from "./ui/button" import { Button } from "./ui/button"
import { Textarea } from "./ui/textarea" import { Textarea } from "./ui/textarea"
+1 -1
View File
@@ -1,9 +1,9 @@
"use client" "use client"
import { Heart } from "lucide-react"
import { togglePostLike } from "@/lib/api/posts" import { togglePostLike } from "@/lib/api/posts"
import { useRequireAuth } from "@/lib/use-require-auth" import { useRequireAuth } from "@/lib/use-require-auth"
import { usePostStore } from "@/store/posts" import { usePostStore } from "@/store/posts"
import { Heart } from "lucide-react"
interface PostLikeButtonProps { interface PostLikeButtonProps {
postId: string postId: string
+2 -2
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { usePathname, useRouter } from "next/navigation"
import { useEffect } from "react"
import { ownerLinks, playerLinks } from "@/components/dashboard-sidebar" import { ownerLinks, playerLinks } from "@/components/dashboard-sidebar"
import type { UserRole } from "@/lib/types" import type { UserRole } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { usePathname, useRouter } from "next/navigation"
import { useEffect } from "react"
const dashboardRoutes: Record<string, readonly { href: string }[]> = { const dashboardRoutes: Record<string, readonly { href: string }[]> = {
player: playerLinks, player: playerLinks,
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -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 }
+6 -6
View File
@@ -1,8 +1,5 @@
"use client" "use client"
import { Command as CommandPrimitive } from "cmdk"
import { SearchIcon } from "lucide-react"
import type * as React from "react"
import { import {
Dialog, Dialog,
DialogContent, DialogContent,
@@ -11,6 +8,9 @@ import {
DialogTitle, DialogTitle,
} from "@/components/ui/dialog" } from "@/components/ui/dialog"
import { cn } from "@/lib/utils" 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<typeof CommandPrimitive>) { function Command({ className, ...props }: React.ComponentProps<typeof CommandPrimitive>) {
return ( return (
@@ -150,11 +150,11 @@ function CommandShortcut({ className, ...props }: React.ComponentProps<"span">)
export { export {
Command, Command,
CommandDialog, CommandDialog,
CommandInput,
CommandList,
CommandEmpty, CommandEmpty,
CommandGroup, CommandGroup,
CommandInput,
CommandItem, CommandItem,
CommandShortcut, CommandList,
CommandSeparator, CommandSeparator,
CommandShortcut,
} }
+2 -2
View File
@@ -1,10 +1,10 @@
"use client" "use client"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
import { XIcon } from "lucide-react" import { XIcon } from "lucide-react"
import { Dialog as DialogPrimitive } from "radix-ui" import { Dialog as DialogPrimitive } from "radix-ui"
import type * as React from "react" import type * as React from "react"
import { Button } from "@/components/ui/button"
import { cn } from "@/lib/utils"
function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) { function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {
return <DialogPrimitive.Root data-slot="dialog" {...props} /> return <DialogPrimitive.Root data-slot="dialog" {...props} />
+5 -5
View File
@@ -211,18 +211,18 @@ function DropdownMenuSubContent({
export { export {
DropdownMenu, DropdownMenu,
DropdownMenuPortal, DropdownMenuCheckboxItem,
DropdownMenuTrigger,
DropdownMenuContent, DropdownMenuContent,
DropdownMenuGroup, DropdownMenuGroup,
DropdownMenuLabel,
DropdownMenuItem, DropdownMenuItem,
DropdownMenuCheckboxItem, DropdownMenuLabel,
DropdownMenuPortal,
DropdownMenuRadioGroup, DropdownMenuRadioGroup,
DropdownMenuRadioItem, DropdownMenuRadioItem,
DropdownMenuSeparator, DropdownMenuSeparator,
DropdownMenuShortcut, DropdownMenuShortcut,
DropdownMenuSub, DropdownMenuSub,
DropdownMenuSubTrigger,
DropdownMenuSubContent, DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} }
+6 -6
View File
@@ -1,5 +1,7 @@
"use client" "use client"
import { Label } from "@/components/ui/label"
import { cn } from "@/lib/utils"
import type { Label as LabelPrimitive } from "radix-ui" import type { Label as LabelPrimitive } from "radix-ui"
import { Slot } from "radix-ui" import { Slot } from "radix-ui"
import * as React from "react" import * as React from "react"
@@ -12,8 +14,6 @@ import {
useFormContext, useFormContext,
useFormState, useFormState,
} from "react-hook-form" } from "react-hook-form"
import { Label } from "@/components/ui/label"
import { cn } from "@/lib/utils"
const Form = FormProvider const Form = FormProvider
@@ -140,12 +140,12 @@ function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
} }
export { export {
useFormField,
Form, Form,
FormItem,
FormLabel,
FormControl, FormControl,
FormDescription, FormDescription,
FormMessage,
FormField, FormField,
FormItem,
FormLabel,
FormMessage,
useFormField,
} }
+3 -3
View File
@@ -65,10 +65,10 @@ function PopoverDescription({ className, ...props }: React.ComponentProps<"p">)
export { export {
Popover, Popover,
PopoverTrigger,
PopoverContent,
PopoverAnchor, PopoverAnchor,
PopoverContent,
PopoverDescription,
PopoverHeader, PopoverHeader,
PopoverTitle, PopoverTitle,
PopoverDescription, PopoverTrigger,
} }
+4 -4
View File
@@ -124,11 +124,11 @@ function SheetDescription({
export { export {
Sheet, Sheet,
SheetTrigger,
SheetClose, SheetClose,
SheetContent, SheetContent,
SheetHeader,
SheetFooter,
SheetTitle,
SheetDescription, SheetDescription,
SheetFooter,
SheetHeader,
SheetTitle,
SheetTrigger,
} }
+1 -1
View File
@@ -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 }
+1 -1
View File
@@ -78,4 +78,4 @@ function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPr
) )
} }
export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants } export { Tabs, TabsContent, TabsList, tabsListVariants, TabsTrigger }
+1 -1
View File
@@ -50,4 +50,4 @@ function TooltipContent({
) )
} }
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger }
+1 -1
View File
@@ -1,7 +1,7 @@
import { defineConfig, globalIgnores } from "eslint/config"
import nextVitals from "eslint-config-next/core-web-vitals" import nextVitals from "eslint-config-next/core-web-vitals"
import nextTypescript from "eslint-config-next/typescript" import nextTypescript from "eslint-config-next/typescript"
import prettier from "eslint-config-prettier/flat" import prettier from "eslint-config-prettier/flat"
import { defineConfig, globalIgnores } from "eslint/config"
const eslintConfig = defineConfig([ const eslintConfig = defineConfig([
...nextVitals, ...nextVitals,
+1 -1
View File
@@ -1,6 +1,6 @@
import { allow, deny } from "@/lib/policy/assert" import { allow, deny } from "@/lib/policy/assert"
import { useChatStore } from "@/store/chat"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat"
export function listChatSessions() { export function listChatSessions() {
return useChatStore.getState().sessions return useChatStore.getState().sessions
+1 -1
View File
@@ -1,5 +1,5 @@
import { allow, deny } from "@/lib/policy/assert"
import { addNotification } from "@/lib/api/notifications" import { addNotification } from "@/lib/api/notifications"
import { allow, deny } from "@/lib/policy/assert"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useCommentStore } from "@/store/comments" import { useCommentStore } from "@/store/comments"
import { usePostStore } from "@/store/posts" import { usePostStore } from "@/store/posts"
+1 -1
View File
@@ -1,6 +1,6 @@
import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop" import { resolveOwnerShop } from "@/lib/domain/resolve-current-shop"
import { allow, deny } from "@/lib/policy/assert"
import type { Actor } from "@/lib/policy/actor" import type { Actor } from "@/lib/policy/actor"
import { allow, deny } from "@/lib/policy/assert"
import type { PolicyDecision } from "@/lib/policy/decision" import type { PolicyDecision } from "@/lib/policy/decision"
import type { PlayerService } from "@/lib/types" import type { PlayerService } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
+1 -1
View File
@@ -1,5 +1,5 @@
import { allow, deny } from "@/lib/policy/assert"
import { addNotification } from "@/lib/api/notifications" import { addNotification } from "@/lib/api/notifications"
import { allow, deny } from "@/lib/policy/assert"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { usePostStore } from "@/store/posts" import { usePostStore } from "@/store/posts"
+1 -1
View File
@@ -1,5 +1,5 @@
import { allow, deny, requireAuth } from "@/lib/policy/assert"
import type { Actor } from "@/lib/policy/actor" import type { Actor } from "@/lib/policy/actor"
import { allow, deny, requireAuth } from "@/lib/policy/assert"
import type { PolicyDecision } from "@/lib/policy/decision" import type { PolicyDecision } from "@/lib/policy/decision"
import type { OrderStatus } from "@/lib/types" import type { OrderStatus } from "@/lib/types"
+1 -1
View File
@@ -1,5 +1,5 @@
import type { Player, PlayerService, Shop } from "@/lib/types"
import type { SearchResponse, SearchResultItem, SearchSort } from "@/lib/search/types" import type { SearchResponse, SearchResultItem, SearchSort } from "@/lib/search/types"
import type { Player, PlayerService, Shop } from "@/lib/types"
export interface SearchCatalogParams { export interface SearchCatalogParams {
q?: string q?: string
+1 -1
View File
@@ -1,8 +1,8 @@
"use client" "use client"
import { useCallback } from "react"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useLoginDialogStore } from "@/store/login-dialog" import { useLoginDialogStore } from "@/store/login-dialog"
import { useCallback } from "react"
export function useRequireAuth() { export function useRequireAuth() {
const isAuthenticated = useAuthStore((s) => s.isAuthenticated) const isAuthenticated = useAuthStore((s) => s.isAuthenticated)
+1
View File
@@ -45,6 +45,7 @@
"eslint-config-prettier": "^10.1.8", "eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-hooks": "^7.0.1",
"prettier": "^3.8.1", "prettier": "^3.8.1",
"prettier-plugin-organize-imports": "^4.3.0",
"shadcn": "^3.8.5", "shadcn": "^3.8.5",
"tailwindcss": "^4", "tailwindcss": "^4",
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
+18
View File
@@ -90,6 +90,9 @@ importers:
prettier: prettier:
specifier: ^3.8.1 specifier: ^3.8.1
version: 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: shadcn:
specifier: ^3.8.5 specifier: ^3.8.5
version: 3.8.5(@types/node@20.19.33)(typescript@5.9.3) version: 3.8.5(@types/node@20.19.33)(typescript@5.9.3)
@@ -3516,6 +3519,16 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'} 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: prettier@3.8.1:
resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==}
engines: {node: '>=14'} engines: {node: '>=14'}
@@ -7734,6 +7747,11 @@ snapshots:
prelude-ls@1.2.1: {} 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: {} prettier@3.8.1: {}
pretty-ms@9.3.0: pretty-ms@9.3.0:
+1 -1
View File
@@ -1,5 +1,5 @@
import { create } from "zustand"
import type { User, UserRole, VerificationStatus } from "@/lib/types" import type { User, UserRole, VerificationStatus } from "@/lib/types"
import { create } from "zustand"
interface NotificationPrefs { interface NotificationPrefs {
order: boolean order: boolean
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockChatMessages, mockChatSessions, mockUsers } from "@/lib/mock" import { mockChatMessages, mockChatSessions, mockUsers } from "@/lib/mock"
import type { ChatMessage, ChatSession, Order } from "@/lib/types" import type { ChatMessage, ChatSession, Order } from "@/lib/types"
import { create } from "zustand"
interface ChatState { interface ChatState {
sessions: ChatSession[] sessions: ChatSession[]
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockComments } from "@/lib/mock" import { mockComments } from "@/lib/mock"
import type { Comment, User } from "@/lib/types" import type { Comment, User } from "@/lib/types"
import { create } from "zustand"
interface CommentState { interface CommentState {
comments: Comment[] comments: Comment[]
+4 -4
View File
@@ -1,14 +1,14 @@
import { create } from "zustand"
import { DISPUTE_TO_RESOLVED_MS, DISPUTE_TO_REVIEWING_MS } from "@/lib/config/demo-timers" import { DISPUTE_TO_RESOLVED_MS, DISPUTE_TO_REVIEWING_MS } from "@/lib/config/demo-timers"
import { generateId } from "@/lib/id" 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 { 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 type { Dispute } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useNotificationStore } from "@/store/notifications" import { useNotificationStore } from "@/store/notifications"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { create } from "zustand"
type DisputeTimelineType = "created" | "response" | "reviewing" | "resolved" | "appealed" type DisputeTimelineType = "created" | "response" | "reviewing" | "resolved" | "appealed"
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockFavorites } from "@/lib/mock" import { mockFavorites } from "@/lib/mock"
import type { Favorite } from "@/lib/types" import type { Favorite } from "@/lib/types"
import { create } from "zustand"
interface FavoriteState { interface FavoriteState {
favorites: Favorite[] favorites: Favorite[]
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockNotifications } from "@/lib/mock" import { mockNotifications } from "@/lib/mock"
import type { Notification } from "@/lib/types" import type { Notification } from "@/lib/types"
import { create } from "zustand"
interface CreateNotificationInput { interface CreateNotificationInput {
type: Notification["type"] type: Notification["type"]
+5 -5
View File
@@ -1,4 +1,3 @@
import { create } from "zustand"
import { import {
ORDER_ACCEPT_TIMEOUT_MS, ORDER_ACCEPT_TIMEOUT_MS,
ORDER_CLOSE_TIMEOUT_MS, ORDER_CLOSE_TIMEOUT_MS,
@@ -6,16 +5,17 @@ import {
} from "@/lib/config/demo-timers" } from "@/lib/config/demo-timers"
import { evaluateOrderTransition, type OrderAction } from "@/lib/domain/order-machine" import { evaluateOrderTransition, type OrderAction } from "@/lib/domain/order-machine"
import { generateId } from "@/lib/id" 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 { 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 type { Order, OrderStatus, PlayerService } from "@/lib/types"
import { useAuthStore } from "@/store/auth" import { useAuthStore } from "@/store/auth"
import { useChatStore } from "@/store/chat" import { useChatStore } from "@/store/chat"
import { useNotificationStore } from "@/store/notifications" import { useNotificationStore } from "@/store/notifications"
import { useWalletStore } from "@/store/wallet"
import { useShopStore } from "@/store/shops" import { useShopStore } from "@/store/shops"
import { useWalletStore } from "@/store/wallet"
import { create } from "zustand"
interface CreateOrderInput { interface CreateOrderInput {
consumerId: string consumerId: string
+1 -1
View File
@@ -1,5 +1,5 @@
import { create } from "zustand"
import type { Player } from "@/lib/types" import type { Player } from "@/lib/types"
import { create } from "zustand"
type PlayerStatus = Player["status"] type PlayerStatus = Player["status"]
+1 -1
View File
@@ -1,6 +1,6 @@
import { create } from "zustand"
import { mockPlayers } from "@/lib/mock" import { mockPlayers } from "@/lib/mock"
import type { Player } from "@/lib/types" import type { Player } from "@/lib/types"
import { create } from "zustand"
interface PlayerState { interface PlayerState {
players: Player[] players: Player[]
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockPosts } from "@/lib/mock" import { mockPosts } from "@/lib/mock"
import type { Post, User, UserRole } from "@/lib/types" import type { Post, User, UserRole } from "@/lib/types"
import { create } from "zustand"
interface CreatePostInput { interface CreatePostInput {
author: User author: User
+2 -2
View File
@@ -1,10 +1,10 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockReviews, mockUsers } from "@/lib/mock"
import { allow, deny } from "@/lib/policy/assert" import { allow, deny } from "@/lib/policy/assert"
import type { PolicyDecision } from "@/lib/policy/decision" import type { PolicyDecision } from "@/lib/policy/decision"
import { mockReviews, mockUsers } from "@/lib/mock"
import type { Review } from "@/lib/types" import type { Review } from "@/lib/types"
import { useOrderStore } from "@/store/orders" import { useOrderStore } from "@/store/orders"
import { create } from "zustand"
interface SubmitReviewInput { interface SubmitReviewInput {
orderId: string orderId: string
+1 -1
View File
@@ -1,7 +1,7 @@
import { create } from "zustand"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockServices } from "@/lib/mock" import { mockServices } from "@/lib/mock"
import type { PlayerService } from "@/lib/types" import type { PlayerService } from "@/lib/types"
import { create } from "zustand"
interface ServiceState { interface ServiceState {
services: PlayerService[] services: PlayerService[]
+1 -1
View File
@@ -1,6 +1,6 @@
import { create } from "zustand"
import { mockShops } from "@/lib/mock" import { mockShops } from "@/lib/mock"
import type { Shop, ShopSection } from "@/lib/types" import type { Shop, ShopSection } from "@/lib/types"
import { create } from "zustand"
interface ShopState { interface ShopState {
shops: Shop[] shops: Shop[]
+2 -2
View File
@@ -1,9 +1,9 @@
import { create } from "zustand"
import { calculateOrderIncome } from "@/lib/domain/income" import { calculateOrderIncome } from "@/lib/domain/income"
import { generateId } from "@/lib/id" import { generateId } from "@/lib/id"
import { mockTransactions, walletBalance } from "@/lib/mock" import { mockTransactions, walletBalance } from "@/lib/mock"
import { useShopStore } from "@/store/shops"
import type { WalletTransaction } from "@/lib/types" import type { WalletTransaction } from "@/lib/types"
import { useShopStore } from "@/store/shops"
import { create } from "zustand"
interface WalletState { interface WalletState {
balance: number balance: number
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"
import { calculateOrderIncome } from "@/lib/domain/income" import { calculateOrderIncome } from "@/lib/domain/income"
import { describe, expect, it } from "vitest"
describe("calculateOrderIncome", () => { describe("calculateOrderIncome", () => {
it("calculates percentage commission income", () => { it("calculates percentage commission income", () => {
+1 -1
View File
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest"
import { evaluateOrderTransition } from "@/lib/domain/order-machine" import { evaluateOrderTransition } from "@/lib/domain/order-machine"
import type { Actor } from "@/lib/policy/actor" import type { Actor } from "@/lib/policy/actor"
import type { UserRole } from "@/lib/types" import type { UserRole } from "@/lib/types"
import { describe, expect, it } from "vitest"
function actor(role: UserRole, userId = "u1"): Actor { function actor(role: UserRole, userId = "u1"): Actor {
return { role, userId } return { role, userId }
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"
import { allow, deny, requireAuth } from "@/lib/policy/assert" import { allow, deny, requireAuth } from "@/lib/policy/assert"
import { describe, expect, it } from "vitest"
describe("policy decision helpers", () => { describe("policy decision helpers", () => {
it("returns ok for allow", () => { it("returns ok for allow", () => {
+3 -3
View File
@@ -1,9 +1,9 @@
import { describe, expect, it } from "vitest"
import { searchCatalog } from "@/lib/search/search-catalog"
import { mockPlayers } from "@/lib/mock/players" import { mockPlayers } from "@/lib/mock/players"
import { mockShops } from "@/lib/mock/shops"
import { mockServices } from "@/lib/mock/services" import { mockServices } from "@/lib/mock/services"
import { mockShops } from "@/lib/mock/shops"
import type { SearchCatalogData } from "@/lib/search/search-catalog" import type { SearchCatalogData } from "@/lib/search/search-catalog"
import { searchCatalog } from "@/lib/search/search-catalog"
import { describe, expect, it } from "vitest"
const data: SearchCatalogData = { const data: SearchCatalogData = {
players: mockPlayers, players: mockPlayers,
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest"
import { GET } from "@/app/api/search/route" import { GET } from "@/app/api/search/route"
import { describe, expect, it } from "vitest"
describe("GET /api/search", () => { describe("GET /api/search", () => {
it("returns 200 with items and meta", async () => { it("returns 200 with items and meta", async () => {