Skip to content
Open
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
2 changes: 2 additions & 0 deletions frontend/src/app/providers/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { Route, Routes } from 'react-router-dom';

import { HomePage, LoginPage } from '@/pages';
import { BlacklistPage } from '@/pages/blacklist-page/ui/BlacklistPage';
Copy link
Collaborator

@darrpyy darrpyy Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { HomePage, LoginPage, BlacklistPage } from '@/pages';


export const Router = () => {
return (
<div>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/login" element={<LoginPage/>}/>
<Route path="/blacklist" element={<BlacklistPage/>}/>
</Routes>
</div>
);
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/pages/blacklist-page/ui/BlacklistPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {RemoveBlacklistWidget, Header} from "@/widgets";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Как я понимаю это модальное окно, в мантин уже есть готовое и можно использовать его + встроенные хуки для обработки
  2. это можно перенести в папку страницы блеклиста, так как он только там используется. Заполнить модалку из мантин в папке страницы

import {Table, TableData, Title} from '@mantine/core';

const tableData: TableData = {
Copy link
Collaborator

@darrpyy darrpyy Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для данных таблицы лучше сделать type используя TypeScript(по модели из бекенда обычно делается), но можно просто пока как в данном примере поля в типе сделать. Сами данные таблицы вынести в config.ts. Тип для вынести в model/types.ts

head: ['Name', 'Contact', 'Car', 'Reason'],
body: [
['Ivan Ivanov', '+79000000000', 'A000AA96', 'nasral na doroge'],
['Mark Ivanov', '+79000000001', 'A001AA96', 'ne ubral musor']
],
};
//нужно добавить кнопку, которая вызывает виджет удаления из таблицы

export const BlacklistPage = () => {
return(
<>
<Header />
<Title order={3}>Black List</Title>
<Table data={tableData} />
</>
);
};
22 changes: 22 additions & 0 deletions frontend/src/pages/example-page/ui/ExamplePage.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эту страницу можно удалить

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {Header} from "@/widgets";
import { SimpleGrid } from '@mantine/core';


export const ExamplePage = () => {
return (
<>
<Header />
<SimpleGrid
cols={{ base: 1, sm: 2, lg: 5 }}
spacing={{ base: 10, sm: 'xl' }}
verticalSpacing={{ base: 'md', sm: 'xl' }}
>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</SimpleGrid>
</>
);
};
3 changes: 2 additions & 1 deletion frontend/src/pages/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { HomePage } from './home-page/ui/HomePage.tsx';
export { LoginPage } from './login-page/ui/LoginPage.tsx';
export { LoginPage } from './login-page/ui/LoginPage.tsx';
export { BlacklistPage } from './blacklist-page/ui/BlacklistPage.tsx';
31 changes: 31 additions & 0 deletions frontend/src/widgets/blacklist/AddBlackList.tsx
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Выше описала на странице по этому компоненту, что можно взять модалку мантин(это проще). Чем писать свою логику. Плюс в таблицу напротив каждого юзера можно вставить кнопку компонент IconButton и при нажатии передавать типизированный обьект юзер(не разбирать отдельно на много пропов в компонент, так в целом это антипаттерн). Обращаться уже потом user.name, user.contactInfo и т.д

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Container, Text, Button, Group, Box } from '@mantine/core';

interface BlacklistWidgetProps {
Copy link
Collaborator

@darrpyy darrpyy Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут скорее всего нужно сделать интерфейс UserInformation. И в пропах передавть обьекст юзера

name: string;
carNumber: string;
contactInfo: string;
onAddToBlacklist: () => void;
onCancel: () => void;
}

export const BlacklistWidget: React.FC<BlacklistWidgetProps> = ({
name = "John Black",
carNumber = " A000AA96",
contactInfo = "+79000000000",
onAddToBlacklist,
onCancel
}) => {
return (
<Container size="sm" p="md">
<Box>
<Text size="lg">{name}</Text>
<Text size="lg">{carNumber}</Text>
<Text size="lg">{contactInfo}</Text>
<Group>
<Button variant="outline" onClick={onCancel} color="gray" size="md">Cancel</Button>
<Button onClick={onAddToBlacklist} color="teal" size="md">Add to Blacklist</Button>
</Group>
</Box>
</Container>
);
};
31 changes: 31 additions & 0 deletions frontend/src/widgets/blacklist/RemoveBlackList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Container, Text, Button, Group, Box, Title} from '@mantine/core';

interface RemoveFromBlacklistProps {
name: string;
onConfirm: () => void;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в мантин есть готовое модальное окно + хуки

onCancel: () => void;
}

export const RemoveBlacklistWidget: React.FC<RemoveFromBlacklistProps> = ({
name,
onConfirm,
onCancel,
}) => {
return (
<Container size="sm" p="md">
<Box>
<Title order={3}>Remove from Blacklist?</Title>

<Text size="md">
Are you sure you want to remove <Text size="md">{name}</Text> from the blacklist?
</Text>

<Group>
<Button onClick={onCancel} color="gray" size="md">Cancel</Button>
<Button onClick={onConfirm} color="teal" size="md">Yes, Remove</Button>
</Group>
</Box>
</Container>
);
};

4 changes: 3 additions & 1 deletion frontend/src/widgets/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export {Header} from './header/Header.tsx';
export {Map} from './map/Map.tsx';
export {Map} from './map/Map.tsx';
export {BlacklistWidget} from './blacklist/AddBlackList.tsx';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше перенести в ui страницы блеклист(они только к ней относятся)

export {RemoveBlacklistWidget} from './blacklist/RemoveBlackList.tsx';
1 change: 1 addition & 0 deletions frontend/tsconfig.node.tsbuildinfo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это не нужно отслеживать гитом(в гитигнор добавить) и надо удалить

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/tsconfig.tsbuildinfo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это не нужно отслеживать гитом(в гитигнор добавить) и надо удалить

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":["./src/main.tsx","./src/vite-env.d.ts","./src/app/app.tsx","./src/app/providers/router.tsx","./src/pages/index.ts","./src/pages/example-page/ui/examplepage.tsx","./src/pages/home-page/ui/homepage.tsx","./src/pages/home-page/ui/infoblock.tsx","./src/pages/login-page/ui/loginpage.tsx","./src/widgets/index.ts","./src/widgets/header/header.tsx","./src/widgets/map/map.tsx","./src/widgets/map/config.ts"],"version":"5.7.3"}
2 changes: 2 additions & 0 deletions frontend/vite.config.d.ts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это не нужно отслеживать гитом(в гитигнор добавить) и надо удалить

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const _default: import("vite").UserConfig;
export default _default;
23 changes: 23 additions & 0 deletions frontend/vite.config.js
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это надо откатить, конфиги все настроены уже

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
// https://vite.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@pages': path.resolve(__dirname, './src/pages'),
'@shared': path.resolve(__dirname, './src/shared'),
'@features': path.resolve(__dirname, './src/features'),
'@entities': path.resolve(__dirname, './src/entities'),
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
plugins: [react()],
});