commit 9baa68258e0c744c7d17a8510de2991462842e7e Author: admin Date: Sat Oct 18 01:46:46 2025 +0300 123 diff --git a/ hey-api-config.ts b/ hey-api-config.ts new file mode 100644 index 0000000..2bdeea8 --- /dev/null +++ b/ hey-api-config.ts @@ -0,0 +1,6 @@ +import { CreateClientConfig } from '@/lib/client/client.gen'; + +export const createClientConfig: CreateClientConfig = (config) => ({ + ...config, + baseURL: process.env.NEXT_PUBLIC_API_URL, +}); diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..1a88111 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Vitaly Rtischev + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d931cb9 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Mantine Next.js template + +This is a template for [Next.js](https://nextjs.org/) pages router + [Mantine](https://mantine.dev/). +If you want to use app router instead, see [next-app-template](https://github.com/mantinedev/next-app-template). + +## Features + +This template comes with the following features: + +- [PostCSS](https://postcss.org/) with [mantine-postcss-preset](https://mantine.dev/styles/postcss-preset) +- [TypeScript](https://www.typescriptlang.org/) +- [Storybook](https://storybook.js.org/) +- [Jest](https://jestjs.io/) setup with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro) +- ESLint setup with [eslint-config-mantine](https://github.com/mantinedev/eslint-config-mantine) + +## npm scripts + +### Build and dev scripts + +- `dev` – start dev server +- `build` – bundle application for production +- `export` – exports static website to `out` folder +- `analyze` – analyzes application bundle with [@next/bundle-analyzer](https://www.npmjs.com/package/@next/bundle-analyzer) + +### Testing scripts + +- `typecheck` – checks TypeScript types +- `lint` – runs ESLint +- `prettier:check` – checks files with Prettier +- `jest` – runs jest tests +- `jest:watch` – starts jest watch +- `test` – runs `jest`, `prettier:check`, `lint` and `typecheck` scripts + +### Other scripts + +- `storybook` – starts storybook dev server +- `storybook:build` – build production storybook bundle to `storybook-static` +- `prettier:write` – formats all files with Prettier diff --git a/components/BaseTable/BaseTable.tsx b/components/BaseTable/BaseTable.tsx new file mode 100644 index 0000000..8081c21 --- /dev/null +++ b/components/BaseTable/BaseTable.tsx @@ -0,0 +1,8 @@ +import { DataTable, type DataTableProps } from 'mantine-datatable'; + +// важна стрелочная форма для корректного дженерика в JSX +const BaseTable = (props: DataTableProps) => { + return ; +}; + +export default BaseTable; diff --git a/components/BaseTable/helpers.ts b/components/BaseTable/helpers.ts new file mode 100644 index 0000000..6c86f98 --- /dev/null +++ b/components/BaseTable/helpers.ts @@ -0,0 +1,5 @@ +// helpers.ts (или рядом) +import type { DataTableProps } from 'mantine-datatable'; + +// Берём ИМЕННО ту ветку union, где есть `columns` +export type ColumnsMode = Extract, { columns: unknown }>; diff --git a/components/ColorSchemeToggle/ColorSchemeToggle.tsx b/components/ColorSchemeToggle/ColorSchemeToggle.tsx new file mode 100644 index 0000000..18e2bb7 --- /dev/null +++ b/components/ColorSchemeToggle/ColorSchemeToggle.tsx @@ -0,0 +1,13 @@ +import { Button, Group, useMantineColorScheme } from '@mantine/core'; + +export function ColorSchemeToggle() { + const { setColorScheme } = useMantineColorScheme(); + + return ( + + + + + + ); +} diff --git a/components/Forms/AuthenticationForm.tsx b/components/Forms/AuthenticationForm.tsx new file mode 100644 index 0000000..09c346d --- /dev/null +++ b/components/Forms/AuthenticationForm.tsx @@ -0,0 +1,45 @@ +import { + Anchor, + Button, + Checkbox, + Divider, + Group, + Paper, + PaperProps, + PasswordInput, + Stack, + Text, + TextInput, +} from '@mantine/core'; +import { useForm } from '@mantine/form'; +import { upperFirst, useToggle } from '@mantine/hooks'; +import { LogidexButton } from '@/components/Forms/LogidexButton'; + +export function AuthenticationForm(props: PaperProps) { + const [type, toggle] = useToggle(['login', 'register']); + const form = useForm({ + initialValues: { + email: '', + name: '', + password: '', + terms: true, + }, + + validate: { + email: (val) => (/^\S+@\S+$/.test(val) ? null : 'Invalid email'), + password: (val) => (val.length <= 6 ? 'Password should include at least 6 characters' : null), + }, + }); + + return ( + + + Добро пожаловать в Logidex + + + + Войти с помощью LogidexID + + + ); +} diff --git a/components/Forms/LogidexButton.tsx b/components/Forms/LogidexButton.tsx new file mode 100644 index 0000000..0973be9 --- /dev/null +++ b/components/Forms/LogidexButton.tsx @@ -0,0 +1,29 @@ +import { Button, ButtonProps } from '@mantine/core'; + +function LogidexIcon(props: React.ComponentPropsWithoutRef<'svg'>) { + return ( + + + + + + ); +} +export function LogidexButton(props: ButtonProps & React.ComponentPropsWithoutRef<'button'>) { + return