Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
661 changes: 661 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion orval.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ config({ path: '.env' })

export default defineConfig({
client: {
input: `${process.env['API_DOCS']}/openapi.json`,
input: process.env['API_DOCS'],
output: {
schemas: './src/generated'
}
Expand Down
146 changes: 77 additions & 69 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,79 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "tsx -r dotenv/config ./src/server/server.ts",
"build": "next build",
"start": "next start -p 14701",
"lint": "next lint",
"generate": "orval --config ./orval.config.ts"
},
"dependencies": {
"@hookform/resolvers": "^3.10.0",
"@kinescope/react-kinescope-player": "^0.5.3",
"@next/third-parties": "15.2.4",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-collapsible": "^1.1.3",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.6",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-progress": "^1.1.2",
"@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-select": "^2.1.6",
"@radix-ui/react-separator": "^1.1.2",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-tabs": "^1.1.3",
"@radix-ui/react-tooltip": "^1.1.8",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.8.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dotenv": "^16.4.7",
"framer-motion": "^12.4.2",
"geist": "^1.3.1",
"input-otp": "^1.4.2",
"js-cookie": "^3.0.5",
"lucide-react": "^0.483.0",
"next": "15.2.4",
"next-themes": "^0.4.4",
"react": "19.1.0",
"react-circular-progressbar": "^2.2.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.54.2",
"react-icons": "^5.4.0",
"react-turnstile": "^1.1.4",
"recharts": "^2.15.1",
"sonner": "^1.7.4",
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.24.1"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "19.0.12",
"@types/react-dom": "19.0.4",
"orval": "7.4.1",
"postcss": "^8",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.11",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"overrides": {
"@types/react": "19.0.12",
"@types/react-dom": "19.0.4"
}
"name": "frontend",
"version": "1.0.0",
"description": "Frontend for Teacoder platform",
"author": {
"name": "Vadim",
"url": "https://teacoder.ru",
"email": "admin@teacoder.ru"
},
"private": true,
"license": "AGPL-3.0-only",
"scripts": {
"dev": "tsx -r dotenv/config ./src/server/server.ts",
"build": "next build",
"start": "next start -p 14701",
"lint": "next lint",
"generate": "orval --config ./orval.config.ts"
},
"dependencies": {
"@hookform/resolvers": "^3.10.0",
"@kinescope/react-kinescope-player": "^0.5.3",
"@next/third-parties": "15.2.4",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-collapsible": "^1.1.3",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.6",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-progress": "^1.1.2",
"@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-select": "^2.1.6",
"@radix-ui/react-separator": "^1.1.2",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.3",
"@radix-ui/react-tooltip": "^1.1.8",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.8.4",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dotenv": "^16.4.7",
"framer-motion": "^12.4.2",
"geist": "^1.3.1",
"input-otp": "^1.4.2",
"js-cookie": "^3.0.5",
"lucide-react": "^0.483.0",
"next": "15.2.4",
"next-themes": "^0.4.4",
"react": "19.1.0",
"react-circular-progressbar": "^2.2.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.54.2",
"react-icons": "^5.4.0",
"react-turnstile": "^1.1.4",
"recharts": "^2.15.1",
"sonner": "^1.7.4",
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.24.1"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "19.0.12",
"@types/react-dom": "19.0.4",
"orval": "7.4.1",
"postcss": "^8",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.11",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"overrides": {
"@types/react": "19.0.12",
"@types/react-dom": "19.0.4"
}
}
Binary file added public/opengraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/api/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export const createAccount = async (data: CreateUserRequest) => {
return response.data
}

export const sendEmailVerification = () => instance.post('/auth/account/verify')

export const verifyEmail = (code: string) =>
instance.post(`/auth/account/verify/${code}`)

export const sendPasswordReset = (data: SendPasswordResetRequest) =>
api.post('/auth/account/reset_password', data)

Expand Down
24 changes: 24 additions & 0 deletions src/api/external.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type {
ExternalConnectResponse,
ExternalStatusResponse
} from '../generated'

import { instance } from './instance'

export const getAuthUrl = async (provider: 'google' | 'github') =>
await instance
.post<ExternalConnectResponse>(`/auth/external/login/${provider}`)
.then(response => response.data)

export const fetchExternalStatus = async () =>
await instance
.get<ExternalStatusResponse>('/auth/external')
.then(response => response.data)

export const getConnectUrl = async (provider: 'google' | 'github') =>
await instance
.post<ExternalConnectResponse>(`/auth/external/connect/${provider}`)
.then(response => response.data)

export const unlinkAccount = async (provider: 'google' | 'github') =>
await instance.delete(`/auth/external/${provider}`)
6 changes: 4 additions & 2 deletions src/app/(public)/document/privacy-policy/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Metadata } from 'next'
import Link from 'next/link'

import { ROUTES } from '@/src/constants'

