+
{/* functional routes */}
diff --git a/src/stores/language/index.ts b/src/stores/language/index.tsx
similarity index 70%
rename from src/stores/language/index.ts
rename to src/stores/language/index.tsx
index 052127bc..ba33d59a 100644
--- a/src/stores/language/index.ts
+++ b/src/stores/language/index.tsx
@@ -1,8 +1,10 @@
import { useEffect } from "react";
+import { Helmet } from "react-helmet-async";
import { create } from "zustand";
import { persist } from "zustand/middleware";
import { immer } from "zustand/middleware/immer";
+import { rtlLocales } from "@/assets/languages";
import i18n from "@/setup/i18n";
export interface LanguageStore {
@@ -24,10 +26,18 @@ export const useLanguageStore = create(
)
);
-export function useLanguageListener() {
+export function LanguageProvider() {
const language = useLanguageStore((s) => s.language);
useEffect(() => {
i18n.changeLanguage(language);
}, [language]);
+
+ const isRtl = rtlLocales.includes(language as any);
+
+ return (
+
+
+
+ );
}
diff --git a/tailwind.config.ts b/tailwind.config.ts
index 5e9b9a84..913a59fd 100644
--- a/tailwind.config.ts
+++ b/tailwind.config.ts
@@ -1,5 +1,6 @@
import { allThemes, defaultTheme, safeThemeList } from "./themes";
import type { Config } from "tailwindcss";
+import plugin from "tailwindcss/plugin";
const themer = require("tailwindcss-themer");
@@ -41,6 +42,9 @@ const config: Config = {
...allThemes,
],
}),
+ plugin(({ addVariant }) => {
+ addVariant("dir-neutral", "[dir] &");
+ }),
],
};
diff --git a/vite.config.ts b/vite.config.ts
index 9a0018b0..8ebf8198 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -7,6 +7,9 @@ import path from "path";
import { handlebars } from "./plugins/handlebars";
import { loadEnv } from "vite";
+import tailwind from "tailwindcss";
+import rtl from "postcss-rtlcss";
+
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
@@ -18,8 +21,8 @@ export default defineConfig(({ mode }) => {
env.VITE_APP_DOMAIN +
(env.VITE_NORMAL_ROUTER !== "true" ? "/#" : ""),
domain: env.VITE_APP_DOMAIN,
- env
- }
+ env,
+ },
}),
react({
babel: {
@@ -31,24 +34,24 @@ export default defineConfig(({ mode }) => {
modules: false,
useBuiltIns: "entry",
corejs: {
- version: "3.29"
- }
- }
- ]
- ]
- }
+ version: "3.29",
+ },
+ },
+ ],
+ ],
+ },
}),
VitePWA({
disable: env.VITE_PWA_ENABLED !== "true",
registerType: "autoUpdate",
workbox: {
maximumFileSizeToCacheInBytes: 4000000, // 4mb
- globIgnores: ["**ping.txt**"]
+ globIgnores: ["**ping.txt**"],
},
includeAssets: [
"favicon.ico",
"apple-touch-icon.png",
- "safari-pinned-tab.svg"
+ "safari-pinned-tab.svg",
],
manifest: {
name: "movie-web",
@@ -63,48 +66,53 @@ export default defineConfig(({ mode }) => {
src: "android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
- purpose: "any"
+ purpose: "any",
},
{
src: "android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
- purpose: "any"
+ purpose: "any",
},
{
src: "android-chrome-192x192.png",
sizes: "192x192",
type: "image/png",
- purpose: "maskable"
+ purpose: "maskable",
},
{
src: "android-chrome-512x512.png",
sizes: "512x512",
type: "image/png",
- purpose: "maskable"
- }
- ]
- }
+ purpose: "maskable",
+ },
+ ],
+ },
}),
loadVersion(),
checker({
overlay: {
- position: "tr"
+ position: "tr",
},
typescript: true, // check typescript build errors in dev server
eslint: {
// check lint errors in dev server
lintCommand: "eslint --ext .tsx,.ts src",
dev: {
- logLevel: ["error"]
- }
- }
- })
+ logLevel: ["error"],
+ },
+ },
+ }),
],
build: {
sourcemap: true,
},
+ css: {
+ postcss: {
+ plugins: [tailwind(), rtl()],
+ },
+ },
resolve: {
alias: {
@@ -112,12 +120,12 @@ export default defineConfig(({ mode }) => {
"@sozialhelden/ietf-language-tags": path.resolve(
__dirname,
"./node_modules/@sozialhelden/ietf-language-tags/dist/cjs"
- )
- }
+ ),
+ },
},
test: {
- environment: "jsdom"
- }
+ environment: "jsdom",
+ },
};
});