diff --git a/src/entities/card-friends/lib/check-friend-state.ts b/src/entities/card-friends/lib/check-friend-state.ts index aa5933b8..1db7f519 100644 --- a/src/entities/card-friends/lib/check-friend-state.ts +++ b/src/entities/card-friends/lib/check-friend-state.ts @@ -1,4 +1,4 @@ -import { type IFriend } from '@src/shared/lib/types/api' +import { type IFriend } from '@shared/lib/types/api' export const checkFriendState = ( data: IFriend[], diff --git a/src/entities/card-friends/lib/handlers.ts b/src/entities/card-friends/lib/handlers.ts index c201d689..9ebf0ad2 100644 --- a/src/entities/card-friends/lib/handlers.ts +++ b/src/entities/card-friends/lib/handlers.ts @@ -1,19 +1,15 @@ import { type AnyAction, type ThunkDispatch } from '@reduxjs/toolkit' -import { deleteFriend } from '@src/shared/api/friends/friends' +import { deleteFriend } from '@shared/api/friends/friends' +import { acceptFriend, cancelFriend, rejectFriend } from '@shared/api/friends/requests' +import { addFriend } from '@shared/api/friends/users' +import { createChatRequest } from '@shared/api/messenger/messenger' +import { type IFriend } from '@shared/lib/types/api' import { - acceptFriend, - cancelFriend, - rejectFriend -} from '@src/shared/api/friends/requests' -import { addFriend } from '@src/shared/api/friends/users' -import { createChatRequest } from '@src/shared/api/messenger/messenger' -import { - getSendedThunk, getFriendsThunk, - getReceivedThunk -} from '@src/app/store/reducers/friends/async-thunks' -import { type RootState } from '@src/app/store/store' -import { type IFriend } from '@src/shared/lib/types/api' + getReceivedThunk, + getSendedThunk +} from '@store/reducers/friends/async-thunks' +import { type RootState } from '@store/store' import { type NavigateFunction } from 'react-router-dom' export const addFriendHandler = async ( diff --git a/src/entities/card-friends/ui/button-friend/friend-button.tsx b/src/entities/card-friends/ui/button-friend/friend-button.tsx index acb131bc..d2a5d541 100644 --- a/src/entities/card-friends/ui/button-friend/friend-button.tsx +++ b/src/entities/card-friends/ui/button-friend/friend-button.tsx @@ -1,8 +1,8 @@ +import { type Icon } from '@shared/lib/button-icons' +import { useWindowSize } from '@shared/lib/hooks/useWindowSize' +import { type FriendTabs } from '@shared/lib/types/other' +import Button from '@shared/ui/button' import { type FC } from 'react' -import Button from '../../../../shared/ui/button/button' -import { useWindowSize } from '@src/shared/lib/hooks/useWindowSize' -import { type Icon } from '@src/shared/lib/button-icons' -import { type FriendTabs } from '@src/shared/lib/types/other' interface IFriendButtonProps { type?: FriendTabs diff --git a/src/entities/card-friends/ui/friends-card.tsx b/src/entities/card-friends/ui/friends-card.tsx index cb316bfd..c205dab9 100644 --- a/src/entities/card-friends/ui/friends-card.tsx +++ b/src/entities/card-friends/ui/friends-card.tsx @@ -1,11 +1,19 @@ +import { useAppDispatch, useAppSelector } from '@shared/lib/hooks/store-hooks' +import { useWindowSize } from '@shared/lib/hooks/useWindowSize' +import { cn } from '@shared/lib/merge-classes' +import { type FriendTabs } from '@shared/lib/types/other' +import Card from '@shared/ui/card' +import UserAvatar from '@shared/ui/user-avatar' import { selectAllUsers, selectFriends, selectReceived, selectSended -} from '@src/app/store/reducers/friends/selectors' -import { selectUser } from '@src/app/store/reducers/profileInfo/selectors' -import { checkFriendState } from '@src/entities/card-friends/lib/check-friend-state' +} from '@store/reducers/friends/selectors' +import { selectUser } from '@store/reducers/profileInfo/selectors' +import { type FC } from 'react' +import { useNavigate } from 'react-router-dom' +import { checkFriendState } from '../lib/check-friend-state' import { acceptRequestHandler, addFriendHandler, @@ -13,16 +21,8 @@ import { createChatRequestHandler, deleteFriendHandler, rejectRequestHandler -} from '@src/entities/card-friends/lib/handlers' -import FriendButton from '@src/entities/card-friends/ui/button-friend/friend-button' -import { useAppDispatch, useAppSelector } from '@src/shared/lib/hooks/store-hooks' -import { useWindowSize } from '@src/shared/lib/hooks/useWindowSize' -import { cn } from '@src/shared/lib/merge-classes' -import { type FriendTabs } from '@src/shared/lib/types/other' -import UserAvatar from '@src/shared/ui/avatar/avatar' -import { type FC } from 'react' -import { useNavigate } from 'react-router-dom' -import Card from '../../../shared/ui/card/card' +} from '../lib/handlers' +import FriendButton from './button-friend/friend-button' interface IFriendsCardProps { className?: string diff --git a/src/entities/card-liked/ui/liked-card.tsx b/src/entities/card-liked/ui/liked-card.tsx index d470d6cb..a87b5f53 100644 --- a/src/entities/card-liked/ui/liked-card.tsx +++ b/src/entities/card-liked/ui/liked-card.tsx @@ -1,8 +1,8 @@ -import { type FC } from 'react' -import { Link } from 'react-router-dom' import { cn } from '@src/shared/lib/merge-classes' import UserAvatar from '@src/shared/ui/avatar/avatar' -import Card from '../../../shared/ui/card/card' +import { type FC } from 'react' +import { Link } from 'react-router-dom' +import Card from '../../../shared/ui/card' export interface ILikedCardProps { img: string diff --git a/src/entities/card-message/ui/message-card.tsx b/src/entities/card-message/ui/message-card.tsx index 9693525a..45742b40 100644 --- a/src/entities/card-message/ui/message-card.tsx +++ b/src/entities/card-message/ui/message-card.tsx @@ -1,14 +1,14 @@ -import { type FC } from 'react' +import { selectAllUsers } from '@src/app/store/reducers/friends/selectors' +import { selectUser } from '@src/app/store/reducers/profileInfo/selectors' +import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' import { cn } from '@src/shared/lib/merge-classes' -import Card from '../../../shared/ui/card/card' -import UserAvatar from '../../../shared/ui/avatar/avatar' +import { parseDateToMonth } from '@src/shared/lib/parse-date' import { type IChat } from '@src/shared/lib/types/api' -import { NavLink } from 'react-router-dom' -import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' -import { selectUser } from '@src/app/store/reducers/profileInfo/selectors' -import { selectAllUsers } from '@src/app/store/reducers/friends/selectors' import { Badge } from '@src/shared/ui/badge/badge' -import { parseDateToMonth } from '@src/shared/lib/parse-date' +import { type FC } from 'react' +import { NavLink } from 'react-router-dom' +import Card from '../../../shared/ui/card' +import UserAvatar from '../../../shared/ui/user-avatar' export interface IMessageCardProps extends IChat { className?: string diff --git a/src/entities/card-notification/ui/notification-card.tsx b/src/entities/card-notification/ui/notification-card.tsx index 8fe060e2..96991f88 100644 --- a/src/entities/card-notification/ui/notification-card.tsx +++ b/src/entities/card-notification/ui/notification-card.tsx @@ -1,11 +1,11 @@ -import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' import { selectAllUsers } from '@src/app/store/reducers/friends/selectors' +import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' +import { cn } from '@src/shared/lib/merge-classes' import { type NotificationTypeEnum } from '@src/shared/lib/types/api' import UserAvatar from '@src/shared/ui/avatar/avatar' -import { cn } from '@src/shared/lib/merge-classes' import { type FC } from 'react' +import Card from '../../../shared/ui/card' import { renderType } from '../../../widgets/toaster/ui/toaster' -import Card from '../../../shared/ui/card/card' export interface RequestCardProps { img?: string diff --git a/src/shared/api/api.ts b/src/shared/api/api.ts index 1a6d22ce..3966d571 100644 --- a/src/shared/api/api.ts +++ b/src/shared/api/api.ts @@ -1,7 +1,7 @@ import axios from 'axios' +import { getCookie } from '../lib/cookie' +import { type IAxiosError } from '../lib/types/api' import { refreshRequest } from './auth/auth' -import { getCookie } from '@src/shared/lib/cookie' -import { type IAxiosError } from '@src/shared/lib/types/api' export const URL = import.meta.env.VITE_BACKEND_URL diff --git a/src/shared/api/auth/auth.ts b/src/shared/api/auth/auth.ts index fdea35fa..0fff0978 100644 --- a/src/shared/api/auth/auth.ts +++ b/src/shared/api/auth/auth.ts @@ -1,13 +1,13 @@ -import { api, apiWithAuth } from '../api' -import { type ILoginForm, type IRegistrationForm } from '@src/shared/lib/types/forms' -import { setCookie } from '@src/shared/lib/cookie' +import { setCookie } from '../../lib/cookie' import { - type IRegistrationResponse, type ILoginResponse, + type ILogoutResponse, type IRefreshResponse, - type IUserInfoResponse, - type ILogoutResponse -} from '@src/shared/lib/types/api' + type IRegistrationResponse, + type IUserInfoResponse +} from '../../lib/types/api' +import { type ILoginForm, type IRegistrationForm } from '../../lib/types/forms' +import { api, apiWithAuth } from '../api' export const loginRequest = async (form: ILoginForm): Promise => { const res = await api.post('/auth/login', form) diff --git a/src/shared/api/friends/friends.ts b/src/shared/api/friends/friends.ts index b0af90a1..09e29899 100644 --- a/src/shared/api/friends/friends.ts +++ b/src/shared/api/friends/friends.ts @@ -1,5 +1,5 @@ +import { type IDeleteResponse, type IFriendsResponse } from '../../lib/types/api' import { apiWithAuth } from '../api' -import { type IDeleteResponse, type IFriendsResponse } from '@src/shared/lib/types/api' export const getFriends = async (): Promise => { const res = await apiWithAuth.get('/friends') diff --git a/src/shared/api/friends/requests.ts b/src/shared/api/friends/requests.ts index 37e5dd87..20bc804d 100644 --- a/src/shared/api/friends/requests.ts +++ b/src/shared/api/friends/requests.ts @@ -1,11 +1,11 @@ -import { apiWithAuth } from '../api' import { - type ISendedResponse, - type IReceivedResponse, type IAcceptResponse, + type ICancelResponse, + type IReceivedResponse, type IRejectResponse, - type ICancelResponse -} from '@src/shared/lib/types/api' + type ISendedResponse +} from '../../lib/types/api' +import { apiWithAuth } from '../api' export const getReceived = async (): Promise => { const res = await apiWithAuth.get('/friend-requests/received') diff --git a/src/shared/api/friends/users.ts b/src/shared/api/friends/users.ts index c6aa2a6e..509e5604 100644 --- a/src/shared/api/friends/users.ts +++ b/src/shared/api/friends/users.ts @@ -1,8 +1,5 @@ +import { type IAddFriendResponse, type IAllUsersResponse } from '../../lib/types/api' import { apiWithAuth } from '../api' -import { - type IAddFriendResponse, - type IAllUsersResponse -} from '@src/shared/lib/types/api' export const getAllUsers = async (): Promise => { const res = await apiWithAuth.get('/users') diff --git a/src/shared/api/messenger/messenger.ts b/src/shared/api/messenger/messenger.ts index 5e1c4723..76de32b2 100644 --- a/src/shared/api/messenger/messenger.ts +++ b/src/shared/api/messenger/messenger.ts @@ -1,7 +1,4 @@ -import { - type IGetUserChatsResponse, - type ICreateChatResponse -} from '@src/shared/lib/types/api' +import { type ICreateChatResponse, type IGetUserChatsResponse } from '../../lib/types/api' import { apiWithAuth } from '../api' export const createChatRequest = async ( diff --git a/src/shared/api/notifications/notifications.ts b/src/shared/api/notifications/notifications.ts index d8fc07f4..5a9092ec 100644 --- a/src/shared/api/notifications/notifications.ts +++ b/src/shared/api/notifications/notifications.ts @@ -1,4 +1,4 @@ -import { type IGetUserNotificationsResponse } from '@src/shared/lib/types/api' +import { type IGetUserNotificationsResponse } from '../../lib/types/api' import { apiWithAuth } from '../api' export const getUserNotifications = async (): Promise => { diff --git a/src/shared/lib/hooks/store-hooks.ts b/src/shared/lib/hooks/store-hooks.ts index 6715e9fe..c3ee9abb 100644 --- a/src/shared/lib/hooks/store-hooks.ts +++ b/src/shared/lib/hooks/store-hooks.ts @@ -1,6 +1,6 @@ -import { useDispatch, useSelector } from 'react-redux' +import type { AppDispatch, RootState } from '@store/store' import type { TypedUseSelectorHook } from 'react-redux' -import type { RootState, AppDispatch } from '../../../app/store/store' +import { useDispatch, useSelector } from 'react-redux' // Use throughout your app instead of plain `useDispatch` and `useSelector` export const useAppDispatch: () => AppDispatch = useDispatch diff --git a/src/shared/ui/badge/badge.tsx b/src/shared/ui/badge.tsx similarity index 78% rename from src/shared/ui/badge/badge.tsx rename to src/shared/ui/badge.tsx index 9979bb9a..23042644 100644 --- a/src/shared/ui/badge/badge.tsx +++ b/src/shared/ui/badge.tsx @@ -1,8 +1,7 @@ -import { type FC } from 'react' import { type VariantProps } from 'class-variance-authority' - -import { cn } from '@src/shared/lib/merge-classes' -import { badgeVariants } from '../../lib/ui-variants' +import { type FC } from 'react' +import { cn } from '../lib/merge-classes' +import { badgeVariants } from '../lib/ui-variants' export interface IBadgeProps extends React.HTMLAttributes, diff --git a/src/shared/ui/button-action/action-button.tsx b/src/shared/ui/button-action.tsx similarity index 70% rename from src/shared/ui/button-action/action-button.tsx rename to src/shared/ui/button-action.tsx index a63b7127..f5f7a994 100644 --- a/src/shared/ui/button-action/action-button.tsx +++ b/src/shared/ui/button-action.tsx @@ -1,11 +1,11 @@ -import { type FC, useState } from 'react' -import { cn } from '@src/shared/lib/merge-classes' -import Button, { type IButtonProps } from '../button/button' -import { useTheme } from '@src/app/providers/theme-context/lib/useTheme' +import { useTheme } from '@app/providers/theme-context/lib/useTheme' +import { useState, type FC } from 'react' +import { cn } from '../lib/merge-classes' +import { Button, type IButtonProps } from './button' -interface IActionButtonProps extends IButtonProps {} +interface IButtonActionProps extends IButtonProps {} -const ActionButton: FC = ({ +const ButtonAction: FC = ({ children, icon, className, @@ -41,4 +41,4 @@ const ActionButton: FC = ({ ) } -export default ActionButton +export { ButtonAction } diff --git a/src/shared/ui/button-nav/nav-button.tsx b/src/shared/ui/button-nav.tsx similarity index 74% rename from src/shared/ui/button-nav/nav-button.tsx rename to src/shared/ui/button-nav.tsx index f89c0bd5..4cfe9d06 100644 --- a/src/shared/ui/button-nav/nav-button.tsx +++ b/src/shared/ui/button-nav.tsx @@ -1,18 +1,18 @@ import { type FC, type ReactNode } from 'react' -import { Badge } from '@src/shared/ui/badge/badge' import { NavLink, type NavLinkProps } from 'react-router-dom' -import Button from '../button/button' -import { cn } from '@src/shared/lib/merge-classes' -import { type Icon } from '../../lib/button-icons' +import { type Icon } from '../lib/button-icons' +import { cn } from '../lib/merge-classes' +import { Badge } from './badge' +import { Button } from './button' -interface INavButtonProps extends NavLinkProps { +interface IButtonNavProps extends NavLinkProps { badge?: number icon?: Icon linkClassName?: string className?: string } -const NavButton: FC = ({ +const ButtonNav: FC = ({ children, icon, className = '', @@ -48,4 +48,4 @@ const NavButton: FC = ({ ) } -export default NavButton +export { ButtonNav } diff --git a/src/shared/ui/button-setting/setting-button.tsx b/src/shared/ui/button-setting.tsx similarity index 72% rename from src/shared/ui/button-setting/setting-button.tsx rename to src/shared/ui/button-setting.tsx index 7b808a9b..6dbe30de 100644 --- a/src/shared/ui/button-setting/setting-button.tsx +++ b/src/shared/ui/button-setting.tsx @@ -1,15 +1,14 @@ +import { useTheme } from '@app/providers/theme-context/lib/useTheme' import { type FC } from 'react' -import { cn } from '@src/shared/lib/merge-classes' -import Button, { type IButtonProps } from '../button/button' +import { cn } from '../lib/merge-classes' +import { Badge } from './badge' +import { Button, type IButtonProps } from './button' -import { Badge } from '@src/shared/ui/badge/badge' -import { useTheme } from '@src/app/providers/theme-context/lib/useTheme' - -interface ISettingButtonProps extends IButtonProps { +interface IButtonSettingProps extends IButtonProps { badge?: number } -const SettingButton: FC = ({ +const ButtonSetting: FC = ({ className, icon, badge = 0, @@ -37,4 +36,4 @@ const SettingButton: FC = ({ ) } -export default SettingButton +export { ButtonSetting } diff --git a/src/shared/ui/button-tab/tab-button.tsx b/src/shared/ui/button-tab.tsx similarity index 73% rename from src/shared/ui/button-tab/tab-button.tsx rename to src/shared/ui/button-tab.tsx index ef7d1742..fdc6627c 100644 --- a/src/shared/ui/button-tab/tab-button.tsx +++ b/src/shared/ui/button-tab.tsx @@ -1,15 +1,15 @@ import { type FC, type ReactNode } from 'react' -import Button from '@src/shared/ui/button/button' -import { Badge } from '@src/shared/ui/badge/badge' +import { Badge } from './badge' +import { Button } from './button' -interface ITabButtonProps { +interface IButtonTabProps { children: ReactNode badge?: number isActive: boolean onClick: () => void } -const TabButton: FC = ({ children, badge, isActive, onClick }) => { +const ButtonTab: FC = ({ children, badge, isActive, onClick }) => { return (
= ({ children, badge, isActive, onClick }) ) } -export default TabButton +export { ButtonTab } diff --git a/src/shared/ui/button/button.tsx b/src/shared/ui/button.tsx similarity index 87% rename from src/shared/ui/button/button.tsx rename to src/shared/ui/button.tsx index dd1f953f..93c5df13 100644 --- a/src/shared/ui/button/button.tsx +++ b/src/shared/ui/button.tsx @@ -1,9 +1,9 @@ import { Slot } from '@radix-ui/react-slot' -import { cn } from '@src/shared/lib/merge-classes' import { type VariantProps } from 'class-variance-authority' import { forwardRef, type ButtonHTMLAttributes } from 'react' -import { icons, type Icon } from '../../lib/button-icons' -import { buttonVariants } from '../../lib/ui-variants' +import { icons, type Icon } from '../lib/button-icons' +import { cn } from '../lib/merge-classes' +import { buttonVariants } from '../lib/ui-variants' export interface IButtonProps extends ButtonHTMLAttributes, @@ -55,4 +55,4 @@ const Button = forwardRef( ) Button.displayName = 'Button' -export default Button +export { Button } diff --git a/src/shared/ui/card/card.tsx b/src/shared/ui/card.tsx similarity index 91% rename from src/shared/ui/card/card.tsx rename to src/shared/ui/card.tsx index a640bf83..fed0322a 100644 --- a/src/shared/ui/card/card.tsx +++ b/src/shared/ui/card.tsx @@ -1,5 +1,5 @@ import { type FC, type ReactNode } from 'react' -import { cn } from '@src/shared/lib/merge-classes' +import { cn } from '../lib/merge-classes' interface ICardProps { children: ReactNode diff --git a/src/shared/ui/input-news/news-input.tsx b/src/shared/ui/input-news.tsx similarity index 74% rename from src/shared/ui/input-news/news-input.tsx rename to src/shared/ui/input-news.tsx index 46a21bf6..93c17812 100644 --- a/src/shared/ui/input-news/news-input.tsx +++ b/src/shared/ui/input-news.tsx @@ -1,15 +1,15 @@ import { type FC } from 'react' -import { cn } from '@src/shared/lib/merge-classes' -import Input, { type IInputProps } from '../input/input' -import UserAvatar from '@src/shared/ui/avatar/avatar' +import { cn } from '../lib/merge-classes' +import { Input, type IInputProps } from './input' +import { UserAvatar } from './user-avatar' import smile from '@assets/ui/Smile.svg' -interface INewsInputProps extends IInputProps { +interface IInputNewsProps extends IInputProps { avatar?: string } -const NewsInput: FC = ({ avatar, className, ...props }) => { +const InputNews: FC = ({ avatar, className, ...props }) => { const withAvatar = avatar ? 'pl-[80px]' : '' return ( @@ -41,4 +41,4 @@ const NewsInput: FC = ({ avatar, className, ...props }) => { ) } -export default NewsInput +export { InputNews } diff --git a/src/shared/ui/input-search/search.tsx b/src/shared/ui/input-search.tsx similarity index 64% rename from src/shared/ui/input-search/search.tsx rename to src/shared/ui/input-search.tsx index 55926f91..9115a9a4 100644 --- a/src/shared/ui/input-search/search.tsx +++ b/src/shared/ui/input-search.tsx @@ -1,12 +1,12 @@ import { type FC } from 'react' -import Input, { type IInputProps } from '../input/input' +import { cn } from '../lib/merge-classes' +import { Input, type IInputProps } from './input' import icon from '@assets/ui/Search.svg' -import { cn } from '@src/shared/lib/merge-classes' -interface ISearchInputProps extends Omit {} +interface IInputSearchProps extends Omit {} -const SearchInput: FC = ({ className, ...props }) => { +const InputSearch: FC = ({ className, ...props }) => { return (
= ({ className, ...props }) => { ) } -export default SearchInput +export { InputSearch } diff --git a/src/shared/ui/input/input.tsx b/src/shared/ui/input.tsx similarity index 96% rename from src/shared/ui/input/input.tsx rename to src/shared/ui/input.tsx index 2eeacaab..235588fa 100644 --- a/src/shared/ui/input/input.tsx +++ b/src/shared/ui/input.tsx @@ -1,9 +1,9 @@ import * as React from 'react' -import { cn } from '@src/shared/lib/merge-classes' +import { cn } from '../lib/merge-classes' -import eye from '@assets/ui/Eye.svg' import eyeOff from '@assets/ui/Eye Off.svg' +import eye from '@assets/ui/Eye.svg' export interface IInputProps extends React.InputHTMLAttributes { error?: string @@ -56,4 +56,4 @@ const Input = React.forwardRef( ) Input.displayName = 'Input' -export default Input +export { Input } diff --git a/src/shared/ui/logo/logo.tsx b/src/shared/ui/logo.tsx similarity index 81% rename from src/shared/ui/logo/logo.tsx rename to src/shared/ui/logo.tsx index 09a7d843..4e0b6e00 100644 --- a/src/shared/ui/logo/logo.tsx +++ b/src/shared/ui/logo.tsx @@ -1,11 +1,11 @@ +import { useTheme } from '@app/providers/theme-context/lib/useTheme' import { type FC } from 'react' -import { useWindowSize } from '@src/shared/lib/hooks/useWindowSize' -import { useTheme } from '@src/app/providers/theme-context/lib/useTheme' +import { useWindowSize } from '../lib/hooks/useWindowSize' -import logoLight from '@assets/ui/logo-light.svg' import logoDark from '@assets/ui/logo-dark.svg' -import logoMobileLight from '@assets/ui/logo-mobile-light.svg' +import logoLight from '@assets/ui/logo-light.svg' import logoMobileDark from '@assets/ui/logo-mobile-dark.svg' +import logoMobileLight from '@assets/ui/logo-mobile-light.svg' interface ILogoProps { isAdaptive?: boolean @@ -25,4 +25,4 @@ const Logo: FC = ({ isAdaptive = false }) => { return Sakura logo } -export default Logo +export { Logo } diff --git a/src/shared/ui/select/select.tsx b/src/shared/ui/select.tsx similarity index 96% rename from src/shared/ui/select/select.tsx rename to src/shared/ui/select.tsx index 08372676..b0bc587d 100644 --- a/src/shared/ui/select/select.tsx +++ b/src/shared/ui/select.tsx @@ -1,6 +1,11 @@ import { Check, ChevronDown } from 'lucide-react' -import { forwardRef } from 'react' +import { + Root as ScrollRoot, + Scrollbar, + Thumb, + Viewport +} from '@radix-ui/react-scroll-area' import { Content, Group, @@ -15,14 +20,9 @@ import { Trigger, Value } from '@radix-ui/react-select' -import { - Root as ScrollRoot, - Scrollbar, - Thumb, - Viewport -} from '@radix-ui/react-scroll-area' -import { cn } from '@src/shared/lib/merge-classes' -import { type IPropsForwardRefsUI } from '@src/shared/lib/types/props' +import { forwardRef } from 'react' +import { cn } from '../lib/merge-classes' +import { type IPropsForwardRefsUI } from '../lib/types/props' const Select = SelectRoot @@ -132,11 +132,11 @@ SelectSeparator.displayName = Separator.displayName export { Select, - SelectGroup, - SelectValue, - SelectTrigger, SelectContent, - SelectLabel, + SelectGroup, SelectItem, - SelectSeparator + SelectLabel, + SelectSeparator, + SelectTrigger, + SelectValue } diff --git a/src/shared/ui/textarea/textarea.tsx b/src/shared/ui/textarea.tsx similarity index 93% rename from src/shared/ui/textarea/textarea.tsx rename to src/shared/ui/textarea.tsx index 74cfcd6f..09bdeae8 100644 --- a/src/shared/ui/textarea/textarea.tsx +++ b/src/shared/ui/textarea.tsx @@ -1,5 +1,5 @@ import { forwardRef } from 'react' -import { cn } from '@src/shared/lib/merge-classes' +import { cn } from '../lib/merge-classes' export interface ITextareaProps extends React.TextareaHTMLAttributes { @@ -26,4 +26,4 @@ const Textarea = forwardRef( ) Textarea.displayName = 'Textarea' -export default Textarea +export { Textarea } diff --git a/src/shared/ui/avatar/avatar.tsx b/src/shared/ui/user-avatar.tsx similarity index 90% rename from src/shared/ui/avatar/avatar.tsx rename to src/shared/ui/user-avatar.tsx index 16564cb4..1a9e617c 100644 --- a/src/shared/ui/avatar/avatar.tsx +++ b/src/shared/ui/user-avatar.tsx @@ -1,10 +1,9 @@ -import { type FC, forwardRef } from 'react' import { Fallback, Image, Root } from '@radix-ui/react-avatar' - -import { cn } from '@src/shared/lib/merge-classes' +import { forwardRef, type FC } from 'react' +import { cn } from '../lib/merge-classes' +import { type IPropsForwardRefsUI } from '../lib/types/props' import avatarLight from '@assets/avatar/default avatar light.svg' -import { type IPropsForwardRefsUI } from '@src/shared/lib/types/props' interface IAvatarProps extends React.ComponentPropsWithoutRef { text?: string @@ -72,4 +71,4 @@ const UserAvatar: FC = ({ src, className }) => { ) } -export default UserAvatar +export { UserAvatar } diff --git a/src/widgets/chat/ui/message-input/message-input.tsx b/src/widgets/chat/ui/message-input/message-input.tsx index bc1ab978..ba992b53 100644 --- a/src/widgets/chat/ui/message-input/message-input.tsx +++ b/src/widgets/chat/ui/message-input/message-input.tsx @@ -1,8 +1,8 @@ -import { type FC, useState } from 'react' -import Input, { type IInputProps } from '../../../../shared/ui/input/input' +import { useState, type FC } from 'react' +import Input, { type IInputProps } from '../../../../shared/ui/input' -import media from '@assets/ui/paperclip.svg' import smile from '@assets/ui/Smile.svg' +import media from '@assets/ui/paperclip.svg' import send from '@assets/ui/send.svg' import { cn } from '@src/shared/lib/merge-classes' diff --git a/src/widgets/chat/ui/message/message.tsx b/src/widgets/chat/ui/message/message.tsx index c1b7bcf4..a6ca838b 100644 --- a/src/widgets/chat/ui/message/message.tsx +++ b/src/widgets/chat/ui/message/message.tsx @@ -1,6 +1,6 @@ -import { type FC } from 'react' -import UserAvatar from '../../../../shared/ui/avatar/avatar' import { parseDateToTime } from '@src/shared/lib/parse-date' +import { type FC } from 'react' +import UserAvatar from '../../../../shared/ui/user-avatar' interface IMessageProps { text: string diff --git a/src/widgets/header/ui/header.tsx b/src/widgets/header/ui/header.tsx index b9e03a77..05bcbcaf 100644 --- a/src/widgets/header/ui/header.tsx +++ b/src/widgets/header/ui/header.tsx @@ -1,10 +1,10 @@ -import { type DetailedHTMLProps, type FC, type HTMLAttributes } from 'react' -import { cn } from '@src/shared/lib/merge-classes' -import SettingButton from '../../../shared/ui/button-setting/setting-button' -import Logo from '../../../shared/ui/logo/logo' import { useTheme } from '@src/app/providers/theme-context/lib/useTheme' -import UserAvatar from '../../../shared/ui/avatar/avatar' import { useWindowSize } from '@src/shared/lib/hooks/useWindowSize' +import { cn } from '@src/shared/lib/merge-classes' +import { type DetailedHTMLProps, type FC, type HTMLAttributes } from 'react' +import SettingButton from '../../../shared/ui/button-setting' +import Logo from '../../../shared/ui/logo' +import UserAvatar from '../../../shared/ui/user-avatar' import SheetBlock from '../../sheet/ui/sheet-block' interface IHeaderProps diff --git a/src/widgets/mobile-nav/ui/mobile-nav.tsx b/src/widgets/mobile-nav/ui/mobile-nav.tsx index 01979074..3249d3c6 100644 --- a/src/widgets/mobile-nav/ui/mobile-nav.tsx +++ b/src/widgets/mobile-nav/ui/mobile-nav.tsx @@ -1,9 +1,10 @@ -import { type FC } from 'react' -import NavButton from '../../../shared/ui/button-nav/nav-button' -import { useLocation } from 'react-router-dom' import { selectReceived } from '@src/app/store/reducers/friends/selectors' import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' -import { selectMessengerUserChats } from '@src/app/store/reducers/messenger/selectors' +import { type FC } from 'react' +import { useLocation } from 'react-router-dom' +import NavButton from '../../../shared/ui/button-nav/button-nav' +import { selectMessenge } from /../../ shared / ui / button - navrs / messenger / selectors +' const MobileNav: FC = () => { const { pathname } = useLocation() diff --git a/src/widgets/profile/ui/profile.tsx b/src/widgets/profile/ui/profile.tsx index 06b58de6..029e160e 100644 --- a/src/widgets/profile/ui/profile.tsx +++ b/src/widgets/profile/ui/profile.tsx @@ -1,14 +1,14 @@ -import { type FC } from 'react' -import Button from '../../../shared/ui/button/button' import Friends from '@src/entities/row-friends/ui/friends' -import UserAvatar from '../../../shared/ui/avatar/avatar' +import { type FC } from 'react' +import Button from '../../../shared/ui/button' +import UserAvatar from '../../../shared/ui/user-avatar' import friend from '@assets/friend.svg' import avatar from '@assets/photo.svg' +import calendar from '@assets/ui/Calendar.svg' import location from '@assets/ui/Location Point.svg' import user from '@assets/ui/User.svg' import bank from '@assets/ui/bank.svg' -import calendar from '@assets/ui/Calendar.svg' const Profile: FC = () => { return ( diff --git a/src/widgets/sidebar/ui/sidebar.tsx b/src/widgets/sidebar/ui/sidebar.tsx index 8af88d80..3310f831 100644 --- a/src/widgets/sidebar/ui/sidebar.tsx +++ b/src/widgets/sidebar/ui/sidebar.tsx @@ -1,13 +1,14 @@ -import { type FC } from 'react' -import Logo from '../../../shared/ui/logo/logo' -import NavButton from '../../../shared/ui/button-nav/nav-button' -import SettingButton from '@src/shared/ui/button-setting/setting-button' -import { useAppDispatch, useAppSelector } from '@src/shared/lib/hooks/store-hooks' -import { logoutThunk } from '@src/app/store/reducers/profileInfo/async-thunks' import { useTheme } from '@src/app/providers/theme-context/lib/useTheme' -import { useToast } from '../../toaster/lib/use-toast' import { selectReceived } from '@src/app/store/reducers/friends/selectors' -import { selectMessengerUserChats } from '@src/app/store/reducers/messenger/selectors' +import { logoutThunk } from '@src/app/store/reducers/profileInfo/async-thunks' +import { useAppDispatch, useAppSelector } from '@src/shared/lib/hooks/store-hooks' +import SettingButton from '@src/shared/ui/button-setting/setting-button' +import { type FC } from 'react' +import ButtonNav from '../../../shared/ui/button-nav/button-nav' +import Logo from '../../../shared/ui/logo' +import { useToast } from '../../toaster/lib/use-toast' +import { selectMessenge } from /../../ shared / ui / button - navrs / messenger / selectors +' const Sidebar: FC = () => { const userChats = useAppSelector(selectMessengerUserChats) @@ -34,39 +35,39 @@ const Sidebar: FC = () => {
- + Моя страница - + - + Новости - + - Мессенджер - + - Друзья - + - Фотографии - +
diff --git a/src/widgets/toaster/ui/toaster.tsx b/src/widgets/toaster/ui/toaster.tsx index 5dd74f62..56f9c22c 100644 --- a/src/widgets/toaster/ui/toaster.tsx +++ b/src/widgets/toaster/ui/toaster.tsx @@ -1,3 +1,6 @@ +import { selectAllUsers } from '@src/app/store/reducers/friends/selectors' +import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' +import { NotificationTypeEnum } from '@src/shared/lib/types/api' import { Toast, ToastClose, @@ -5,12 +8,9 @@ import { ToastTitle, ToastViewport } from '@src/widgets/toaster/ui/toast/toast' -import { useToast } from '../lib/use-toast' import { type FC } from 'react' -import { useAppSelector } from '@src/shared/lib/hooks/store-hooks' -import { selectAllUsers } from '@src/app/store/reducers/friends/selectors' -import UserAvatar from '../../../shared/ui/avatar/avatar' -import { NotificationTypeEnum } from '@src/shared/lib/types/api' +import UserAvatar from '../../../shared/ui/user-avatar' +import { useToast } from '../lib/use-toast' export const renderType = { [NotificationTypeEnum.sendFriendRequest]: 'Подал Вам заявку в друзья',