Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c87ff72
Пока не получилось перевести студента
May 31, 2025
8097b6c
Перевод студента
Jun 1, 2025
15fc38e
перевел основные семантикики, но не работает tailwind
Jun 2, 2025
a059336
Баги успешно пофикселись
Jun 2, 2025
5058bda
login page update
Jun 2, 2025
0279c5d
Логин почти готов
Jun 3, 2025
cfe7af0
Авторизация готова
Jun 4, 2025
fe3b208
Global loading
Jun 5, 2025
5c373d9
Добавил сообщения, немного исправил загрузку
Jun 5, 2025
a62cf3c
castom profile
Jun 5, 2025
b0d517f
banner fix
Jun 7, 2025
51866c6
Структура добавление курса
Jun 11, 2025
0553eba
С курсами почти закончил
Jun 12, 2025
149f8c2
merge course-add
Jun 12, 2025
94c5db6
Course theme 1.2
Jun 14, 2025
cc5c021
type fix, course cash add
Jun 19, 2025
2d4e74d
fix not found
Jun 19, 2025
cfcf797
fix update values
Jun 19, 2025
1843ec5
sidebar update
Jun 21, 2025
306e8b8
primereact primeflex fix
Jun 21, 2025
f4273bd
stepper
Jun 23, 2025
197e8a3
переход на tabview
Jun 23, 2025
acb448b
lesson/ верстка таба
Jun 23, 2025
c44a610
ckeditor готов для использования
Jun 24, 2025
3b55470
эффект добавлен
Jun 24, 2025
03d1871
validate
Jun 25, 2025
92e2bd7
validation proccess
Jun 25, 2025
bbb278e
lfjdsakl
Jun 25, 2025
c06cf3b
login fix
Jun 26, 2025
eac7924
fixing
Jun 27, 2025
01b7565
создания карточек, добавление редактирования (верстка)
Jun 27, 2025
6e97ced
Подготовка скедитора
Jun 28, 2025
62b5973
Оптимизация уроков
Jun 28, 2025
b91cd09
Настройка некоторых моментов
Jun 30, 2025
fb0e0f9
Общая структура основных тегов
Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 95 additions & 41 deletions app/(full-page)/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,110 @@ import { Password } from 'primereact/password';
import { LayoutContext } from '../../../../layout/context/layoutcontext';
import { InputText } from 'primereact/inputtext';
import { classNames } from 'primereact/utils';
import InfoBanner from '@/app/components/InfoBanner';

import { useForm } from 'react-hook-form';
import { schema } from '@/schemas/authSchema';
import { yupResolver } from '@hookform/resolvers/yup';
import { Controller } from 'react-hook-form';
import { getUser, login } from '@/services/auth';
import FancyLinkBtn from '@/app/components/buttons/FancyLinkBtn';
import { getToken } from '@/utils/auth';
import { logout } from '@/utils/logout';
import { LoginType } from '@/types/login';

