Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
da6ee83
Feat: import문 정렬을 위한 eslint-plugin 설치
gustn99 Dec 19, 2024
2ba7be7
Feat: eslint-plugin-import 관련 설정 추가
gustn99 Dec 21, 2024
1d249e9
Feat: eslint-plugin-import pathGroups 설정 추가
gustn99 Dec 22, 2024
703a38f
Merge branch 'dev' of https://github.com/oodd-team/oodd-web-react int…
gustn99 Dec 29, 2024
1df5232
Fix: 전체 페이지 경로(주소) 리팩토링
gustn99 Dec 29, 2024
1e506fe
Fix: 바텀시트 관련 컴포넌트 폴더 이동 및 그에 따른 경로 수정
gustn99 Dec 29, 2024
0cb7bb1
Fix: profile 페이지 폴더 이동
gustn99 Dec 29, 2024
3dffa75
Fix: account* 페이지 폴더 이동
gustn99 Dec 29, 2024
6a4ddaf
Fix: verivication 폴더명 수정 중
gustn99 Dec 29, 2024
c0c77af
Fix: verivication 폴더명 수정 완
gustn99 Dec 29, 2024
83e4d83
Fix: post* 페이지 폴더 이동 및 그에 따른 경로 수정
gustn99 Dec 29, 2024
8d5f5bf
Fix: signup* 페이지 폴더 이동 및 그에 따른 경로 수정
gustn99 Dec 29, 2024
fccf9dc
Fix: eslint에 따라 styled -> {styled}로 수정
gustn99 Dec 29, 2024
09ddcb7
Fix: 기타 컴포넌트 import문 수정
gustn99 Dec 29, 2024
8afc65c
Fix: 바텀시트 컴포넌트 import문 수정
gustn99 Dec 29, 2024
59e4e5d
Fix: 유저 프로필 컴포넌트 import문 수정
gustn99 Dec 29, 2024
d4cfc1f
Fix: 소켓 import문 수정
gustn99 Dec 29, 2024
92be65f
Fix: account 페이지 import문 수정
gustn99 Dec 29, 2024
82e64e7
Fix: chatRoom 페이지 import문 수정
gustn99 Dec 29, 2024
297e834
Fix: chats 페이지 import문 수정
gustn99 Dec 29, 2024
4d9ee4b
Fix: home 페이지 import문 수정
gustn99 Dec 29, 2024
5b6fbf9
Fix: login 페이지 import문 수정
gustn99 Dec 29, 2024
9507dce
Fix: signup & notfound 페이지 import문 수정
gustn99 Dec 29, 2024
c829ee2
Fix: postbase 페이지 import문 수정
gustn99 Dec 29, 2024
9578fda
Fix: 나머지 post 페이지 import문 수정
gustn99 Dec 29, 2024
fb14bee
Fix: profile 페이지 import문 수정
gustn99 Dec 29, 2024
9262a90
Fix: recoil 등 기타 파일 import문 수정
gustn99 Dec 29, 2024
955321d
Fix: error 객체를 직접 참조하지 않도록 수정
gustn99 Dec 29, 2024
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
108 changes: 100 additions & 8 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,109 @@
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'plugin:import/recommended',
'plugin:prettier/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: { project: ['./tsconfig.json'] },
plugins: ['@typescript-eslint'],
parserOptions: {
project: ['./tsconfig.app.json', './tsconfig.node.json'],
},
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
settings: {
'import/resolver': {
typescript: {
project: ['./tsconfig.app.json', './tsconfig.node.json'],
},
},
'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] },
},
env: {
node: true,
},
rules: {
'@typescript-eslint/strict-boolean-expressions': [
2,
'prettier/prettier': ['error', { endOfLine: 'auto' }],
'import/extensions': [
'error',
'ignorePackages',
{
allowString: false,
allowNumber: false,
ts: 'never',
tsx: 'never',
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'index', 'type', 'parent', 'sibling', 'object'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
pathGroups: [
{
pattern: 'react*',
group: 'builtin',
position: 'before',
},
{
pattern: '@components/**/dto',
group: 'type',
},
{
pattern: '@styles/**',
group: 'internal',
position: 'before',
},
{
pattern: '@assets/**',
group: 'internal',
position: 'after',
},
{
pattern: '@components/Icons/**',
group: 'internal',
position: 'after',
},
{
pattern: '@components/**',
group: 'internal',
position: 'after',
},
{
pattern: '../**/dto',
group: 'type',
position: 'after',
},
{
pattern: './**/dto',
group: 'type',
position: 'after',
},
{
pattern: '../**/index',
group: 'parent',
position: 'before',
},
{
pattern: './**/index',
group: 'parent',
position: 'before',
},
],
pathGroupsExcludedImportTypes: ['react*'],
},
],
},
ignorePatterns: ['src/**/*.test.ts', 'src/frontend/generated/*'],
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'import/order': 'error',
},
},
],
ignorePatterns: ['src/**/*.test.ts', 'src/frontend/generated/*', 'src/App.tsx'],
};
14 changes: 7 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"arrowParens": "always",
"useTabs": true
"trailingComma": "all",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"arrowParens": "always",
"useTabs": true
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^9.17.0",
"eslint": "^8.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.7",
Expand Down
69 changes: 37 additions & 32 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
import React from 'react';
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
import Home from './pages/Home';
import Login from './pages/Login';
import SignUp from './pages/SignUp';
import LoginComplete from './pages/Login/LoginComplete';
import TermsAgreement from './pages/TermsAgreement';

