style: clean up code formatting and remove trailing whitespace
refactor: reorganize imports and fix type imports
This commit is contained in:
1 parent
d3704602fd
commit
47c04de6fe
232 files changed
+7140
-4798
No files matched your search
@@ -1,8 +1,7 @@
|
||||
import Header from "@/components/Header";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import type { Metadata } from "next";
|
||||
import MarketClient from "./MarketClient";
|
||||
import Header from "@/components/Header";
|
||||
import { getActiveListings } from "@/lib/prisma/queries/listings";
|
||||
import MarketClient from "./MarketClient";
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
@@ -46,12 +45,14 @@ export default async function MarketPage({
|
||||
const sp = (await searchParams) ?? {};
|
||||
|
||||
const page = typeof sp.page === "string" ? parseInt(sp.page, 10) : 1;
|
||||
const pageSize = typeof sp.pageSize === "string" ? parseInt(sp.pageSize, 10) : 20;
|
||||
const pageSize =
|
||||
typeof sp.pageSize === "string" ? parseInt(sp.pageSize, 10) : 20;
|
||||
|
||||
// Buscar anúncios ativos
|
||||
const listingsData = await getActiveListings({
|
||||
search: typeof sp.search === "string" ? sp.search : undefined,
|
||||
server_name: typeof sp.server_name === "string" ? sp.server_name : undefined,
|
||||
server_name:
|
||||
typeof sp.server_name === "string" ? sp.server_name : undefined,
|
||||
page,
|
||||
pageSize,
|
||||
sortBy: (typeof sp.sortBy === "string" ? sp.sortBy : "created_at") as
|
||||
@@ -60,27 +61,34 @@ export default async function MarketPage({
|
||||
| "price_tibia_coins"
|
||||
| "price_gold_coins"
|
||||
| "views_count",
|
||||
sortOrder: (typeof sp.sortOrder === "string" ? sp.sortOrder : "DESC") as "ASC" | "DESC",
|
||||
sortOrder: (typeof sp.sortOrder === "string" ? sp.sortOrder : "DESC") as
|
||||
| "ASC"
|
||||
| "DESC",
|
||||
});
|
||||
|
||||
// Converter Date para string para compatibilidade com o tipo do cliente
|
||||
const serializedListings = listingsData.listings.map((listing) => ({
|
||||
...listing,
|
||||
created_at: listing.created_at instanceof Date
|
||||
? listing.created_at.toISOString()
|
||||
: listing.created_at,
|
||||
updated_at: listing.updated_at instanceof Date
|
||||
? listing.updated_at.toISOString()
|
||||
: listing.updated_at,
|
||||
sold_at: listing.sold_at instanceof Date
|
||||
? listing.sold_at.toISOString()
|
||||
: listing.sold_at,
|
||||
auction_ends_at: listing.auction_ends_at instanceof Date
|
||||
? listing.auction_ends_at.toISOString()
|
||||
: listing.auction_ends_at,
|
||||
expires_at: listing.expires_at instanceof Date
|
||||
? listing.expires_at.toISOString()
|
||||
: listing.expires_at,
|
||||
created_at:
|
||||
listing.created_at instanceof Date
|
||||
? listing.created_at.toISOString()
|
||||
: listing.created_at,
|
||||
updated_at:
|
||||
listing.updated_at instanceof Date
|
||||
? listing.updated_at.toISOString()
|
||||
: listing.updated_at,
|
||||
sold_at:
|
||||
listing.sold_at instanceof Date
|
||||
? listing.sold_at.toISOString()
|
||||
: listing.sold_at,
|
||||
auction_ends_at:
|
||||
listing.auction_ends_at instanceof Date
|
||||
? listing.auction_ends_at.toISOString()
|
||||
: listing.auction_ends_at,
|
||||
expires_at:
|
||||
listing.expires_at instanceof Date
|
||||
? listing.expires_at.toISOString()
|
||||
: listing.expires_at,
|
||||
}));
|
||||
|
||||
return (
|
||||
|
||||
Reference in new issue
Block a user