This commit is contained in:
0x1eef 2024-10-18 03:39:23 -03:00
parent e802d6ef19
commit fd4eb1e409
4 changed files with 45 additions and 43 deletions

View file

@ -1,12 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title></title> <title>The Noble Quran</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script src="/js/index.js"></script>
</head> </head>
<body> <body>
<div class="app mount root h-full"></div> <div class="app mount root h-full"></div>
<script src="/js/index.js"></script>
</body> </body>
</html> </html>

View file

@ -15,6 +15,11 @@ export function LanguageSelect({
setActiveLocale, setActiveLocale,
}: Props) { }: Props) {
const locales = Object.values(Quran.locales); const locales = Object.values(Quran.locales);
if (!activeLocale) {
return null;
}
return ( return (
<Select <Select
value={activeLocale.name} value={activeLocale.name}

View file

@ -52,7 +52,7 @@ export function SurahIndex({ locale, surahs, t }: Props) {
<LanguageSelect <LanguageSelect
isOpen={showLangDropdown} isOpen={showLangDropdown}
setIsOpen={setShowLangDropdown} setIsOpen={setShowLangDropdown}
locale={activeLocale} activeLocale={activeLocale}
setActiveLocale={setActiveLocale} setActiveLocale={setActiveLocale}
/> />
<ThemeSelect <ThemeSelect

View file

@ -9,7 +9,7 @@ import classNames from "classnames";
import { Router } from "preact-router"; import { Router } from "preact-router";
import "core-js"; import "core-js";
const exports = { const globals = {
Quran, Quran,
React, React,
render, render,
@ -19,10 +19,9 @@ const exports = {
useRef, useRef,
classNames, classNames,
}; };
Object.assign(window, exports); Object.assign(window, globals);
document.addEventListener("DOMContentLoaded", () => { const Main = (function () {
const Main = (function () {
const t = T(require("@json/t.json")); const t = T(require("@json/t.json"));
return () => { return () => {
return ( return (
@ -55,7 +54,5 @@ document.addEventListener("DOMContentLoaded", () => {
</Router> </Router>
); );
}; };
})(); })();
render(<Main />, document.querySelector(".mount"));
render(<Main />, document.querySelector(".mount"));
});