Skip to content

Commit

Permalink
Merge pull request #195 from 202306-NEA-DZ-FEW/194-minor-issues
Browse files Browse the repository at this point in the history
fix(bugs): fix the minor issues related to defaultL locale and portal
  • Loading branch information
0m3ga13 authored Nov 27, 2023
2 parents 498112c + 8bd2c59 commit 8b5e60d
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 32 deletions.
3 changes: 2 additions & 1 deletion messages/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"Welcome": "مرحبا",
"Security": "الحماية",
"Search For Product:": "البحث عن منتج",
"Additional Information": "معلومات إضافية"
"Additional Information": "معلومات إضافية",
"for borrow": "إعارة"
}
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
"background_color": "#ffffff",
"display": "standalone",
"scope": "/",
"start_url": "/"
"start_url": "/en/"
}
2 changes: 1 addition & 1 deletion public/sw.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/app/[locale]/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ export default async function RootLayout({ children, params: { locale } }) {
locale === "en" ? roboto.variable : ""
} font-roboto`}
>
<UserProvider getCurrentUser={getCurrentUser}>
<NextIntlClientProvider
locale={locale}
messages={messages}
className='relative w-screen h-screen'
>
<NextIntlClientProvider
locale={locale}
messages={messages}
className='relative w-screen h-screen'
>
<UserProvider getCurrentUser={getCurrentUser}>
<Navbar />
{children}
{/* <Footer /> */}
<ToastContainer />
<Footer />
<MobileNavigation />
</NextIntlClientProvider>
</UserProvider>
</UserProvider>
</NextIntlClientProvider>
</body>
</html>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/mobileNavigation/MobileNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function MobileNavigation() {
<>
<section
id='bottom-navigation'
className='block sm:hidden fixed inset-x-0 bottom-0 z-50 bg-white shadow max-w-screen-sm'
className='block sm:hidden fixed inset-x-0 bottom-0 pb-1 z-50 bg-white shadow max-w-screen-sm'
>
<div id='tabs' className='flex justify-between'>
<a
Expand Down
18 changes: 4 additions & 14 deletions src/components/mobileSidebar/MobileSidebar.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Image from "next/image";
import Link from "next/link";
import { useTranslations } from "next-intl";
import React from "react";
import { BiCollapseAlt } from "react-icons/bi";
import { CiLogin, CiLogout } from "react-icons/ci";
import { FaFacebook, FaGithub, FaLinkedin } from "react-icons/fa";
Expand Down Expand Up @@ -104,7 +103,7 @@ export default function MobileSidebar({ toggleMobileMenu, isOpen }) {
<div className='space-y-1 mt-5 px-2 pt-2 pb-3 flex flex-col justify-start'>
<Link
href='/sign-in'
onClick={handleSignOutUser}
onClick={toggleMobileMenu}
className='hover:bg-accent hover:text-white rounded-md
px-3 py-2 text-xl font-medium tracking-widest'
>
Expand Down Expand Up @@ -147,23 +146,14 @@ export default function MobileSidebar({ toggleMobileMenu, isOpen }) {
{t("Donate")}
</Link>
</li>
<li>
<a
onClick={handleSignOutUser}
className='text-titleContent hover:text-accent font-semibold block pb-2 '
href='https://www.github.com/creativetimofficial?ref=njs-profile'
>
{t("Donate")}
</a>
</li>
</ul>
<span className='block uppercase font-semibold mb-2'>
{t("About LACITÉ")}
</span>
<ul className='list-unstyled'>
<li>
<Link
onClick={handleSignOutUser}
onClick={toggleMobileMenu}
href='https://github.com/202306-NEA-DZ-FEW/student-store-team-2'
target='_blank'
rel='noopener noreferrer'
Expand All @@ -174,7 +164,7 @@ export default function MobileSidebar({ toggleMobileMenu, isOpen }) {
</li>
<li>
<Link
onClick={handleSignOutUser}
onClick={toggleMobileMenu}
className='text-titleContent hover:text-accent font-semibold block pb-2 '
href='/#how-it-works'
>
Expand All @@ -183,7 +173,7 @@ export default function MobileSidebar({ toggleMobileMenu, isOpen }) {
</li>
<li>
<Link
onClick={handleSignOutUser}
onClick={toggleMobileMenu}
className='text-titleContent hover:text-accent font-semibold block pb-2 '
href='/about'
>
Expand Down
18 changes: 18 additions & 0 deletions src/components/portal/Portal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* The above code is a React component that creates a portal to render its children into the document
* body.
* @returns The `Portal` component is returning the result of the `createPortal` function.
*/
"use client";

import { createPortal } from "react-dom";

const Portal = ({ children }) => {
if (typeof window === "object") {
const mount = document.body;

return createPortal(children, mount);
}
};

export default Portal;
4 changes: 2 additions & 2 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { supabseMiddleware } from "./utils/supabase/middleware";

const intlMiddleware = createMiddleware({
locales: ["en", "ar"],

defaultLocale: "ar",
localeDetection: true,
defaultLocale: "en",
});

export async function middleware(request) {
Expand Down

0 comments on commit 8b5e60d

Please sign in to comment.