Skip to content

Commit

Permalink
header and footer now in root layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Dec 13, 2024
1 parent 0d29d73 commit 26704e4
Show file tree
Hide file tree
Showing 22 changed files with 585 additions and 595 deletions.
15 changes: 6 additions & 9 deletions src/app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useCookie from "@/app/modules/utils/useCookie";
import { useEffect, useRef, useState } from "react";
import style_root from '@/app/styles/admin/page.module.css';
import { redirect, useRouter } from "next/navigation";
import Header, { Query } from "@/app/modules/components/Header";
import { Query } from "@/app/modules/components/Header";
import AdaptiveGrid from "../modules/components/AdaptiveGrid";
import { Fira_Code } from "next/font/google";
import Link from "next/link";
Expand Down Expand Up @@ -155,14 +155,11 @@ const Admin = () => {
const updateUsers = user && (user.permissions.includes('updateusers') || user.permissions.includes('superadmin'));

return (
<body>
<Header />
<main className={style_root.main}>
<div className={style_root.main_container}>
{updateUsers && <Users />}
</div>
</main>
</body>
<main className={style_root.main}>
<div className={style_root.main_container}>
{updateUsers && <Users />}
</div>
</main>
);
}

Expand Down
92 changes: 44 additions & 48 deletions src/app/contacts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Link from "next/link";
import Header from "@/app/modules/components/Header";
import style from './styles/page.module.css';
import style_card from './styles/card.module.css';
import Image from "next/image";
Expand Down Expand Up @@ -62,55 +61,52 @@ const Card = (props: CardProps) => {

const Home = () => {
return (
<body>
<Header />
<main className={style.main}>
<div className={style.main_container}>
<h1 style={{ marginTop: 0, width: '100%', textAlign: 'center', fontSize: '2rem' }}>Контакты</h1>
<div className={style.cards_container}>
<Card
name="AndcoolSystems"
image="/static/contacts/dino.gif"
description="Главный разработчик"
color="#f8a824"
site_name="andcoolsystems"
links={[
{
name: 'Telegram',
URL: 'https://t.me/andcool_systems',
type: 'telegram'
},
{
name: 'Сайт',
URL: 'https://andcool.ru',
type: 'URL'
}
]}
/>
<main className={style.main}>
<div className={style.main_container}>
<h1 style={{ marginTop: 0, width: '100%', textAlign: 'center', fontSize: '2rem' }}>Контакты</h1>
<div className={style.cards_container}>
<Card
name="AndcoolSystems"
image="/static/contacts/dino.gif"
description="Главный разработчик"
color="#f8a824"
site_name="andcoolsystems"
links={[
{
name: 'Telegram',
URL: 'https://t.me/andcool_systems',
type: 'telegram'
},
{
name: 'Сайт',
URL: 'https://andcool.ru',
type: 'URL'
}
]}
/>

<Card
name="Shape STD"
image="/static/contacts/dino_like.gif"
description="Продакшн, дизайн повязок"
color="#689295"
site_name="gamdav_"
links={[
{
name: 'Telegram',
URL: 'https://t.me/shapestd',
type: 'telegram'
},
{
name: 'ВК',
URL: 'https://vk.com/shapestd',
type: 'URL'
}
]}
/>
</div>
<Card
name="Shape STD"
image="/static/contacts/dino_like.gif"
description="Продакшн, дизайн повязок"
color="#689295"
site_name="gamdav_"
links={[
{
name: 'Telegram',
URL: 'https://t.me/shapestd',
type: 'telegram'
},
{
name: 'ВК',
URL: 'https://vk.com/shapestd',
type: 'URL'
}
]}
/>
</div>
</main>
</body>
</div>
</main>
);
}

Expand Down
10 changes: 9 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { CookiesProvider } from 'next-client-cookies/server';
import { headers } from 'next/headers';
import meta from '@/app/meta.json';
import { merge } from 'lodash';
import Footer from "./modules/components/Footer";
import Header from "./modules/components/Header";

export const generateMetadata = async (): Promise<Metadata | undefined> => {
const headersList = headers();
Expand All @@ -20,7 +22,13 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
return (
<CookiesProvider>
<Providers>
{children}
<body>
<div>
<Header />
{children}
</div>
<Footer />
</body>
</Providers>
</CookiesProvider>
);
Expand Down
6 changes: 2 additions & 4 deletions src/app/me/notifications/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React, { useEffect, useRef, useState } from 'react';
import { redirect, } from "next/navigation";
import Style from "@/app/styles/me/notifications.module.css";
import Header from "@/app/modules/components/Header";
import useCookie from '@/app/modules/utils/useCookie';
import { Me } from '@/app/modules/components/MeSidebar';
import { formatDate } from '@/app/modules/components/Card';
Expand Down Expand Up @@ -58,8 +57,7 @@ const Notifications = () => {
})

return (
<body>
<Header />
<main>
<Me>
<div id="sidebar" className={Style.container} style={notifications != null ? { opacity: "1", transform: "translateY(0)" } : { opacity: "0", transform: "translateY(50px)" }}>
{notifications?.data.length > 0 ?
Expand All @@ -73,7 +71,7 @@ const Notifications = () => {
}
</div>
</Me>
</body>
</main>
);
}

Expand Down
7 changes: 2 additions & 5 deletions src/app/me/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { authApi } from "@/app/modules/utils/api";
import { useRouter, useSearchParams } from "next/navigation";
import styles from "@/app/styles/me/me.module.css";
import { Tooltip } from '@/app/modules/components/Tooltip';
import Header from "@/app/modules/components/Header";
import useCookie from '@/app/modules/utils/useCookie';
import { Cookies, useCookies } from 'next-client-cookies';
import { Bandage, Role } from '@/app/interfaces';
Expand Down Expand Up @@ -66,8 +65,7 @@ const Main = () => {
}, [isLogged]);

