Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
рефакторинг и правка багов (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoriaBorovskaya authored Dec 27, 2023
1 parent a30bfde commit dcc8c34
Show file tree
Hide file tree
Showing 42 changed files with 93 additions and 86 deletions.
5 changes: 4 additions & 1 deletion src/app/providers/router/router.paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ export const routerPaths = [
path: PATHS.addProject,
Component: AddProjectPage,
},
// { path: PATHS.dialog, Component: DialogPage }
// {
// path: PATHS.dialog,
// Component: DialogPage,
// },
{
path: PATHS.dialog,
Component: NotFoundPage,
Expand Down
4 changes: 2 additions & 2 deletions src/entities/dummy/notifications/DummyNotifications.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Text } from '@chakra-ui/react';

import { NotificationImage } from '~/shared/ui/NotificationImage';
import { DummyImage } from '~/shared/ui/DummyImage';

import { DummyWrapper } from '../base';

export function DummyNotifications() {
return (
<DummyWrapper>
<NotificationImage />
<DummyImage />
<Text fontSize="md" fontWeight="medium" mt={1}>
Нет уведомлений
</Text>
Expand Down
4 changes: 2 additions & 2 deletions src/entities/dummy/position/DummyPosition.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Text } from '@chakra-ui/react';

import { NotificationImage } from '~/shared/ui/NotificationImage';
import { DummyImage } from '~/shared/ui/DummyImage';

import { DummyWrapper } from '../base';

export function DummyPosition() {
return (
<DummyWrapper>
<NotificationImage />
<DummyImage />
<Text fontSize="md" fontWeight="medium" mt={1}>
Нет заявок
</Text>
Expand Down
4 changes: 2 additions & 2 deletions src/entities/notification/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { generatePath, Link } from 'react-router-dom';
import type { GetNotificationResponse } from '~/shared/api';
import { useAuth, useIsMobile } from '~/shared/hooks';
import { PATHS } from '~/shared/lib/router';
import { NotificationImage } from '~/shared/ui/NotificationImage';
import { DummyImage } from '~/shared/ui/DummyImage';

import { useGetNotification } from './api';
import { NOTIFICATIONS_MESSAGE, NOTIFICATIONS } from './Notification.constants';
Expand Down Expand Up @@ -50,7 +50,7 @@ export function Notification({ notificationId, read }: NotificationProps) {
grow={1}
>
<VStack spacing={0} gap={3} textAlign="center">
<NotificationImage />
<DummyImage />
{notification && (
<React.Fragment>
<Heading variant="h2" mb={0}>
Expand Down
2 changes: 1 addition & 1 deletion src/entities/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './reviews';
export * from './avatar';
export * from './info';
export * from './api';
export * from './profile-card';
1 change: 0 additions & 1 deletion src/entities/user/info/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
CircularProgressLabel,
} from '@chakra-ui/react';

import { Info } from '~/entities/user';

import { useIsMobile } from '~/shared/hooks';
import { STag } from '~/shared/ui/STag';

import { Statistic } from './statistic';

export function ProfileCardDesktop() {
const isMobile = useIsMobile();
const dummyFillProfile = 60;
Expand Down Expand Up @@ -48,7 +48,7 @@ export function ProfileCardDesktop() {
</Text>
</Stack>
<Flex direction="column" width="inherit">
<Info mb={6} />
<Statistic mb={6} />
<Flex direction="column" mb={6}>
<Heading variant="h2" mb={3}>
Специализация и навыки
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Skeleton } from '@chakra-ui/react';

import { useGetProfile } from '~/entities/user';
import { useGetProfile } from '../api';

import { ProfileCardUser } from './ProfileCardUser';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Text, Flex, Image, Center } from '@chakra-ui/react';

import { Info } from '~/entities/user';

import NotAuth from './notAuth.png';
import { Statistic } from './statistic';

const defaultName = 'Гость';

Expand Down Expand Up @@ -32,7 +31,7 @@ export function ProfileCardNotAuth() {
<Text align="center" fontWeight="bold" fontSize="2xl" pt={16} mb={4}>
{defaultName}
</Text>
<Info />
<Statistic />
</Flex>
);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Text, Flex, Center, SkeletonText, Button, Avatar } from '@chakra-ui/react';
import { Link } from 'react-router-dom';

import { Info, useGetAvatar, useIsAvatarExist, useUserStatistic } from '~/entities/user';

import type { GetUserResponse } from '~/shared/api/model';
import { useAuth } from '~/shared/hooks';
import { PATHS } from '~/shared/lib/router';

import { useGetAvatar, useIsAvatarExist, useUserStatistic } from '../api';

import { Statistic } from './statistic';

interface ProfileCardProps {
user: GetUserResponse;
}
Expand Down Expand Up @@ -61,7 +63,7 @@ export function ProfileCardUser({ user }: ProfileCardProps) {
{name}
</Text>
)}
<Info statistic={statistic} />
<Statistic statistic={statistic} />
{userId === user.id && (
<Flex px={4} pb={4} w="full">
<Button as={Link} to={PATHS.profileSettings} variant="light" w="full">
Expand Down
3 changes: 3 additions & 0 deletions src/entities/user/profile-card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './ProfileCard';
export * from './ProfileCard.desktop';
export * from './ProfileCardNotAuth';
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import type { GetStatistic } from '~/shared/api/model';
import { useAuth } from '~/shared/hooks';
import { SGroup } from '~/shared/ui/SGroup';

interface InfoProps {
interface StatisticProps {
statistic?: GetStatistic;
}

export const Info = (props: FlexProps & InfoProps) => {
export const Statistic = (props: FlexProps & StatisticProps) => {
const { isAuth } = useAuth();
const { statistic } = props;

Expand Down
1 change: 1 addition & 0 deletions src/entities/user/profile-card/statistic/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Statistic';
9 changes: 2 additions & 7 deletions src/features/chat/create/CreateMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ export function CreateMessage({ onSubmit }: CreateMessageProps) {

return (
<Flex px={isMobile ? 0 : 6} py={4} alignItems="center" gap={4} w="full">
<STextarea
maxLength={50}
value={value}
setValue={setValue}
placeholder="Введите сообщение..."
/>
<STextarea value={value} setValue={setValue} placeholder="Сообщение" />
<IconButton
aria-label="create-message"
variant="flat"
Expand All @@ -32,7 +27,7 @@ export function CreateMessage({ onSubmit }: CreateMessageProps) {
messageRef.current.innerHTML = '';
}
}}
icon={<Icon as={IoSend} />}
icon={<Icon as={IoSend} fontSize="md" />}
/>
</Flex>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useAuth } from '~/shared/hooks';
import { PATHS } from '~/shared/lib/router';
import { Counter } from '~/shared/ui/Counter';

export function Notification() {
export function NotificationButton() {
const { isAuth } = useAuth();
const navigate = useNavigate();

Expand Down
1 change: 1 addition & 0 deletions src/features/notifications/button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './NotificationButton';
2 changes: 1 addition & 1 deletion src/features/notifications/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './notification';
export * from './button';
export * from './notification-settings';
export * from './notifications-filter';
export * from './api';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Flex, Heading, VStack, Divider } from '@chakra-ui/react';

import { SettingItem } from '~/shared/ui/SettingsItem';
import { Switcher } from '~/shared/ui/Switcher';

export function SettingsList() {
return (
Expand All @@ -16,17 +16,17 @@ export function SettingsList() {
borderRadius="2xl"
spacing={0}
>
<SettingItem>Одобрение отклика</SettingItem>
<Switcher>Одобрение отклика</Switcher>
<Divider variant="light" />
<SettingItem>Отклонение отклика</SettingItem>
<Switcher>Отклонение отклика</Switcher>
<Divider variant="light" />
<SettingItem>Проект закрыт</SettingItem>
<Switcher>Проект закрыт</Switcher>
<Divider variant="light" />
<SettingItem>Возможность оставить отзыв</SettingItem>
<Switcher>Возможность оставить отзыв</Switcher>
<Divider variant="light" />
<SettingItem>Одобрение публикации</SettingItem>
<Switcher>Одобрение публикации</Switcher>
<Divider variant="light" />
<SettingItem>Правки в публикации</SettingItem>
<Switcher>Правки в публикации</Switcher>
</VStack>
<Heading variant="h3" mt={6} mb={4}>
Push-уведомления
Expand All @@ -39,9 +39,9 @@ export function SettingsList() {
borderRadius="2xl"
spacing={0}
>
<SettingItem>Личные сообщения</SettingItem>
<Switcher>Личные сообщения</Switcher>
<Divider variant="light" />
<SettingItem>Вам оставили отзыв</SettingItem>
<Switcher>Вам оставили отзыв</Switcher>
</VStack>
</Flex>
);
Expand Down
1 change: 0 additions & 1 deletion src/features/notifications/notification/index.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/features/project/search/SearchProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { SearchInput } from '~/shared/ui/SearchInput';

interface SearchProjectProps {
onChange: (value: string) => void;
placeholder: string;
}

export const SearchProject = ({ onChange }: SearchProjectProps) => {
return <SearchInput onChange={onChange} placeholder="Найти проект" />;
export const SearchProject = ({ onChange, placeholder }: SearchProjectProps) => {
return <SearchInput onChange={onChange} placeholder={placeholder} />;
};
6 changes: 5 additions & 1 deletion src/pages/chats/ChatsPage.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export function ChatsPageDesktop() {
flexShrink="0"
>
<Box py={4} px={5} position="relative">
<SearchInput placeholder="Найти в чатах" onChange={console.log} />
<SearchInput
placeholder="Найти в чатах"
onChange={console.log}
variant="gray"
/>
<Divider
variant="light"
position="absolute"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/chats/ChatsPageBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ export function ChatsPageBase() {
return (
<Box w="full" bg="white">
<Box bg="bg">
<Container maxW="md" py={4} pb={8}>
<Container maxW="md" py={4}>
<Flex justifyContent="space-between" alignItems="center" h={42} mb={2}>
<Heading variant="h1" as="h1">
Чаты
</Heading>
</Flex>
<SearchInput placeholder="Найти в чатах" onChange={console.log} />
<SearchInput placeholder="Поиск" onChange={console.log} />
</Container>
</Box>
<ChatsList value={value} />
Expand Down
4 changes: 2 additions & 2 deletions src/pages/profile/ProfileMePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {
import { useLayoutEffect } from 'react';
import { useSearchParams } from 'react-router-dom';

import { ProfileCard, ProfileCardNotAuth } from '~/widgets/profile-card';

import { Login, Settings } from '~/features/user';

import { ProfileCard, ProfileCardNotAuth } from '~/entities/user';

import { useAuth } from '~/shared/hooks';

import { AboutMeTab } from './tabs/about-me';
Expand Down
3 changes: 1 addition & 2 deletions src/pages/profile/ProfilePage.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { Box, Flex, Heading, Text } from '@chakra-ui/react';
import { useEffect } from 'react';
import { useSearchParams } from 'react-router-dom';

import { ProfileCardDesktop } from '~/widgets/profile-card';
import { ProjectCard } from '~/widgets/project-card';

import { AvatarsGroup } from '~/entities/project';
import { Reviews } from '~/entities/user';
import { ProfileCardDesktop, Reviews } from '~/entities/user';

import { Rating } from '~/shared/ui/Rating';
import { STag } from '~/shared/ui/STag';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/profile/ProfileUserPageBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { useLayoutEffect } from 'react';
import { useParams, useSearchParams } from 'react-router-dom';

import { ProfileCard, ProfileCardNotAuth } from '~/widgets/profile-card';
import { ProfileCard, ProfileCardNotAuth } from '~/entities/user';

import { GoBack } from '~/shared/ui/GoBack';

Expand Down
2 changes: 1 addition & 1 deletion src/pages/search/ui/SearchPage.desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const SearchPageDesktop = () => {
</Heading>
</Flex>
<Flex gap="4" mb={4}>
<SearchProject onChange={handleSumbit} />
<SearchProject onChange={handleSumbit} placeholder="Поиск в проектах" />
{/* <Filter /> */}
</Flex>
<SimpleGrid columns={2} gap={6}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/search/ui/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const SearchPage = () => {
)}
</Flex>
<Flex gap="1" mb={4}>
<SearchProject onChange={handleSumbit} />
<SearchProject onChange={handleSumbit} placeholder="Найти проект" />
<FilterUser
totalItems={positions?.pages[0].total_items}
isLoading={isLoading}
Expand Down
18 changes: 9 additions & 9 deletions src/pages/setting/settings/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Link } from 'react-router-dom';
import { useApi } from '~/shared/hooks';
import { PATHS } from '~/shared/lib/router';
import { GoBack } from '~/shared/ui/GoBack';
import { SettingItem } from '~/shared/ui/SettingsItem';
import { Switcher } from '~/shared/ui/Switcher';

export function SettingsPage() {
const { userApi } = useApi();
Expand All @@ -36,28 +36,28 @@ export function SettingsPage() {
mt={8}
>
<Link to={PATHS.profileSettings}>
<SettingItem type="heading" variant="h3" icon={FiChevronRight}>
<Switcher type="heading" variant="h3" icon={FiChevronRight}>
Профиль
</SettingItem>
</Switcher>
</Link>
<Divider variant="light" />
{/* <Link to={PATHS.notificationsSettings}>
<SettingItem type="heading" variant="h3" icon={FiChevronRight}>
<Switcher type="heading" variant="h3" icon={FiChevronRight}>
Уведомления
</SettingItem>
</Switcher>
</Link> */}
{/* <Divider variant="light" /> */}
{/* TODO: вставить актуальную почту */}
<ChakraLink href="mailto:">
<SettingItem type="heading" variant="h3" icon={FiChevronRight}>
<Switcher type="heading" variant="h3" icon={FiChevronRight}>
Сообщить о проблеме
</SettingItem>
</Switcher>
</ChakraLink>
<Divider variant="light" />
<Link to="#" onClick={() => userApi.logout()}>
<SettingItem type="heading" variant="h3" icon={FiChevronRight}>
<Switcher type="heading" variant="h3" icon={FiChevronRight}>
Выйти
</SettingItem>
</Switcher>
</Link>
</VStack>
</Container>
Expand Down
7 changes: 7 additions & 0 deletions src/shared/ui/DummyImage/DummyImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Image } from '@chakra-ui/react';

import image from './image.svg';

export function DummyImage() {
return <Image src={image} />;
}
Loading

0 comments on commit dcc8c34

Please sign in to comment.