-
- by
-
PrimeReact
+
);
};
diff --git a/layout/AppMenu.tsx b/layout/AppMenu.tsx
index b581ecf2..14f85869 100644
--- a/layout/AppMenu.tsx
+++ b/layout/AppMenu.tsx
@@ -4,7 +4,6 @@ import React, { useContext } from 'react';
import AppMenuitem from './AppMenuitem';
import { LayoutContext } from './context/layoutcontext';
import { MenuProvider } from './context/menucontext';
-import Link from 'next/link';
import { AppMenuItem } from '@/types';
const AppMenu = () => {
@@ -12,163 +11,31 @@ const AppMenu = () => {
const model: AppMenuItem[] = [
{
- label: 'Home',
- items: [{ label: 'Dashboard', icon: 'pi pi-fw pi-home', to: '/' }]
+ label: 'Баракчалар',
+ items: [{ label: 'Башкы баракча', icon: 'pi pi-fw pi-home', to: '/' }]
},
{
- label: 'UI Components',
+ label: '',
items: [
- { label: 'Form Layout', icon: 'pi pi-fw pi-id-card', to: '/uikit/formlayout' },
- { label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/uikit/input' },
- { label: 'Float Label', icon: 'pi pi-fw pi-bookmark', to: '/uikit/floatlabel' },
- { label: 'Invalid State', icon: 'pi pi-fw pi-exclamation-circle', to: '/uikit/invalidstate' },
- { label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/uikit/button', class: 'rotated-icon' },
- { label: 'Table', icon: 'pi pi-fw pi-table', to: '/uikit/table' },
- { label: 'List', icon: 'pi pi-fw pi-list', to: '/uikit/list' },
- { label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/uikit/tree' },
- { label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/uikit/panel' },
- { label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/uikit/overlay' },
- { label: 'Media', icon: 'pi pi-fw pi-image', to: '/uikit/media' },
- { label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/uikit/menu', preventExact: true },
- { label: 'Message', icon: 'pi pi-fw pi-comment', to: '/uikit/message' },
- { label: 'File', icon: 'pi pi-fw pi-file', to: '/uikit/file' },
- { label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/uikit/charts' },
- { label: 'Misc', icon: 'pi pi-fw pi-circle', to: '/uikit/misc' }
+ { label: 'Dashboard', icon: 'pi pi-fw pi-id-card', to: '/' },
+ { label: 'Курстар', icon: 'pi pi-fw pi-id-card', to: '/course' },
+ // { label: 'Input', icon: 'pi pi-fw pi-check-square', to: '/uikit/input' },
+ // { label: 'Float Label', icon: 'pi pi-fw pi-bookmark', to: '/uikit/floatlabel' },
+ // { label: 'Invalid State', icon: 'pi pi-fw pi-exclamation-circle', to: '/uikit/invalidstate' },
+ // { label: 'Button', icon: 'pi pi-fw pi-mobile', to: '/uikit/button', class: 'rotated-icon' },
+ // { label: 'Table', icon: 'pi pi-fw pi-table', to: '/uikit/table' },
+ // { label: 'List', icon: 'pi pi-fw pi-list', to: '/uikit/list' },
+ // { label: 'Tree', icon: 'pi pi-fw pi-share-alt', to: '/uikit/tree' },
+ // { label: 'Panel', icon: 'pi pi-fw pi-tablet', to: '/uikit/panel' },
+ // { label: 'Overlay', icon: 'pi pi-fw pi-clone', to: '/uikit/overlay' },
+ // { label: 'Media', icon: 'pi pi-fw pi-image', to: '/uikit/media' },
+ // { label: 'Menu', icon: 'pi pi-fw pi-bars', to: '/uikit/menu', preventExact: true },
+ // { label: 'Message', icon: 'pi pi-fw pi-comment', to: '/uikit/message' },
+ // { label: 'File', icon: 'pi pi-fw pi-file', to: '/uikit/file' },
+ // { label: 'Chart', icon: 'pi pi-fw pi-chart-bar', to: '/uikit/charts' },
+ // { label: 'Misc', icon: 'pi pi-fw pi-circle', to: '/uikit/misc' }
]
},
- {
- label: 'Prime Blocks',
- items: [
- { label: 'Free Blocks', icon: 'pi pi-fw pi-eye', to: '/blocks', badge: 'NEW' },
- { label: 'All Blocks', icon: 'pi pi-fw pi-globe', url: 'https://blocks.primereact.org', target: '_blank' }
- ]
- },
- {
- label: 'Utilities',
- items: [
- { label: 'PrimeIcons', icon: 'pi pi-fw pi-prime', to: '/utilities/icons' },
- { label: 'PrimeFlex', icon: 'pi pi-fw pi-desktop', url: 'https://primeflex.org/', target: '_blank' }
- ]
- },
- {
- label: 'Pages',
- icon: 'pi pi-fw pi-briefcase',
- to: '/pages',
- items: [
- {
- label: 'Landing',
- icon: 'pi pi-fw pi-globe',
- to: '/landing'
- },
- {
- label: 'Auth',
- icon: 'pi pi-fw pi-user',
- items: [
- {
- label: 'Login',
- icon: 'pi pi-fw pi-sign-in',
- to: '/auth/login'
- },
- {
- label: 'Error',
- icon: 'pi pi-fw pi-times-circle',
- to: '/auth/error'
- },
- {
- label: 'Access Denied',
- icon: 'pi pi-fw pi-lock',
- to: '/auth/access'
- }
- ]
- },
- {
- label: 'Crud',
- icon: 'pi pi-fw pi-pencil',
- to: '/pages/crud'
- },
- {
- label: 'Timeline',
- icon: 'pi pi-fw pi-calendar',
- to: '/pages/timeline'
- },
- {
- label: 'Not Found',
- icon: 'pi pi-fw pi-exclamation-circle',
- to: '/pages/notfound'
- },
- {
- label: 'Empty',
- icon: 'pi pi-fw pi-circle-off',
- to: '/pages/empty'
- }
- ]
- },
- {
- label: 'Hierarchy',
- items: [
- {
- label: 'Submenu 1',
- icon: 'pi pi-fw pi-bookmark',
- items: [
- {
- label: 'Submenu 1.1',
- icon: 'pi pi-fw pi-bookmark',
- items: [
- { label: 'Submenu 1.1.1', icon: 'pi pi-fw pi-bookmark' },
- { label: 'Submenu 1.1.2', icon: 'pi pi-fw pi-bookmark' },
- { label: 'Submenu 1.1.3', icon: 'pi pi-fw pi-bookmark' }
- ]
- },
- {
- label: 'Submenu 1.2',
- icon: 'pi pi-fw pi-bookmark',
- items: [{ label: 'Submenu 1.2.1', icon: 'pi pi-fw pi-bookmark' }]
- }
- ]
- },
- {
- label: 'Submenu 2',
- icon: 'pi pi-fw pi-bookmark',
- items: [
- {
- label: 'Submenu 2.1',
- icon: 'pi pi-fw pi-bookmark',
- items: [
- { label: 'Submenu 2.1.1', icon: 'pi pi-fw pi-bookmark' },
- { label: 'Submenu 2.1.2', icon: 'pi pi-fw pi-bookmark' }
- ]
- },
- {
- label: 'Submenu 2.2',
- icon: 'pi pi-fw pi-bookmark',
- items: [{ label: 'Submenu 2.2.1', icon: 'pi pi-fw pi-bookmark' }]
- }
- ]
- }
- ]
- },
- {
- label: 'Get Started',
- items: [
- {
- label: 'Documentation',
- icon: 'pi pi-fw pi-question',
- to: '/documentation'
- },
- {
- label: 'Figma',
- url: 'https://www.dropbox.com/scl/fi/bhfwymnk8wu0g5530ceas/sakai-2023.fig?rlkey=u0c8n6xgn44db9t4zkd1brr3l&dl=0',
- icon: 'pi pi-fw pi-pencil',
- target: '_blank'
- },
- {
- label: 'View Source',
- icon: 'pi pi-fw pi-search',
- url: 'https://github.com/primefaces/sakai-react',
- target: '_blank'
- }
- ]
- }
];
return (
@@ -177,10 +44,6 @@ const AppMenu = () => {
{model.map((item, i) => {
return !item?.seperator ?
:
;
})}
-
-
-
-
);
diff --git a/layout/AppTopbar.tsx b/layout/AppTopbar.tsx
index 9a2c8849..3356cbe4 100644
--- a/layout/AppTopbar.tsx
+++ b/layout/AppTopbar.tsx
@@ -1,13 +1,19 @@
/* eslint-disable @next/next/no-img-element */
import Link from 'next/link';
-import { classNames } from 'primereact/utils';
import React, { forwardRef, useContext, useImperativeHandle, useRef } from 'react';
+import Tiered from '@/app/components/popUp/Tiered';
+import FancyLinkBtn from '@/app/components/buttons/FancyLinkBtn';
+import { classNames } from 'primereact/utils';
import { AppTopbarRef } from '@/types';
import { LayoutContext } from './context/layoutcontext';
+import { useMediaQuery } from '@/hooks/useMediaQuery';
+import { usePathname } from 'next/navigation';
+import { logout } from '@/utils/logout';
const AppTopbar = forwardRef
((props, ref) => {
- const { layoutConfig, layoutState, onMenuToggle, showProfileSidebar } = useContext(LayoutContext);
+ const { layoutConfig, layoutState, onMenuToggle, showProfileSidebar, user, setUser, setGlobalLoading } = useContext(LayoutContext);
+
const menubuttonRef = useRef(null);
const topbarmenuRef = useRef(null);
const topbarmenubuttonRef = useRef(null);
@@ -18,36 +24,223 @@ const AppTopbar = forwardRef((props, ref) => {
topbarmenubutton: topbarmenubuttonRef.current
}));
+ const pathName = usePathname();
+ const media = useMediaQuery('(max-width: 1000px)');
+
+ const items = [
+ {
+ label: 'Ачык онлайн курстар',
+ icon: 'pi pi-file',
+ items: [],
+ link: '/login'
+ },
+ {
+ label: 'Бакалавриат',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Магистратура',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Кошумча билим берүү',
+ icon: 'pi pi-file',
+ items: []
+ }
+ ];
+
+ const mobileMenu = [
+ user
+ ? {
+ label: 'Профиль',
+ icon: 'pi pi-user',
+ items: [
+ {
+ label: (
+
+
+ {user?.last_name}
+ {user?.name}
+
+
{user?.email}
+
+ ),
+ },
+ {
+ label: 'Чыгуу',
+ icon: 'pi pi-sign-out',
+ items: [],
+ command: () => {
+ logout({ setUser, setGlobalLoading });
+ }
+ }
+ ]
+ }
+ : {
+ label: 'Кирүү',
+ icon: 'pi pi-sign-in',
+ items: [],
+ link: '/auth/login'
+ },
+ {
+ label: 'Каталог',
+ icon: 'pi pi-list',
+ items: [
+ {
+ label: 'Ачык онлайн курстар',
+ icon: 'pi pi-file',
+ items: [],
+ link: '/login'
+ },
+ {
+ label: 'Бакалавриат',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Магистратура',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Кошумча билим берүү',
+ icon: 'pi pi-file',
+ items: []
+ }
+ ]
+ },
+ {
+ label: 'Бакалавриат',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Магистратура',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Кошумча билим берүү',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Кошумча билим берүү',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'КАТАЛОГ',
+ icon: 'pi pi-list',
+ items: [
+ {
+ label: 'Ачык онлайн курстар',
+ icon: 'pi pi-file',
+ items: [],
+ link: '/login'
+ },
+ {
+ label: 'Бакалавриат',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Магистратура',
+ icon: 'pi pi-file',
+ items: []
+ },
+ {
+ label: 'Кошумча билим берүү',
+ icon: 'pi pi-file',
+ items: []
+ }
+ ]
+ }
+ ];
+
+ // profile
+ const profileItems = [
+ {
+ label: (
+
+
+ {user?.last_name}
+ {user?.name}
+
+
{user?.email}
+
+ )
+ },
+ {
+ label: 'Чыгуу',
+ icon: 'pi pi-sign-out',
+ items: [],
+ command: () => {
+ logout({ setUser, setGlobalLoading });
+ }
+ }
+ ];
+
return (
-
-
SAKAI
+ {/*
*/}
+
+
Цифровой кампус ОшГУ
-
-
-
-
-
-
-
+ {pathName !== '/' ? (
+
+
+
+ ) : (
+ ''
+ )}
-
-
- Calendar
-
-
-
- Profile
-
-
-
-
- Settings
-
-
+
+ {media ? (
+
+ ) : (
+
+
+
+
+ ОшМУнун сайты
+
+
+ Байланыш
+
+
+ )}
+
+ {user && user ? (
+
+
+
+ ) : (
+
+
+
+ )}
+
);
diff --git a/layout/context/layoutcontext.tsx b/layout/context/layoutcontext.tsx
index 58e491dc..3581eb9d 100644
--- a/layout/context/layoutcontext.tsx
+++ b/layout/context/layoutcontext.tsx
@@ -1,6 +1,13 @@
'use client';
-import React, { useState, createContext } from 'react';
+import React, { useState, createContext, useEffect } from 'react';
import { LayoutState, ChildContainerProps, LayoutConfig, LayoutContextProps } from '@/types';
+import SessionManager from '@/app/components/SessionManager';
+import GlobalLoading from '@/app/components/loading/GlobalLoading';
+import Message from '@/app/components/messages/Message';
+import { ConfirmDialog } from 'primereact/confirmdialog';
+import { User } from '@/types/user';
+import { MessageType } from '@/types/messageType';
+
export const LayoutContext = createContext({} as LayoutContextProps);
export const LayoutProvider = ({ children }: ChildContainerProps) => {
@@ -22,6 +29,15 @@ export const LayoutProvider = ({ children }: ChildContainerProps) => {
menuHoverActive: false
});
+ // 👇 Добавляем пользователя
+ const [user, setUser] = useState(null);
+
+ // Глобальная загрузка
+ const [globalLoading, setGlobalLoading] = useState(true);
+
+ // Сообщение об ошибке/успехе
+ const [message, setMessage] = useState({state:false, value:{}});
+
const onMenuToggle = () => {
if (isOverlay()) {
setLayoutState((prevLayoutState) => ({ ...prevLayoutState, overlayMenuActive: !prevLayoutState.overlayMenuActive }));
@@ -52,8 +68,20 @@ export const LayoutProvider = ({ children }: ChildContainerProps) => {
layoutState,
setLayoutState,
onMenuToggle,
- showProfileSidebar
+ showProfileSidebar,
+ user,
+ setUser,
+ globalLoading,
+ setGlobalLoading,
+ message,
+ setMessage
};
- return {children} ;
+ return
+
+
+
+ {message.state && }
+ {children}
+ ;
};
diff --git a/layout/layout.tsx b/layout/layout.tsx
index 8421b2ca..ef069787 100644
--- a/layout/layout.tsx
+++ b/layout/layout.tsx
@@ -131,7 +131,7 @@ const Layout = ({ children }: ChildContainerProps) => {