feat: implement market page with QueryProvider and dynamic listings
- wrap root layout with QueryProvider for React Query - replace market UnderConstruction placeholder with MarketClient and real data fetching - implement search, pagination, and sort via search params using getActiveListings - add necessary client components and queries - update dependencies (e.g., prisma, pkg-types)
This commit is contained in:
1 parent
55eebde0ba
commit
ab37b477df
106 files changed
+15261
-301
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const languages = [
|
||||
{ code: "pt", name: "Português", flag: "🇧🇷" },
|
||||
@@ -22,6 +23,12 @@ export function LanguageSwitcher() {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const t = useTranslations("header");
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
// Evitar hydration mismatch com Radix UI
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
const handleLanguageChange = (newLocale: string) => {
|
||||
// Remove the current locale from the pathname
|
||||
@@ -32,6 +39,16 @@ export function LanguageSwitcher() {
|
||||
|
||||
const currentLanguage = languages.find((lang) => lang.code === locale);
|
||||
|
||||
// Renderizar placeholder durante SSR para evitar mismatch
|
||||
if (!mounted) {
|
||||
return (
|
||||
<Button variant="outline" size="icon" disabled>
|
||||
<Globe className="h-[1.2rem] w-[1.2rem]" />
|
||||
<span className="sr-only">{t("language")}</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
|
||||
Reference in new issue
Block a user