update public/index.html, AppRouter.js, src/views/Home/Navbar/Laptop/index.js and src/views/Home/Navbar/Laptop/index.scss

front
amir hosein gorji 3 years ago
parent ded3106345
commit 042384df90
  1. 150
      public/index.html
  2. 2
      src/AppRouter.js
  3. 52
      src/views/Home/Navbar/Laptop/index.js
  4. 11
      src/views/Home/Navbar/Laptop/index.scss

@ -1,85 +1,75 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1"
user-scalable="false"
/>
<meta name="theme-color" content="#000000" />
<meta name="description" content="دانوین" />
<link
href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css"
rel="stylesheet"
/>
<meta name="mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>دانوین</title> <head>
<!-- Google Tag Manager --> <meta charset="utf-8" />
<script src="ar.js"></script> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<script src="en.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1" user-scalable="false" />
<script> <meta name="theme-color" content="#000000" />
const lang = localStorage.getItem("language"); <meta name="description" content="دانوین" />
window.ar = ar; <link href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css" rel="stylesheet" />
window.en = en; <meta name="mobile-web-app-capable" content="yes" />
function t(val) { <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
const lang_ = window[lang]; <meta name="apple-mobile-web-app-capable" content="yes" />
if (!lang_) return val; <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
if (!lang_[val]) console.error(val);
return lang_[val] || "*" + val;
}
(function (w, d, s, l, i) { <title>دانوین</title>
w[l] = w[l] || []; <!-- Google Tag Manager -->
w[l].push({ <script src="ar.js"></script>
"gtm.start": new Date().getTime(), <script src="en.js"></script>
event: "gtm.js", <script>
}); const lang = localStorage.getItem("language");
var f = d.getElementsByTagName(s)[0], window.lang = lang
j = d.createElement(s), window.ar = ar;
dl = l != "dataLayer" ? "&l=" + l : ""; window.en = en;
j.async = true; function t(val) {
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl; const lang_ = window[lang];
f.parentNode.insertBefore(j, f); if (!lang_) return val;
})(window, document, "script", "dataLayer", "GTM-WVV8H9L"); if (!lang_[val]) console.error(val);
</script> return lang_[val] || "*" + val;
<!-- End Google Tag Manager --> }
</head>
<body> (function (w, d, s, l, i) {
<!-- Google Tag Manager (noscript) --> w[l] = w[l] || [];
<noscript w[l].push({
><iframe "gtm.start": new Date().getTime(),
src="https://www.googletagmanager.com/ns.html?id=GTM-WVV8H9L" event: "gtm.js",
height="0" });
width="0" var f = d.getElementsByTagName(s)[0],
style="display: none; visibility: hidden" j = d.createElement(s),
></iframe dl = l != "dataLayer" ? "&l=" + l : "";
></noscript> j.async = true;
<!-- End Google Tag Manager (noscript) --> j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
<div id="root"></div> f.parentNode.insertBefore(j, f);
<script> })(window, document, "script", "dataLayer", "GTM-WVV8H9L");
if ("serviceWorker" in navigator) { </script>
window.addEventListener("load", function () { <!-- End Google Tag Manager -->
navigator.serviceWorker </head>
.register("./serviceworker.js")
.then((registration) => { <body>
// Registration was successful <!-- Google Tag Manager (noscript) -->
console.log( <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WVV8H9L" height="0" width="0"
"ServiceWorker registration successful with scope: ", style="display: none; visibility: hidden"></iframe></noscript>
registration.scope <!-- End Google Tag Manager (noscript) -->
); <div id="root"></div>
}) <script>
.catch((err) => { if ("serviceWorker" in navigator) {
console.log(err); window.addEventListener("load", function () {
}); navigator.serviceWorker
}); .register("./serviceworker.js")
} .then((registration) => {
</script> // Registration was successful
</body> console.log(
</html> "ServiceWorker registration successful with scope: ",
registration.scope
);
})
.catch((err) => {
console.log(err);
});
});
}
</script>
</body>
</html>

@ -218,7 +218,7 @@ class AppRouter extends Component {
)} )}
</Route> </Route>
<Route exact path={"/profile"}> <Route exact path={"/profile"}>
{mobile ? status ? <Auth page={"profile"} /> : null : null} {status ? <Auth page={"profile"} /> : null}
</Route> </Route>
<Route exact path={"/qr-scan"}> <Route exact path={"/qr-scan"}>
{mobile ? ( {mobile ? (

@ -129,9 +129,29 @@ class LaptopNavbar extends Component {
{window.t("خروج")}{" "} {window.t("خروج")}{" "}
</MenuItem> </MenuItem>
</Menu> </Menu>
<select className="language-select"> <select
{["fa", "en", "ar"].map((lang, index) => ( className="language-select"
<option key={index}>{lang}</option> onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
window.location.reload();
}}
>
{console.log(window.lang)}
{[
{ key: "فارسی", lang: "fa", default: true },
{ key: "English", lang: "en" },
{ key: "العربیه", lang: "ar" },
].map((el, index) => (
<option
key={el.lang}
value={el.lang}
selected={
(!window.lang && el.default) || el.lang == window.lang
}
>
{el.key}
</option>
))} ))}
</select> </select>
<div <div
@ -162,9 +182,29 @@ class LaptopNavbar extends Component {
</> </>
) : ( ) : (
<div className="d-flex"> <div className="d-flex">
<select className="language-select"> <select
{["fa", "en", "ar"].map((lang, index) => ( className="language-select"
<option key={index}>{lang}</option> onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
window.location.reload();
}}
value={window.lang}
>
{console.log(window.lang)}
{[
{ key: "فارسی", lang: "fa", default: true },
{ key: "English", lang: "en" },
{ key: "العربیه", lang: "ar" },
].map((el, index) => (
<option
key={el.lang}
value={el.lang}
selected={
(!window.lang && el.default) || el.lang == window.lang
}
>
{el.key}
</option>
))} ))}
</select> </select>
<Link <Link

@ -3,15 +3,16 @@
margin: 0px auto; margin: 0px auto;
.language-select { .language-select {
border: none; border: 1px solid #6cbe44;
outline: none; outline: none;
width: 50px; width: 100px;
background-color: #6cbe44;
color: white; color: #6cbe44;
font-weight: 500; font-weight: 500;
margin: 0px 10px; margin: 0px 10px;
border-radius: 5px; border-radius: 5px;
padding: 0px 4px; padding: 3px;
} }
&__header { &__header {

Loading…
Cancel
Save