From f08d9edf3212736ad0dab7c0254257bdaa6c6078 Mon Sep 17 00:00:00 2001 From: mortezaei Date: Mon, 17 Aug 2026 17:25:05 +0330 Subject: [PATCH 1/2] refactor(ui): fix Button link nesting accessibility and add sync failure error toast --- src/app/questions-list/page.tsx | 5 ++ src/components/Componentes/button.tsx | 76 +++++++++++++++------------ 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/src/app/questions-list/page.tsx b/src/app/questions-list/page.tsx index 7a1768c..4690eeb 100644 --- a/src/app/questions-list/page.tsx +++ b/src/app/questions-list/page.tsx @@ -452,6 +452,11 @@ export default function QuestionsListPage() { } catch (err) { console.error("Failed to sync pending sections:", err); setIsSyncError(true); + setToastMessage( + t[ + "Sending the match request failed. Please check your connection and try again." + ] ?? "Sending the match request failed. Please check your connection and try again." + ); } finally { setIsSyncing(false); } diff --git a/src/components/Componentes/button.tsx b/src/components/Componentes/button.tsx index 0c9008c..5c013dc 100644 --- a/src/components/Componentes/button.tsx +++ b/src/components/Componentes/button.tsx @@ -153,7 +153,47 @@ export function Button({ ); }; - const button = ( + const content = isLoading ? ( + + ) : ( + + {renderArrow("left")} + + + {children} + + {description && !isOutlined ? ( + + {description} + + ) : null} + + {countdownLocked ? ( + + + + ) : ( + renderArrow("right") + )} + + ); + + if (href) { + return ( + + {content} + + ); + } + + return ( ); - - return href ? ( - {button} - ) : ( - button - ); } type CountdownProgressProps = { From 740bb9a4a1630e70b91b245f57821efffa5945f0 Mon Sep 17 00:00:00 2001 From: mortezaei Date: Mon, 17 Aug 2026 17:38:10 +0330 Subject: [PATCH 2/2] perf(core): optimize Layer 1 SSR cookie reading and unify synchronous head bootstrap --- src/app/layout.tsx | 107 +++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 76 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 9d284f4..2077197 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,7 @@ import type { Metadata, Viewport } from "next"; import { Amiri } from "next/font/google"; import localFont from "next/font/local"; -import { headers } from "next/headers"; -import Script from "next/script"; +import { cookies, headers } from "next/headers"; import Providers from "./providers"; import "./globals.css"; import DevClickToComponent from "@/components/Componentes/dev-click-to-component"; @@ -54,10 +53,20 @@ export default async function RootLayout({ }: Readonly<{ children: React.ReactNode; }>) { - const requestHeaders = await headers(); + const [cookieStore, requestHeaders] = await Promise.all([ + cookies(), + headers(), + ]); const headerLocale = requestHeaders.get("x-habib-locale"); + const cookieLocale = + cookieStore.get("HABIB_LANGUAGE")?.value ?? + cookieStore.get("habib_language")?.value; const locale = - headerLocale && isLocale(headerLocale) ? headerLocale : defaultLocale; + headerLocale && isLocale(headerLocale) + ? headerLocale + : isLocale(cookieLocale) + ? cookieLocale + : defaultLocale; return ( -