Skip to content

Commit

Permalink
+REDUX-fixies
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil-Oberlev committed Aug 16, 2024
1 parent 17e5937 commit d24522b
Show file tree
Hide file tree
Showing 22 changed files with 411 additions and 121 deletions.
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app/globals.css
12 changes: 2 additions & 10 deletions app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client'

import Layout from '@/components/layout/index'
import Layout from '@/components/layout'
import { useAuthForm } from '@/hooks/useAuthForm'
import { useFormField } from '@/hooks/useFormField'
import styles from '~/styles/Auth.module.css'
Expand All @@ -23,21 +23,13 @@ const Login = () => {
passwordError,
} = useAuthForm('login', formValues)

const handleFormSubmit = (e: React.FormEvent) => {
handleSubmit(e)
}

return (
<div className={styles.container}>
<div>
<h1 className={styles.title}>Вход</h1>
<p className={styles.subtitle}>Войдите в свой аккаунт</p>
</div>
<form
className={styles.form}
onSubmit={handleFormSubmit}
autoComplete="on"
>
<form className={styles.form} onSubmit={handleSubmit} autoComplete="on">
<Layout.InputField
id="email"
label="Email"
Expand Down
1 change: 0 additions & 1 deletion app/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import Layout from '@/components/layout/index'
import { useAuthForm } from '@/hooks/useAuthForm'
import { useFormField } from '@/hooks/useFormField'
import React from 'react'
import styles from '~/styles/Auth.module.css'

const Register = () => {
Expand Down
4 changes: 2 additions & 2 deletions app/head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const seo = {
'Freelance, IT, Technology, Software Development, Web Development, UX/UI Design, IT Services, Remote Work, IT Jobs',
robots: 'index, follow',
canonical: 'https://itbrz.ru',
ogImage: '/og-image.png',
ogImage: '/opengraph-image.png',
themeColor: '#007bff',
language: 'ru',
}
Expand Down Expand Up @@ -46,7 +46,7 @@ export const RootHead = () => (
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-icon.png" />

<meta httpEquiv="Content-Security-Policy" content="default-src 'self';" />
{/* <meta httpEquiv="Content-Security-Policy" content="default-src 'self';" /> */}
<meta name="rating" content="general" />
<link rel="manifest" href="/manifest.json" />
<meta name="format-detection" content="telephone=no" />
Expand Down
54 changes: 54 additions & 0 deletions app/profile/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import Layout from '@/components/layout'

const ProfilePage = () => {
const mockProfileData = {
avatarUrl: 'https://via.placeholder.com/150',
name: 'Иван Иванов',
nickname: 'ivan_dev',
status: 'Доступен',
bio: 'Я опытный разработчик с более чем 5 годами опыта в разработке веб-приложений. Моя специализация - фронтенд разработка с использованием React и TypeScript.',
skills: [
{ name: 'JavaScript', level: 90 },
{ name: 'TypeScript', level: 85 },
{ name: 'React', level: 80 },
{ name: 'Next.js', level: 75 },
{ name: 'Tailwind CSS', level: 70 },
],
projects: [
{
title: 'Проект 1',
description: 'Описание проекта 1',
link: '#',
image: 'https://via.placeholder.com/400',
},
{
title: 'Проект 2',
description: 'Описание проекта 2',
link: '#',
image: 'https://via.placeholder.com/400',
},
],
reviews: [
{
client: 'ООО "Компания"',
comment: 'Отличная работа! Быстро и качественно.',
rating: 5,
clientImage: 'https://via.placeholder.com/50',
},
{
client: 'ИП "Клиент"',
comment: 'Хороший специалист, рекомендую!',
rating: 4,
clientImage: 'https://via.placeholder.com/50',
},
],
}

return (
<div className="min-h-screen bg-gray-100">
<Layout.Profile {...mockProfileData} />
</div>
)
}

export default ProfilePage
22 changes: 0 additions & 22 deletions app/sitemap.xml

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "itb-front-next",
"na`m`e": "itb-front-next",
"version": "0.1.0",
"private": true,
"type": "module",
Expand Down Expand Up @@ -27,6 +27,7 @@
"dependencies": {
"@reduxjs/toolkit": "^2.2.7",
"js-cookie": "^3.0.5",
"lucide-react": "^0.427.0",
"next": "14.2.5",
"prettier": "^3.3.1",
"react": "^18",
Expand All @@ -51,7 +52,7 @@
"prettier": "3.3.3",
"stylelint": "^16.8.1",
"stylelint-config-standard": "^36.0.0",
"tailwindcss": "^3.4.1",
"tailwindcss": "^3.4.10",
"ts-jest": "^29.2.4",
"ts-node": "^10.9.2",
"typescript": "^5"
Expand Down
Binary file removed public/og-image.png
Binary file not shown.
Binary file added public/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://it-birjha.ru/dashboard</loc><changefreq>daily</changefreq><priority>1.0</priority></url><url><loc>https://it-birjha.ru/register</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://it-birjha.ru/login</loc><changefreq>monthly</changefreq><priority>0.8</priority></url></urlset>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>https://it-birjha.ru/dashboard</loc>
<changefreq>daily</changefreq>
<priority>1.0</priority>
</url>
<url>
<loc>https://it-birjha.ru/register</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://it-birjha.ru/login</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset>
25 changes: 4 additions & 21 deletions src/components/layout/Header/Header.module.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
.header {
display: -webkit-box;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
justify-content: space-between;
align-items: center;
height: 5em;
padding: 15px;
}

.header__logo {
width: 100px;
height: 100%;
background-color: tomato;
margin-right: auto;
}

.header__buttons {
display: -webkit-box;
display: flex;
-webkit-box-pack: end;
-ms-flex-pack: end;
justify-content: flex-end;
gap: 30px;
padding: 10px 20px;
background-color: #fff;
border-bottom: 1px solid #ddd;
}
52 changes: 33 additions & 19 deletions src/components/layout/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
'use client'

import { initializeAuth } from '@/redux/slices/authSlice'
import { RootState } from '@/redux/store'
import Cookies from 'js-cookie'
import Link from 'next/link'
import { useSelector } from 'react-redux'
import { useEffect } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import styles from './Header.module.css'

export const Header = () => {
const dispatch = useDispatch()
const isLoggedIn = useSelector((state: RootState) => state.auth.isLoggedIn)

// Убедитесь, что состояние инициализируется один раз
useEffect(() => {
const token = Cookies.get('token')
const loggedIn = localStorage.getItem('isLoggedIn') === 'true'
dispatch(initializeAuth())

// Если есть токен или состояние в localStorage указывает на авторизацию
if (token || loggedIn) {
dispatch(initializeAuth())
}
}, [dispatch])

// Прямое использование состояния isLoggedIn
return (
<header className={styles.header}>
<div className={styles.header__logo}></div>
<nav>
<ul className={styles.header__buttons}>
<li>
<Link href="/make-order">Сделать заказ</Link>
</li>
{!isLoggedIn && (
<>
<li>
<Link href="/login">Вход</Link>
</li>
<li>
<Link href="/register">Регистрация</Link>
</li>
</>
)}
</ul>
</nav>
<ul className={styles.header__buttons}>
<li>
<Link href="/make-order">Сделать заказ</Link>
</li>
{!isLoggedIn && (
<>
<li>
<Link href="/login">Вход</Link>
</li>
<li>
<Link href="/register">Регистрация</Link>
</li>
</>
)}
</ul>
</header>
)
}
29 changes: 29 additions & 0 deletions src/components/layout/Profile/Profile.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export interface Skill {
name: string
level: number
}

export interface Project {
title: string
description: string
link: string
image: string
}

export interface Review {
client: string
comment: string
rating: number
clientImage: string
}

export interface ProfileProps {
avatarUrl: string
name: string
nickname: string
status: string
bio: string
skills: Skill[]
projects: Project[]
reviews: Review[]
}
79 changes: 79 additions & 0 deletions src/components/layout/Profile/Profile.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
.container {
background-color: #f9fafb;
border-radius: 8px;
padding: 2rem;
box-shadow: 0 2px 4px rgba(0 0 0 10%);
}

.header {
display: flex;
align-items: center;
margin-bottom: 1.5rem;
}

.avatar {
width: 80px;
height: 80px;
border-radius: 50%;
margin-right: 1rem;
}

.info {
flex-grow: 1;
}

.name {
font-size: 1.75rem;
font-weight: bold;
}

.nickname,
.status {
font-size: 1rem;
color: #6b7280;
}

.section {
margin-top: 2rem;
}

.skill__item {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
}

.skillbar__container {
width: 60%;
background-color: #e5e7eb;
border-radius: 0.25rem;
height: 0.75rem;
}

.skillbar {
background-color: #3b82f6;
height: 100%;
border-radius: 0.25rem;
}

.project__card {
background-color: #fff;
border-radius: 8px;
padding: 1rem;
box-shadow: 0 1px 3px rgba(0 0 0 10%);
max-width: 250px;
margin-bottom: 1rem;
}

.project__image {
width: 100%;
border-radius: 6px;
margin-bottom: 0.75rem;
}

.review__item {
background-color: #fff;
border-radius: 8px;
padding: 1rem;
box-shadow: 0 1px 3px rgba(0 0 0 10%);
}
Loading

0 comments on commit d24522b

Please sign in to comment.