return (
<body>
<Header />
<main>
{!!code ?
<Loading loadingStatus={loadingStatus} /> :
!isLogged ?
Expand All @@ -84,9 +82,8 @@ const Main = () => {
<SimpleGrid>{elements}</SimpleGrid>
</div>
</Me>

}
</body>
</main>
);
}

Expand Down
6 changes: 2 additions & 4 deletions src/app/me/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { redirect } from "next/navigation";
import Style from "@/app/styles/me/connections.module.css";
import Style_themes from "@/app/styles/me/themes.module.css";
import Style_safety from "@/app/styles/me/safety.module.css";
import Header from "@/app/modules/components/Header";
import useCookie from '@/app/modules/utils/useCookie';
import Image from 'next/image';
import { Me } from '@/app/modules/components/MeSidebar';
Expand Down Expand Up @@ -83,8 +82,7 @@ const Page = () => {


return (
<body>
<Header />
<main>
{logged &&
<Me>
<div
Expand All @@ -103,7 +101,7 @@ const Page = () => {
</div>
</Me>
}
</body >
</main>
);
}

Expand Down
6 changes: 2 additions & 4 deletions src/app/me/stars/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import React from 'react';
import { useEffect, useState, useRef } from 'react';
import style_sidebar from "@/app/styles/me/sidebar.module.css";
import Header from "@/app/modules/components/Header";
import useCookie from '@/app/modules/utils/useCookie';
import { Cookies, useCookies } from 'next-client-cookies';
import styles_me from "@/app/styles/me/me.module.css";
Expand Down Expand Up @@ -44,8 +43,7 @@ const Main = () => {
}, [logged])

return (
<body>
<Header />
<main>
{isLogged &&
<Me>
{data && data.length != 0 ?
Expand All @@ -58,7 +56,7 @@ const Main = () => {
}
</Me>
}
</body>
</main>
);
}

Expand Down
6 changes: 5 additions & 1 deletion src/app/modules/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { setTheme } from "@/app/me/settings/setTheme";
import style from "@/app/styles/footer.module.css";
import { useCookies } from "next-client-cookies";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";

const Footer = () => {
const cookies = useCookies();
const path = usePathname();
const themes = ['default', 'amoled'];
const initialThemeIndex = themes.indexOf(cookies.get('theme_main') || 'default');
const [theme, setTheme_] = useState<number>(initialThemeIndex !== -1 ? initialThemeIndex : 0);
Expand All @@ -21,8 +23,10 @@ const Footer = () => {
setTheme(themes[theme], cookies);
}, [theme]);

if (path === '/') return null;

return (
<footer className={style.footer}>
<footer className={style.footer} style={{ marginLeft: '1rem', marginRight: '1rem' }}>
<div className={style.container}>
<div className={style.links}>
<div className={style.links_cont}>
Expand Down
Loading

0 comments on commit 26704e4

Please sign in to comment.