progres day 1

This commit is contained in:
smanylov
2025-11-25 17:13:16 +07:00
parent 10668aa997
commit 40766ae67b
26 changed files with 1336 additions and 216 deletions
+30
View File
@@ -0,0 +1,30 @@
'use server'
export async function testConnect() {
try {
const response = await fetch('http://localhost:8080/api/auth/register', {
method: 'POST',
body: JSON.stringify({
"firstName": "Serg",
"secondName": "Fedorovich",
"lastName": "Tankan",
"email": "gggpetst2test@e.ru",
"password": "1121231412"
}),
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
}
});
let parsed = await response.json();
console.log('all fine??');
console.log(parsed);
return parsed;
} catch (error) {
throw error;
}
}
+2 -24
View File
@@ -1,27 +1,10 @@
:root {
--background: #ffffff;
--foreground: #171717;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}
html,
body {
max-width: 100vw;
overflow-x: hidden;
}
body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Segoe UI', sans-serif;
}
* {
@@ -31,12 +14,7 @@ body {
}
a {
color: inherit;
text-decoration: none;
}
@media (prefers-color-scheme: dark) {
html {
color-scheme: dark;
}
}
@import "tailwindcss";
+4 -17
View File
@@ -1,21 +1,9 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import NavLinks from '@/app/ui/nav-links'
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "No copy",
description: "No copy",
};
export default function RootLayout({
@@ -24,9 +12,8 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable}`}>
<NavLinks />
<html lang="ru">
<body className={``}>
{children}
</body>
</html>
+13
View File
@@ -0,0 +1,13 @@
import { Metadata } from 'next';
export const metadata: Metadata = {
title: 'Login',
};
export default function Home() {
return (
<div>
plz login
</div>
);
}
-141
View File
@@ -1,141 +0,0 @@
.page {
--background: #fafafa;
--foreground: #fff;
--text-primary: #000;
--text-secondary: #666;
--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
--button-secondary-border: #ebebeb;
display: flex;
min-height: 100vh;
align-items: center;
justify-content: center;
font-family: var(--font-geist-sans);
background-color: var(--background);
}
.main {
display: flex;
min-height: 100vh;
width: 100%;
max-width: 800px;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
background-color: var(--foreground);
padding: 120px 60px;
}
.intro {
display: flex;
flex-direction: column;
align-items: flex-start;
text-align: left;
gap: 24px;
}
.intro h1 {
max-width: 320px;
font-size: 40px;
font-weight: 600;
line-height: 48px;
letter-spacing: -2.4px;
text-wrap: balance;
color: var(--text-primary);
}
.intro p {
max-width: 440px;
font-size: 18px;
line-height: 32px;
text-wrap: balance;
color: var(--text-secondary);
}
.intro a {
font-weight: 500;
color: var(--text-primary);
}
.ctas {
display: flex;
flex-direction: row;
width: 100%;
max-width: 440px;
gap: 16px;
font-size: 14px;
}
.ctas a {
display: flex;
justify-content: center;
align-items: center;
height: 40px;
padding: 0 16px;
border-radius: 128px;
border: 1px solid transparent;
transition: 0.2s;
cursor: pointer;
width: fit-content;
font-weight: 500;
}
a.primary {
background: var(--text-primary);
color: var(--background);
gap: 8px;
}
a.secondary {
border-color: var(--button-secondary-border);
}
/* Enable hover only on non-touch devices */
@media (hover: hover) and (pointer: fine) {
a.primary:hover {
background: var(--button-primary-hover);
border-color: transparent;
}
a.secondary:hover {
background: var(--button-secondary-hover);
border-color: transparent;
}
}
@media (max-width: 600px) {
.main {
padding: 48px 24px;
}
.intro {
gap: 16px;
}
.intro h1 {
font-size: 32px;
line-height: 40px;
letter-spacing: -1.92px;
}
}
@media (prefers-color-scheme: dark) {
.logo {
filter: invert();
}
.page {
--background: #000;
--foreground: #000;
--text-primary: #ededed;
--text-secondary: #999;
--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
--button-secondary-border: #1a1a1a;
}
}
+3
View File
@@ -0,0 +1,3 @@
.mainContainter {
margin-left: 280px;
}
+6 -2
View File
@@ -1,5 +1,6 @@
import styles from "./page.module.css";
import styles from "./page.module.scss";
import { Metadata } from 'next';
import Link from 'next/link';
export const metadata: Metadata = {
title: 'Home page',
@@ -10,8 +11,11 @@ export default function Home() {
<div className={styles.page}>
<main className={styles.main}>
<div className={styles.intro}>
Home page
Home page11
</div>
<Link key={'dashboard'}
href={'/pages/dashboard'}
>dash board</Link>
</main>
</div>
);
+19
View File
@@ -0,0 +1,19 @@
import { Metadata } from 'next';
import Button from '@/app/ui/button'
export const metadata: Metadata = {
title: 'Dashboard',
};
export default function Home() {
return (
<div>
<main>
<div>
Dashboard
</div>
<Button/>
</main>
</div>
);
}
+11
View File
@@ -0,0 +1,11 @@
import NavLinks from '@/app/ui/nav-links'
import styles from '@/app/page.module.scss'
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div className="flex">
<NavLinks />
<div className={`${styles.mainContainter}`}>{children}</div>
</div>
);
}
+17
View File
@@ -0,0 +1,17 @@
import { Metadata } from 'next';
export const metadata: Metadata = {
title: 'page 1',
};
export default function Home() {
return (
<div>
<main>
<div>
page 1
</div>
</main>
</div>
);
}
+17
View File
@@ -0,0 +1,17 @@
import { Metadata } from 'next';
export const metadata: Metadata = {
title: 'page 2',
};
export default function Home() {
return (
<div>
<main>
<div>
page 2
</div>
</main>
</div>
);
}
+16
View File
@@ -0,0 +1,16 @@
'use client'
import { testConnect } from '@/app/api/action';
async function clickHandler() {
console.log('click');
testConnect();
}
export default function Button() {
return (
<button onClick={() => {
clickHandler();
}}>button</button>
);
}
+12
View File
@@ -0,0 +1,12 @@
import styles from './ui.module.scss';
export default function Logo() {
return (
<div className={`${styles.logo}`}>
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2L2 7v10c0 5.55 3.84 9.74 9 11 5.16-1.26 9-5.45 9-11V7l-10-5z"></path>
</svg>
No copy
</div>
)
}
+17 -14
View File
@@ -3,23 +3,24 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import clsx from 'clsx';
import styles from '@/app/page.module.css'
import styles from './ui.module.scss'
import Logo from '@/app/ui/logo';
const links = [
{
name: 'Home',
href: '/',
icon: 'HomeIcon'
name: 'Главная',
href: '/pages/dashboard',
img: 'M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z'
},
{
name: 'Page1',
href: '/page1',
icon: 'page1Icon',
href: '/pages/page1',
img: ''
},
{
name: 'Page2',
href: '/page2',
icon: 'page2Icon',
href: '/pages/page2',
img: ''
}
];
@@ -27,22 +28,24 @@ export default function NavLinks() {
const pathname = usePathname();
return (
<div className='bg-[#fafafa]'>
<nav className={`${styles.nav}` + " flex max-w-[800px] w-full"}>
<div className=''>
<nav className={`${styles.sidebar}`}>
<Logo />
{links.map((link) => {
const LinkIcon = link.icon;
return (
<Link
key={link.name}
href={link.href}
className={clsx(
'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3',
`flex ${styles['nav-item']}`,
{
'bg-sky-100 text-blue-600': pathname === link.href,
'bg-[#5659f1]': pathname === link.href,
},
)}
>
<LinkIcon />
<svg viewBox="0 0 24 24" fill="currentColor">
<path d={link.img}></path>
</svg>
<p className="hidden md:block">{link.name}</p>
</Link>
);
+36
View File
@@ -0,0 +1,36 @@
.sidebar {
width: 280px;
background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
padding: 30px 0;
border-radius: 0 30px 30px 0;
position: fixed;
height: 100vh;
overflow-y: auto;
z-index: 100;
}
.nav-item {
margin-bottom: 8px;
svg {
margin-right: 15px;
width: 20px;
height: 20px;
}
}
.logo {
display: flex;
align-items: center;
padding: 0 30px 40px;
color: white;
font-size: 24px;
font-weight: 600;
text-transform: uppercase;
svg {
width: 32px;
height: 32px;
margin-right: 15px;
}
}
+13
View File
@@ -0,0 +1,13 @@
import { NextResponse, NextRequest } from 'next/server';
const isLogin = true;
export function proxy(request: NextRequest) {
if (request.nextUrl.pathname !== '/login' && !isLogin) {
return NextResponse.redirect(new URL('/login', request.url));
}
}
export const config = {
matcher: ['/((?!api|_next/static|_next/image|.*\\.png$).*)']
};