const LoginPage = () => {
const [password, setPassword] = useState('');
const [checked, setChecked] = useState(false);
const { layoutConfig } = useContext(LayoutContext);
const { layoutConfig, setUser, setMessage, setGlobalLoading } = useContext(LayoutContext);

const router = useRouter();
const containerClassName = classNames('surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden', { 'p-input-filled': layoutConfig.inputStyle === 'filled' });
// const containerClassName = classNames('surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden', { 'p-input-filled': layoutConfig.inputStyle === 'filled' });

return (
<div className={containerClassName}>
<div className="flex flex-column align-items-center justify-content-center">
<img src={`/layout/images/logo-${layoutConfig.colorScheme === 'light' ? 'dark' : 'white'}.svg`} alt="Sakai logo" className="mb-5 w-6rem flex-shrink-0" />
<div
style={{
borderRadius: '56px',
padding: '0.3rem',
background: 'linear-gradient(180deg, var(--primary-color) 10%, rgba(33, 150, 243, 0) 30%)'
}}
>
<div className="w-full surface-card py-8 px-5 sm:px-8" style={{ borderRadius: '53px' }}>
<div className="text-center mb-5">
<img src="/demo/images/login/avatar.png" alt="Image" height="50" className="mb-3" />
<div className="text-900 text-3xl font-medium mb-3">Welcome, Isabel!</div>
<span className="text-600 font-medium">Sign in to continue</span>
</div>
const {
register,
handleSubmit,
formState: { errors },
control
} = useForm({
resolver: yupResolver(schema),
mode: 'onChange'
});

<div>
<label htmlFor="email1" className="block text-900 text-xl font-medium mb-2">
Email
</label>
<InputText id="email1" type="text" placeholder="Email address" className="w-full md:w-30rem mb-5" style={{ padding: '1rem' }} />
const onSubmit = async (value: LoginType) => {
console.log('Данные пользователя: ', value);

<label htmlFor="password1" className="block text-900 font-medium text-xl mb-2">
Password
</label>
<Password inputId="password1" value={password} onChange={(e) => setPassword(e.target.value)} placeholder="Password" toggleMask className="w-full mb-5" inputClassName="w-full p-3 md:w-30rem"></Password>
const user = await login(value);
console.log(user);
if (user && user.success) {
document.cookie = `access_token=${user.token.access_token}; path=/; Secure; SameSite=Strict; expires=${user.token.expires_at}`;

const token = user.token.access_token;
if (token) {
const res = await getUser(token);
try {
if (res?.success) {
console.log(res);
if (res?.user.is_working) {
window.location.href = '/course';
}
} else {
logout({ setUser, setGlobalLoading });
setMessage({
state: true,
value: { severity: 'error', summary: 'Ошибка', detail: 'Ошибка при авторизации' }
}); // messege - Ошибка при авторизации
console.log('Ошибка при получении пользователя');
}
} catch (error) {
logout({ setUser, setGlobalLoading });
setMessage({
state: true,
value: { severity: 'error', summary: 'Ошибка', detail: 'Ошибка при авторизации' }
}); // messege - Ошибка при авторизации
console.log('Ошибка при получении пользователя');
}
}
} else {
console.log('Ошибка при авторизации');
}
};

const onError = (errors:any) => {
console.log('Ошибки формы:', errors);
setMessage({
state: true,
value: { severity: 'error', summary: 'Катаа', detail: 'ПОвтор' }
}); // messege - Ошибка при авторизации
};

<div className="flex align-items-center justify-content-between mb-5 gap-5">
<div className="flex align-items-center">
<Checkbox inputId="rememberme1" checked={checked} onChange={(e) => setChecked(e.checked ?? false)} className="mr-2"></Checkbox>
<label htmlFor="rememberme1">Remember me</label>
</div>
<a className="font-medium no-underline ml-2 text-right cursor-pointer" style={{ color: 'var(--primary-color)' }}>
Forgot password?
</a>
</div>
<Button label="Sign In" className="w-full p-3 text-xl" onClick={() => router.push('/')}></Button>
return (
<div className={'flex flex-col gap-4'}>
<InfoBanner title="Кирүү" />
<div className="flex gap-4 flex-column lg:flex-row items-center justify-evenly px-4 mb-8">
<div className="user-img">
<img src="/layout/images/man.png" className="w-[500px]" alt="" />
</div>

<div className="w-[90%] sm:w-[500px] shadow-2xl py-6 px-3 md:py-8 sm:px-4 md:px-8 rounded">
<form onSubmit={handleSubmit(onSubmit, onError)} className="flex flex-col gap-4 md:gap-6">
<div className="flex flex-col">
<label htmlFor="email1" className="block text-900 text-[16px] md:text-xl font-medium mb-1 md:mb-2">
MyEdu email
</label>
<InputText {...register('email')} id="email1" type="text" placeholder="[email protected]" className="w-[90%] p-2 sm:p-3" />
{errors.email && <b className="text-red-500 text-[12px] ml-2">{errors.email.message}</b>}
</div>
<div className="flex flex-col">
<Controller
name="password"
control={control}
defaultValue=""
render={({ field }) => <Password {...field} toggleMask className="w-[100%]" inputClassName="w-[90%] p-2 sm:p-3" inputStyle={{ marginRight: '30px' }} feedback={false} />}
/>
{errors.password && <b className="text-red-500 text-[12px] ml-2">{errors.password.message}</b>}
</div>
</div>

<FancyLinkBtn btnWidth={'90%'} backround={'--mainColor'} effectBg={'--titleColor'} title={'Кирүү'} />
</form>
</div>
</div>
</div>
Expand Down
105 changes: 57 additions & 48 deletions app/(full-page)/pages/notfound/page.tsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,63 @@
import React from 'react';
import Link from 'next/link';
import FancyLinkBtn from '@/app/components/buttons/FancyLinkBtn';

const NotFoundPage = () => {
return (
<div className="surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden">
<div className="flex flex-column align-items-center justify-content-center">
<img src="/demo/images/notfound/logo-blue.svg" alt="Sakai logo" className="mb-5 w-6rem flex-shrink-0" />
<div
style={{
borderRadius: '56px',
padding: '0.3rem',
background: 'linear-gradient(180deg, rgba(33, 150, 243, 0.4) 10%, rgba(33, 150, 243, 0) 30%)'
}}
>
<div className="w-full surface-card py-8 px-5 sm:px-8 flex flex-column align-items-center" style={{ borderRadius: '53px' }}>
<span className="text-blue-500 font-bold text-3xl">404</span>
<h1 className="text-900 font-bold text-5xl mb-2">Not Found</h1>
<div className="text-600 mb-5">Requested resource is not available</div>
<Link href="/" className="w-full flex align-items-center py-5 border-300 border-bottom-1">
<span className="flex justify-content-center align-items-center bg-cyan-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
<i className="text-50 pi pi-fw pi-table text-2xl"></i>
</span>
<span className="ml-4 flex flex-column">
<span className="text-900 lg:text-xl font-medium mb-1">Frequently Asked Questions</span>
<span className="text-600 lg:text-lg">Ultricies mi quis hendrerit dolor.</span>
</span>
</Link>
<Link href="/" className="w-full flex align-items-center py-5 border-300 border-bottom-1">
<span className="flex justify-content-center align-items-center bg-orange-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
<i className="pi pi-fw pi-question-circle text-50 text-2xl"></i>
</span>
<span className="ml-4 flex flex-column">
<span className="text-900 lg:text-xl font-medium mb-1">Solution Center</span>
<span className="text-600 lg:text-lg">Phasellus faucibus scelerisque eleifend.</span>
</span>
</Link>
<Link href="/" className="w-full flex align-items-center mb-5 py-5 border-300 border-bottom-1">
<span className="flex justify-content-center align-items-center bg-indigo-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
<i className="pi pi-fw pi-unlock text-50 text-2xl"></i>
</span>
<span className="ml-4 flex flex-column">
<span className="text-900 lg:text-xl font-medium mb-1">Permission Manager</span>
<span className="text-600 lg:text-lg">Accumsan in nisl nisi scelerisque</span>
</span>
</Link>
</div>
</div>
</div>
const NotFoundPage = ({titleMessege}) => {
return <div>
<div className="flex flex-col gap-2 justify-center items-center m-4">
<p className="text-[16px] font-bold">{titleMessege}</p>
<Link href={'/'}>
<FancyLinkBtn btnWidth={'240px'} backround={'--mainColor'} effectBg={'--titleColor'} title={'Башкы баракчага кайтуу'} />
</Link>
</div>
);
};
</div>;
// return (
// <div className="surface-ground flex align-items-center justify-content-center min-h-screen min-w-screen overflow-hidden">
// <div className="flex flex-column align-items-center justify-content-center">
// <img src="/demo/images/notfound/logo-blue.svg" alt="Sakai logo" className="mb-5 w-6rem flex-shrink-0" />
// <div
// style={{
// borderRadius: '56px',
// padding: '0.3rem',
// background: 'linear-gradient(180deg, rgba(33, 150, 243, 0.4) 10%, rgba(33, 150, 243, 0) 30%)'
// }}
// >
// <div className="w-full surface-card py-8 px-5 sm:px-8 flex flex-column align-items-center" style={{ borderRadius: '53px' }}>
// <span className="text-blue-500 font-bold text-3xl">404</span>
// <h1 className="text-900 font-bold text-5xl mb-2">Not Found</h1>
// <div className="text-600 mb-5">Requested resource is not available</div>
// <Link href="/" className="w-full flex align-items-center py-5 border-300 border-bottom-1">
// <span className="flex justify-content-center align-items-center bg-cyan-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
// <i className="text-50 pi pi-fw pi-table text-2xl"></i>
// </span>
// <span className="ml-4 flex flex-column">
// <span className="text-900 lg:text-xl font-medium mb-1">Frequently Asked Questions</span>
// <span className="text-600 lg:text-lg">Ultricies mi quis hendrerit dolor.</span>
// </span>
// </Link>
// <Link href="/" className="w-full flex align-items-center py-5 border-300 border-bottom-1">
// <span className="flex justify-content-center align-items-center bg-orange-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
// <i className="pi pi-fw pi-question-circle text-50 text-2xl"></i>
// </span>
// <span className="ml-4 flex flex-column">
// <span className="text-900 lg:text-xl font-medium mb-1">Solution Center</span>
// <span className="text-600 lg:text-lg">Phasellus faucibus scelerisque eleifend.</span>
// </span>
// </Link>
// <Link href="/" className="w-full flex align-items-center mb-5 py-5 border-300 border-bottom-1">
// <span className="flex justify-content-center align-items-center bg-indigo-400 border-round" style={{ height: '3.5rem', width: '3.5rem' }}>
// <i className="pi pi-fw pi-unlock text-50 text-2xl"></i>
// </span>
// <span className="ml-4 flex flex-column">
// <span className="text-900 lg:text-xl font-medium mb-1">Permission Manager</span>
// <span className="text-600 lg:text-lg">Accumsan in nisl nisi scelerisque</span>
// </span>
// </Link>
// </div>
// </div>
// </div>
// </div>
// );
};

export default NotFoundPage;
Loading