Skip to content

Commit

Permalink
fix: @shared paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Barresi committed Jan 11, 2024
1 parent aec7a5e commit 951ad13
Show file tree
Hide file tree
Showing 36 changed files with 177 additions and 188 deletions.
2 changes: 1 addition & 1 deletion src/entities/card-friends/lib/check-friend-state.ts
Original file line number Diff line number Diff line change
@@ -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[],
Expand Down
22 changes: 9 additions & 13 deletions src/entities/card-friends/lib/handlers.ts
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
8 changes: 4 additions & 4 deletions src/entities/card-friends/ui/button-friend/friend-button.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 13 additions & 13 deletions src/entities/card-friends/ui/friends-card.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
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,
cancelRequestHandler,
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
Expand Down
6 changes: 3 additions & 3 deletions src/entities/card-liked/ui/liked-card.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/entities/card-message/ui/message-card.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/entities/card-notification/ui/notification-card.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/shared/api/api.ts
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 7 additions & 7 deletions src/shared/api/auth/auth.ts
Original file line number Diff line number Diff line change
@@ -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<ILoginResponse> => {
const res = await api.post<ILoginResponse>('/auth/login', form)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/api/friends/friends.ts
Original file line number Diff line number Diff line change
@@ -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<IFriendsResponse> => {
const res = await apiWithAuth.get<IFriendsResponse>('/friends')
Expand Down
10 changes: 5 additions & 5 deletions src/shared/api/friends/requests.ts
Original file line number Diff line number Diff line change
@@ -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<IReceivedResponse> => {
const res = await apiWithAuth.get<IReceivedResponse>('/friend-requests/received')
Expand Down
5 changes: 1 addition & 4 deletions src/shared/api/friends/users.ts
Original file line number Diff line number Diff line change
@@ -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<IAllUsersResponse> => {
const res = await apiWithAuth.get<IAllUsersResponse>('/users')
Expand Down
5 changes: 1 addition & 4 deletions src/shared/api/messenger/messenger.ts
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion src/shared/api/notifications/notifications.ts
Original file line number Diff line number Diff line change
@@ -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<IGetUserNotificationsResponse> => {
Expand Down
4 changes: 2 additions & 2 deletions src/shared/lib/hooks/store-hooks.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/shared/ui/badge/badge.tsx → src/shared/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLDivElement>,
Expand Down
Original file line number Diff line number Diff line change
@@ -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<IActionButtonProps> = ({
const ButtonAction: FC<IButtonActionProps> = ({
children,
icon,
className,
Expand Down Expand Up @@ -41,4 +41,4 @@ const ActionButton: FC<IActionButtonProps> = ({
)
}

export default ActionButton
export { ButtonAction }
Original file line number Diff line number Diff line change
@@ -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<INavButtonProps> = ({
const ButtonNav: FC<IButtonNavProps> = ({
children,
icon,
className = '',
Expand Down Expand Up @@ -48,4 +48,4 @@ const NavButton: FC<INavButtonProps> = ({
)
}

export default NavButton
export { ButtonNav }
Original file line number Diff line number Diff line change
@@ -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<ISettingButtonProps> = ({
const ButtonSetting: FC<IButtonSettingProps> = ({
className,
icon,
badge = 0,
Expand Down Expand Up @@ -37,4 +36,4 @@ const SettingButton: FC<ISettingButtonProps> = ({
)
}

export default SettingButton
export { ButtonSetting }
Original file line number Diff line number Diff line change
@@ -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<ITabButtonProps> = ({ children, badge, isActive, onClick }) => {
const ButtonTab: FC<IButtonTabProps> = ({ children, badge, isActive, onClick }) => {
return (
<div
className={isActive ? 'bg-smokyWhite dark:bg-brownBlack rounded-md' : 'rounded-md'}
Expand All @@ -28,4 +28,4 @@ const TabButton: FC<ITabButtonProps> = ({ children, badge, isActive, onClick })
)
}

export default TabButton
export { ButtonTab }
8 changes: 4 additions & 4 deletions src/shared/ui/button/button.tsx → src/shared/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLButtonElement>,
Expand Down Expand Up @@ -55,4 +55,4 @@ const Button = forwardRef<HTMLButtonElement, IButtonProps>(
)
Button.displayName = 'Button'

export default Button
export { Button }
2 changes: 1 addition & 1 deletion src/shared/ui/card/card.tsx → src/shared/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit 951ad13

Please sign in to comment.