Skip to content

Commit

Permalink
Fix crashing on English
Browse files Browse the repository at this point in the history
  • Loading branch information
vietanhdev committed Aug 6, 2023
1 parent e838ff1 commit e6aeae0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/app/[lng]/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Roboto } from "next/font/google";

import { dir } from "i18next";
import { languages } from "../i18n/settings";
import { useTranslation } from "@/app/i18n/client";
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import { GetCommonSettings } from "@/lib/requests/settings";
Expand All @@ -26,7 +25,6 @@ import MainMenu from "@/components/MainMenu";
import { SWRConfig } from "swr";

export default function RootLayout({ children, params: { lng } }) {
const { t } = useTranslation(lng, "common");
const pathname = usePathname();
const isDashboard = pathname.split("/")[2] === "dashboard";
const DEFAULT_THEME = "cupcake";
Expand Down
4 changes: 3 additions & 1 deletion src/app/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"Home": "Home"
}
30 changes: 15 additions & 15 deletions src/components/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ function MainMenuUser({ lng }) {
}`;
return (
<>
<div className="nav-bar flex justify-evenly w-full fixed bottom-0 md:left-0 md:h-full md:w-auto md:flex-col h-[90px] border-t-[1px] md:border-t-0 md:border-r-[1px] rounded-t-xl md:rounded-none border-primary-500 p-2 bg-primary">
<div className="nav-bar flex justify-evenly md:justify-start md:pt-8 w-full fixed bottom-0 md:left-0 md:h-full md:w-auto md:flex-col h-[90px] border-t-[1px] md:border-t-0 md:border-r-[1px] rounded-t-xl md:rounded-none border-primary-500 p-2 bg-primary">
<style>{navCss}</style>
<div
className={
"nav-item flex flex-col items-center p-2 clickable text-center text-primary" +
"md:mb-4 md:py-4 nav-item flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand All @@ -53,7 +53,7 @@ function MainMenuUser({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color: currentPath === `/${lng}` ? activeTabColor : "#333333",
}}
Expand All @@ -63,7 +63,7 @@ function MainMenuUser({ lng }) {
</div>
<div
className={
"nav-item flex flex-col items-center p-2 clickable text-center" +
"md:mb-4 md:py-4 nav-item flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}/orders`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand All @@ -88,7 +88,7 @@ function MainMenuUser({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color:
currentPath === `/${lng}/orders` ? activeTabColor : "#333333",
Expand All @@ -99,7 +99,7 @@ function MainMenuUser({ lng }) {
</div>
<div
className={
"nav-item flex flex-col items-center p-2 clickable text-center" +
"md:mb-4 md:py-4 nav-item flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}/cart`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand Down Expand Up @@ -133,7 +133,7 @@ function MainMenuUser({ lng }) {
</div>
<div
className={
"nav-item flex flex-col items-center p-2 clickable text-center" +
"md:mb-4 md:py-4 nav-item flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}/user`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand All @@ -155,7 +155,7 @@ function MainMenuUser({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color:
currentPath === `/${lng}/user` ? activeTabColor : "#333333",
Expand Down Expand Up @@ -190,10 +190,10 @@ function MainMenuStaff({ lng }) {

return (
<>
<div className="nav-bar flex justify-evenly w-full fixed bottom-0 md:left-0 md:h-full md:w-auto md:flex-col h-[90px] border-t-[1px] md:border-t-0 md:border-r-[1px] rounded-t-xl md:rounded-none border-primary-500 p-2 bg-primary text-primary">
<div className="nav-bar flex justify-evenly md:justify-start md:pt-8 w-full fixed bottom-0 md:left-0 md:h-full md:w-auto md:flex-col h-[90px] border-t-[1px] md:border-t-0 md:border-r-[1px] rounded-t-xl md:rounded-none border-primary-500 p-2 bg-primary">
<div
className={
"flex flex-col items-center p-2 clickable text-center" +
"md:mb-4 md:py-4 flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand All @@ -216,7 +216,7 @@ function MainMenuStaff({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color: currentPath === `/${lng}` ? activeTabColor : "#333333",
}}
Expand All @@ -226,7 +226,7 @@ function MainMenuStaff({ lng }) {
</div>
<div
className={
"flex flex-col items-center p-2 clickable" +
"md:mb-4 md:py-4 flex flex-col items-center p-2 clickable" +
(currentPath.startsWith(`/${lng}/staffs/orders`)
? " bg-[#ffffff66] rounded-xl"
: "")
Expand All @@ -253,7 +253,7 @@ function MainMenuStaff({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color: currentPath.startsWith(`/${lng}/staffs/orders`)
? activeTabColor
Expand All @@ -265,7 +265,7 @@ function MainMenuStaff({ lng }) {
</div>
<div
className={
"flex flex-col items-center p-2 clickable text-center" +
"md:mb-4 md:py-4 flex flex-col items-center p-2 clickable text-center" +
(currentPath === `/${lng}/user`
? " bg-[#ffffffdd] rounded-xl"
: " bg-[#dddddd88] rounded-xl")
Expand All @@ -287,7 +287,7 @@ function MainMenuStaff({ lng }) {
/>
</svg>
<span
className="flex justify-center text-sm md:text-xl mt-2"
className="flex justify-center text-sm mt-2"
style={{
color:
currentPath === `/${lng}/user` ? activeTabColor : "#333333",
Expand Down

0 comments on commit e6aeae0

Please sign in to comment.