import Profile from './pages/Profile';
import ProfileEdit from './pages/ProfileEdit';
import AccountSetting from './pages/AccountSetting';
import AccountEdit from './pages/AccountEdit';
import AccountCancel from './pages/AccountCancel';
import Verification from './pages/verification';

import Post from './pages/Post';
import PostUpload from './pages/PostUpload';
import PostImageSelect from './pages/PostImageSelect';
import PostInstaConnect from './pages/PostInstaConnect';
import PostInstaFeedSelect from './pages/PostInstaFeedSelect';

import Chats from './pages/Chats';
import ChatRoom from './pages/Chats/ChatRoom';

import NotFound from './pages/NotFound';

import Home from '@pages/Home';
import Login from '@pages/Login';
import LoginComplete from '@pages/Login/LoginComplete';

import SignUp from '@pages/SignUp';
import TermsAgreement from '@pages/SignUp/TermsAgreement';

import Profile from '@pages/Profile';
import ProfileEdit from '@pages/Profile/ProfileEdit';

import AccountSetting from '@pages/Account/AccountSetting';
import AccountEdit from '@pages/Account/AccountEdit';
import AccountCancel from '@pages/Account/AccountCancel';
import Verification from '@pages/Account/Verification';

import Post from '@pages/Post';
import PostUpload from '@pages/Post/PostUpload';
import PostImageSelect from '@pages/Post/PostImageSelect';
import PostInstaConnect from '@pages/Post/PostInstaConnect';
import PostInstaFeedSelect from '@pages/Post/PostInstaFeedSelect';

import Chats from '@pages/Chats';
import ChatRoom from '@pages/Chats/ChatRoom';

import NotFound from '@pages/NotFound';

const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
const isAuthenticated = Boolean(localStorage.getItem('new_jwt_token'));
Expand All @@ -33,19 +36,21 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
const protectedRoutes = [
{ path: '/', element: <Home /> },

// 사용자 프로필 및 계정 관리
// profile
{ path: '/profile/:userId', element: <Profile /> },
{ path: '/profile/edit', element: <ProfileEdit /> },
{ path: '/account-setting', element: <AccountSetting /> },
{ path: '/account-edit', element: <AccountEdit /> },
{ path: '/account-cancel', element: <AccountCancel /> },
{ path: '/verification', element: <Verification /> },

// account
{ path: '/account/setting', element: <AccountSetting /> },
{ path: '/account/edit', element: <AccountEdit /> },
{ path: '/account/cancel', element: <AccountCancel /> },
{ path: '/account/verification', element: <Verification /> },

{ path: '/post/:postId', element: <Post /> },
{ path: '/upload', element: <PostUpload /> },
{ path: '/image-select', element: <PostImageSelect /> },
{ path: '/insta-connect', element: <PostInstaConnect /> },
{ path: '/insta-feed-select', element: <PostInstaFeedSelect /> },
{ path: '/post/upload/photo/select', element: <PostImageSelect /> },
{ path: '/post/upload/instagram/connect', element: <PostInstaConnect /> },
{ path: '/post/upload/instagram/select', element: <PostInstaFeedSelect /> },
{ path: '/post/upload/content', element: <PostUpload /> },

// 메시지/채팅
{ path: '/chats', element: <Chats /> },
Expand Down
1 change: 1 addition & 0 deletions src/apis/util/handleError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AxiosError } from 'axios';

import { ApiDomain, errorMessages } from './errorMessage';

export const handleError = (error: unknown, domain: ApiDomain = 'default') => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/BottomButton/dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface BottomButtonProps {
content: String;
content: string;
onClick: () => void;
disabled?: boolean;
}
19 changes: 9 additions & 10 deletions src/components/BottomButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React from 'react';
import { StyledText } from '@components/Text/StyledText';

import type { BottomButtonProps } from './dto';

import { ButtonWrapper, Button } from './styles';
import { StyledText } from '../Text/StyledText';
import { BottomButtonProps } from './dto';