export const metadata: Metadata = {
title: 'Политика конфиденциальности'
}
Expand Down Expand Up @@ -29,7 +31,7 @@ export default function PrivacyPage() {
Пользовательского соглашения (далее — «Соглашение»),
размещённого и/или доступного в сети Интернет по
адресу:{' '}
<Link href='/document/terms-of-use'>
<Link href={ROUTES.terms}>
https://teacoder.ru/document/terms-of-use
</Link>
, а также иных заключаемых с Пользователем
Expand Down Expand Up @@ -289,7 +291,7 @@ export default function PrivacyPage() {
<p>
6.2. Действующая редакция Политики находится на
Сайте в сети Интернет по адресу
<Link href='/document/privacy-policy'>
<Link href={ROUTES.privacy}>
https://teacoder.ru/document/privacy-policy
</Link>
.
Expand Down
6 changes: 4 additions & 2 deletions src/app/(public)/document/terms-of-use/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type { Metadata } from 'next'
import Link from 'next/link'

import { ROUTES } from '@/src/constants'

export const metadata: Metadata = {
title: 'Пользовательское соглашение'
}
Expand Down Expand Up @@ -96,7 +98,7 @@ export default function AgreementPage() {
1.4.1. Политики конфиденциальности, размещённой
и/или доступной на Сайте в сети Интернет по
адресу{' '}
<Link href='/document/privacy-policy'>
<Link href={ROUTES.privacy}>
https://teacoder.ru/document/privacy-policy
</Link>
.
Expand Down Expand Up @@ -129,7 +131,7 @@ export default function AgreementPage() {
<p>
1.6. Действующая редакция Соглашения находится на
Сайте в сети Интернет по адресу
<Link href='/document/terms-of-use'>
<Link href={ROUTES.terms}>
https://teacoder.ru/document/terms-of-use
</Link>
.
Expand Down
11 changes: 11 additions & 0 deletions src/app/account/connections/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Metadata } from 'next'

import { Connections } from '@/src/components/account/connections/connections'

export const metadata: Metadata = {
title: 'Сторонние сервисы'
}

export default function ConnectionsPage() {
return <Connections />
}
29 changes: 29 additions & 0 deletions src/app/auth/callback/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use client'

import { useRouter, useSearchParams } from 'next/navigation'
import { useEffect } from 'react'

import { instance } from '@/src/api'
import { EllipsisLoader } from '@/src/components/shared/ellipsis-loader'
import { setSessionToken } from '@/src/lib/cookies/session'

export default function AuthCallbackPage() {
const router = useRouter()

useEffect(() => {
const hash = window.location.hash
const token = new URLSearchParams(hash.slice(1)).get('token')

if (token) {
setSessionToken(token)
instance.defaults.headers['X-Session-Token'] = token
router.push('/account/settings')
}
}, [router])

return (
<div className='flex min-h-screen items-center justify-center'>
<EllipsisLoader />
</div>
)
}
11 changes: 11 additions & 0 deletions src/app/auth/verify/[token]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { Metadata } from 'next'

import { VerifyEmail } from '@/src/components/auth/verify-email'

export const metadata: Metadata = {
title: 'Верификация почты'
}

export default async function VerifyEmailPage() {
return <VerifyEmail />
}
8 changes: 4 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const metadata: Metadata = {
locale: 'ru_RU',
images: [
{
url: new URL(APP_CONFIG.baseUrl + '/touch-icons/512x512.png'),
url: new URL(APP_CONFIG.baseUrl + '/opengraph.png'),
width: 512,
height: 512,
alt: SEO.name
Expand All @@ -56,7 +56,7 @@ export const metadata: Metadata = {
description: SEO.description,
images: [
{
url: new URL(APP_CONFIG.baseUrl + '/touch-icons/512x512.png'),
url: new URL(APP_CONFIG.baseUrl + '/opengraph.png'),
width: 512,
height: 512,
alt: SEO.name
Expand All @@ -69,11 +69,11 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html className={GeistSans.variable} lang='ru' suppressHydrationWarning>
<body className='min-h-screen font-sans antialiased'>
<body className='flex h-full w-full flex-col font-sans'>
<TanstackQueryProvider>
<ThemeProvider
attribute='class'
defaultTheme='system'
defaultTheme='light'
enableSystem
disableTransitionOnChange
>
Expand Down
9 changes: 9 additions & 0 deletions src/app/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { EllipsisLoader } from '../components/shared/ellipsis-loader'

export default function LoadingPage() {
return (
<div className='flex min-h-screen items-center justify-center'>
<EllipsisLoader />
</div>
)
}
3 changes: 2 additions & 1 deletion src/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Metadata } from 'next'
import Link from 'next/link'

import { Button } from '../components/ui/button'
import { ROUTES } from '../constants/routes'

export const metadata: Metadata = {
title: 'Страница не найдена'
Expand All @@ -18,7 +19,7 @@ export default function NotFoundPage() {
</p>
<div className='mt-6 flex flex-col items-center justify-center gap-2 sm:flex-row sm:gap-3'>
<Button variant='primary' asChild>
<Link href='/'>
<Link href={ROUTES.home}>
<ChevronLeft />
На главную
</Link>
Expand Down
Loading