improvement: rtl direction, solar calendar and persian formatting added for persian users.
This commit is contained in:
@@ -72,7 +72,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
|
||||
|
||||
return (
|
||||
<ToastProvider>
|
||||
<div className="flex h-[100dvh] app-web-bg text-text-primary">
|
||||
<div className="app-dashboard-shell flex h-[100dvh] app-web-bg text-text-primary">
|
||||
{sidebarOpen ? (
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -4,11 +4,12 @@ import { getMessages, setRequestLocale } from 'next-intl/server';
|
||||
import { hasLocale } from 'next-intl';
|
||||
import { notFound } from 'next/navigation';
|
||||
import Script from 'next/script';
|
||||
import { Noto_Sans_Arabic, Vazirmatn } from 'next/font/google';
|
||||
import '@/styles/globals.css';
|
||||
import '@/styles/background-web.css';
|
||||
import { AuthProvider } from '@/lib/hooks/useAuth';
|
||||
import { THEME_STORAGE_KEY } from '@/lib/theme';
|
||||
import { routing, localeHtmlLang } from '@/i18n/routing';
|
||||
import { routing, isRtlLocale, localeHtmlLang } from '@/i18n/routing';
|
||||
import { LocaleSync } from '@/components/i18n/LocaleSync';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -25,6 +26,18 @@ export function generateStaticParams() {
|
||||
return routing.locales.map((locale) => ({ locale }));
|
||||
}
|
||||
|
||||
const vazirmatn = Vazirmatn({
|
||||
subsets: ['arabic'],
|
||||
variable: '--font-vazirmatn',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
const notoSansArabic = Noto_Sans_Arabic({
|
||||
subsets: ['arabic'],
|
||||
variable: '--font-noto-sans-arabic',
|
||||
display: 'swap',
|
||||
});
|
||||
|
||||
export default async function LocaleLayout({
|
||||
children,
|
||||
params,
|
||||
@@ -42,9 +55,20 @@ export default async function LocaleLayout({
|
||||
const messages = await getMessages();
|
||||
|
||||
const themeInit = `(function(){try{var k=${JSON.stringify(THEME_STORAGE_KEY)};var t=localStorage.getItem(k);document.documentElement.setAttribute('data-theme',t==='light'||t==='dark'?t:'dark');}catch(e){document.documentElement.setAttribute('data-theme','dark');}})();`;
|
||||
const dir = isRtlLocale(locale) ? 'rtl' : 'ltr';
|
||||
const fontSans = isRtlLocale(locale)
|
||||
? 'var(--font-vazirmatn), var(--font-noto-sans-arabic), system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif'
|
||||
: 'system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif';
|
||||
|
||||
return (
|
||||
<html lang={localeHtmlLang(locale)} dir="ltr" suppressHydrationWarning>
|
||||
<html
|
||||
lang={localeHtmlLang(locale)}
|
||||
dir={dir}
|
||||
data-locale={locale}
|
||||
className={`${vazirmatn.variable} ${notoSansArabic.variable}`}
|
||||
style={{ ['--font-sans' as never]: fontSans }}
|
||||
suppressHydrationWarning
|
||||
>
|
||||
<body>
|
||||
<Script id="theme-init" strategy="beforeInteractive">
|
||||
{themeInit}
|
||||
|
||||
Reference in New Issue
Block a user