Skip to content

Commit

Permalink
fix: move chatbot outside topbar component and place into layout instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmtslmngcl committed Dec 13, 2024
1 parent b26ead2 commit ed38e43
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 11 deletions.
6 changes: 5 additions & 1 deletion src/app/about/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { Topbar } from '@/components/Topbar/Topbar';

export const metadata: Metadata = {
Expand All @@ -9,7 +10,10 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Topbar />
<div className="mb-20">
<Topbar />
<HungerMapChatbot />
</div>
<main className="flex flex-col gap-6 lg:gap-10 p-5 lg:p-10 text-content !pt-1">{children}</main>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/data_sources/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { Topbar } from '@/components/Topbar/Topbar';

export const metadata: Metadata = {
Expand All @@ -9,7 +10,10 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Topbar />
<div className="mb-20">
<Topbar />
<HungerMapChatbot />
</div>
<main className="flex flex-col gap-6 lg:gap-10 p-5 lg:p-10 text-content !pt-1">{children}</main>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/disclaimer/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { Topbar } from '@/components/Topbar/Topbar';

export const metadata: Metadata = {
Expand All @@ -9,7 +10,10 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Topbar />
<div className="mb-20">
<Topbar />
<HungerMapChatbot />
</div>
<main className="flex flex-col gap-6 lg:gap-10 p-5 lg:p-10 text-content">{children}</main>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/download-portal/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { Topbar } from '@/components/Topbar/Topbar';

export const metadata: Metadata = {
Expand All @@ -9,7 +10,10 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Topbar />
<div className="mb-20">
<Topbar />
<HungerMapChatbot />
</div>
<main className="flex flex-col gap-6 lg:gap-10 p-5 lg:p-10 text-content">{children}</main>
</div>
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/wiki/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Metadata } from 'next';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { Topbar } from '@/components/Topbar/Topbar';

export const metadata: Metadata = {
Expand All @@ -9,7 +10,10 @@ export const metadata: Metadata = {
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div>
<Topbar />
<div className="mb-20">
<Topbar />
<HungerMapChatbot />
</div>
<main className="flex flex-col gap-6 lg:gap-10 p-5 lg:p-10 text-content !pt-1">{children}</main>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chatbot/Chatbot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default function HungerMapChatbot() {

return (
<div
className={clsx('absolute', {
className={clsx('fixed', {
'inset-0 z-chatbotFullScreen': isFullScreen,
'top-4 right-4': !isFullScreen,
'z-chatbotExpanded': isOpen,
Expand Down
6 changes: 1 addition & 5 deletions src/components/Topbar/Topbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
import { usePathname } from 'next/navigation';
import { useState } from 'react';

import HungerMapChatbot from '@/components/Chatbot/Chatbot';
import { LogoWithText } from '@/components/LogoWithText/LogoWithText';
import { ThemeSwitch } from '@/components/Sidebar/ThemeSwitch';
import { pageLinks } from '@/domain/constant/PageLinks';
Expand All @@ -23,7 +22,7 @@ export function Topbar() {
const pathname = usePathname();

return (
<Navbar onMenuOpenChange={setIsMenuOpen} maxWidth="full">
<Navbar onMenuOpenChange={setIsMenuOpen} maxWidth="full" className="fixed pr-10">
<NavbarContent className="flex-1 min-w-[200px] mt-4">
<NavbarMenuToggle aria-label={isMenuOpen ? 'Close menu' : 'Open menu'} className="md:hidden" />
<NavbarBrand>
Expand All @@ -43,9 +42,6 @@ export function Topbar() {
<NavbarItem className="mt-4">
<ThemeSwitch isIconOnly />
</NavbarItem>
<NavbarItem className="flex items-center">
<HungerMapChatbot />
</NavbarItem>
</NavbarContent>
<NavbarMenu>
{pageLinks.map((item) => (
Expand Down

0 comments on commit ed38e43

Please sign in to comment.