const BottomButton: React.FC<BottomButtonProps> = ({ content, onClick, disabled = false }) => {
return (
<>
<ButtonWrapper>
<Button onClick={onClick} disabled={disabled}>
<StyledText $textTheme={{ style: 'body1-regular', lineHeight: 2 }}>{content}</StyledText>
</Button>
</ButtonWrapper>
</>
<ButtonWrapper>
<Button onClick={onClick} disabled={disabled}>
<StyledText $textTheme={{ style: 'body1-regular', lineHeight: 2 }}>{content}</StyledText>
</Button>
</ButtonWrapper>
);
};

Expand Down
7 changes: 4 additions & 3 deletions src/components/BottomButton/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

export const ButtonWrapper = styled.div`
display: flex;
Expand All @@ -15,8 +15,9 @@ export const ButtonWrapper = styled.div`
`;

export const Button = styled.button<{ disabled: boolean }>`
background: ${({ disabled, theme }) => //theme에 없어서 그냥 뒀음
disabled ? 'linear-gradient(93deg, #FFC1D6 1.22%, #F8D4D4 99.73%)' : theme.colors.brand.gradient};
background: ${(
{ disabled, theme }, //theme에 없어서 그냥 뒀음
) => (disabled ? 'linear-gradient(93deg, #FFC1D6 1.22%, #F8D4D4 99.73%)' : theme.colors.brand.gradient)};
border-radius: 0.625rem;
font-size: 1rem;
width: calc(100% - 2.5rem);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { memo } from 'react';

import theme from '@styles/theme';

import { StyledText } from '@components/Text/StyledText';
import { BottomSheetMenuLayout, SheetItem, IconButton } from './styles';

import type { BottomSheetMenuProps, SheetItemDto } from './dto';
import React from 'react';
import theme from '@styles/theme';

const BottomSheetMenu: React.FC<BottomSheetMenuProps> = React.memo(({ items }) => {
import { BottomSheetMenuLayout, SheetItem, IconButton } from './styles';

const BottomSheetMenu: React.FC<BottomSheetMenuProps> = memo(({ items }) => {
return (
<BottomSheetMenuLayout>
{items.map((item: SheetItemDto, index) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

export const BottomSheetMenuLayout = styled.ul`
margin-bottom: 0.62rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { StyledText } from '@components/Text/StyledText';
import { CommentLayout, SendContainer, CommentTextarea, SendButton } from './styles';
import { useEffect, useRef, useState } from 'react';

import send from '@assets/default/send-comment.svg';
import React, { useEffect, useRef, useState } from 'react';

import { StyledText } from '@components/Text/StyledText';

import type { CommentProps } from './dto';

import { CommentLayout, SendContainer, CommentTextarea, SendButton } from './styles';

const Comment: React.FC<CommentProps> = ({ content, sendComment, isModal = false }) => {
const [comment, setComment] = useState('');
const textareaRef = useRef<HTMLTextAreaElement>(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

export const CommentLayout = styled.div<{ $isModal: boolean }>`
margin: 1.38rem auto 1.25rem auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { StyledText } from '@components/Text/StyledText';
import theme from '@styles/theme';

import BottomSheet from '@components/BottomSheet';
import Comment from './Comment/index';
import type { BottomSheetProps } from '@components/BottomSheet/dto';
import type { CommentBottomSheetProps } from './dto';
import closeIcon from '@assets/default/modal-close-white.svg';

import { StyledText } from '@components/Text/StyledText';

import type { BottomSheetProps } from '../dto';

import type { CommentBottomSheetProps } from './dto';

import BottomSheet from '../index';

import Comment from './Comment/index';

import {
CommentBottomSheetLayout,
CommentModalBox,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

export const CommentBottomSheetLayout = styled.div`
${({ theme }) => theme.visibleOnMobileTablet};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import React, { useState, useRef, useCallback, useEffect } from 'react';
import { useState, useRef, useCallback, useEffect, memo } from 'react';

import BottomButton from '@components/BottomButton';
import BottomSheetMenu from '@components/BottomSheetMenu';
import { SheetItemDto } from '@components/BottomSheetMenu/dto';

import type { ReportBottomSheetMenuProps } from './dto';

import { SheetItemDto } from '../../BottomSheetMenu/dto';
import BottomSheetMenu from '../../BottomSheetMenu/index';

import { InputLayout, ReportBottomSheetMenuWrappar } from './styles';

const ReportBottomSheetMenu: React.FC<ReportBottomSheetMenuProps> = React.memo(
const ReportBottomSheetMenu: React.FC<ReportBottomSheetMenuProps> = memo(
({ onCloseReportSheet, onOpenStatusModal, sendReport, isUserReport }) => {
const [isVisibleTextarea, setIsTextareaVisible] = useState(false);
const [inputValue, setInputValue] = useState('');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

export const ReportBottomSheetMenuWrappar = styled.div`
display: flex;
Expand Down
Loading
Loading