-
Notifications
You must be signed in to change notification settings - Fork 0
blacklist #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
blacklist #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import {RemoveBlacklistWidget, Header} from "@/widgets"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| import {Table, TableData, Title} from '@mantine/core'; | ||
|
|
||
| const tableData: TableData = { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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} /> | ||
| </> | ||
| ); | ||
| }; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| </> | ||
| ); | ||
| }; |
| 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'; |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| ); | ||
| }; | ||
| 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; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
| ); | ||
| }; | ||
|
|
||
| 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'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. лучше перенести в ui страницы блеклист(они только к ней относятся) |
||
| export {RemoveBlacklistWidget} from './blacklist/RemoveBlackList.tsx'; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это не нужно отслеживать гитом(в гитигнор добавить) и надо удалить |
Large diffs are not rendered by default.
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"} |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()], | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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';