Skip to content

Commit

Permalink
refactor: 컴포넌트 구조를 URL_MAP 기준으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
biud436 committed Jan 6, 2024
1 parent 3ab60c8 commit 5f2b7a8
Show file tree
Hide file tree
Showing 53 changed files with 50 additions and 153 deletions.
2 changes: 1 addition & 1 deletion src/app/posts/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React from 'react';
import { cookies, headers } from 'next/headers';
import { API_URL, CacheControl } from '@/blog/api/request';
import { Post } from '@/models/Post';
import { ErrorBoundary } from '@/blog/components/error/ErrorBoundary';
import { ErrorBoundary } from '@/blog/components/common/error/ErrorBoundary';
import { PostPage } from '@/blog/pages/post';
import { Metadata, ResolvingMetadata } from 'next';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ListItemButton from '@mui/material/ListItemButton';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
import LogoutIcon from '@mui/icons-material/Logout';
import { URL_MAP } from '@/common/URL';
import { useRouter } from 'next/navigation';

export function LoginButton() {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import * as React from 'react';
import Typography from '@mui/material/Typography';
import { URL_MAP } from '@/common/URL';
import { Box, Button, Grid } from '@mui/material';
import { NextRouter } from 'next/router';
import GitHubIcon from '@mui/icons-material/GitHub';
import RssFeedIcon from '@mui/icons-material/RssFeed';
import MetaCommonConfig from '@/blog/components/utils/meta-config.json';
import { WriteButton } from '@/blog/components/menu/WriteButton';
import MetaCommonConfig from '@/blog/components/common/utils/meta-config.json';
import { WriteButton } from '@/blog/components/common/menu/WriteButton';
import styled from 'styled-components';
import MenuIcon from '@mui/icons-material/Menu';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { useEffect } from 'react';
import { useAuth } from '@/blog/providers/auth/authProvider';
import { LoginButton } from '../category/LoginButton';
import { LogoutButton } from '../category/LogoutButton';
import { RequestHandler } from '../../api/axios';
import { ManageButton } from '@/blog/components/category/ManageButton';
import { RequestHandler } from '../../../api/axios';
import { ManageButton } from '@/blog/components/common/category/ManageButton';

export function LoginGuard() {
const auth = useAuth();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Box } from '@mui/material';
import { CategoryDepthVO } from '@/models/CategoryDepthVO';
import { observer } from 'mobx-react-lite';
import { menuStore } from '@/store/';
import { drawerWidth } from '../menu/AppBar';
import { drawerWidth } from './AppBar';
import { SideMenu } from './SideMenu';

export const MobileNav = observer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react';
import { DrawerHeader } from '@/blog/components/atomic/DrawerHeader';
import { DrawerHeader } from '@/blog/components/common/atomic/DrawerHeader';
import { Grid } from '@mui/material';
import { CategoryDepthVO } from '@/models/CategoryDepthVO';
import { observer } from 'mobx-react-lite';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Typography from '@mui/material/Typography';
import { Button, Box, Grid } from '@mui/material';
import { observer } from 'mobx-react-lite';
import NextLink from 'next/link';
import MetaCommonConfig from '@/blog/components/utils/meta-config.json';
import MetaCommonConfig from '@/blog/components/common/utils/meta-config.json';

export const MyBlogFooter = observer(() => (
<Grid container spacing={2} sx={{}}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Divider from '@mui/material/Divider';
import IconButton from '@mui/material/IconButton';
import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
import { DrawerHeader } from '@/blog/components/atomic/DrawerHeader';
import { DrawerHeader } from '@/blog/components/common/atomic/DrawerHeader';
import { CategoryDepthVO } from '@/models/CategoryDepthVO';
import { CategoryWrapper } from '../category/CategoryWrapper';
import { LoginGuard } from './LoginGuard';
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/blog/components/post/PostContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dynamic from 'next/dynamic';

const Viewer = dynamic(
async () => {
const [mod] = await Promise.all([import('../viewer/TuiEditorViewer')]);
const [mod] = await Promise.all([import('./viewer/TuiEditorViewer')]);

return mod.default;
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
CardMedia,
Typography,
} from '@mui/material';
import { DateUtil, Formatter } from '../../api/date';
import { DateUtil, Formatter } from '../../../api/date';
import LockIcon from '@mui/icons-material/Lock';

export interface CardStylePostProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react';
import { SearchBuilder } from '@/blog/components/builder/SearchBuilder';
import { SearchBuilder } from '@/blog/components/common/builder/SearchBuilder';

import { postsStore } from '@/store';
import { PostsSearchType } from '@/models/PostsSearchType';
Expand Down Expand Up @@ -107,11 +107,9 @@ export const PostsPresent = observer(() => {
const goToPage = (post: PostEntity) => {
const postId = post.id;
if (post.isPrivate) {
// router.push(`/secret/[id]`, `/secret/${postId}`);
router.push(`/secret/${postId}`);
return;
}
// router.push(`/posts/[id]`, `/posts/${postId}`);
router.push(`/posts/${postId}`);
};

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import codeSyntaxHighlight from '@toast-ui/editor-plugin-code-syntax-highlight';
import '@toast-ui/editor/dist/toastui-editor.css';

import '@toast-ui/editor/dist/i18n/ko-kr';
import { ForwardedScrollProgressBar } from '../atomic/ScrollProgressBar';
import { ForwardedScrollProgressBar } from '../../common/atomic/ScrollProgressBar';
import { useEffect, useMemo, useRef } from 'react';
import styled from 'styled-components';
import * as React from 'react';
import { useCallback } from 'react';
import { HeadingElementWrapper } from './HeadingElementWrapper';


declare var Prism: any;

const ViewerWrapper = styled.div`
Expand Down
60 changes: 0 additions & 60 deletions src/blog/components/posts/BoardStyle.tsx

This file was deleted.

62 changes: 0 additions & 62 deletions src/blog/components/posts/BoardStylePost.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/blog/pages/post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { observer } from 'mobx-react-lite';
import React, { useEffect } from 'react';
import { toast } from 'react-toastify';
import { PostPresent } from '../../components/post/PostPresent';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';
import { GlobalStyle } from '@/styles/global-styles';
import { PostServiceProvider } from '@/services/PostService';
import { useRouter } from 'next/navigation';
Expand Down
2 changes: 1 addition & 1 deletion src/blog/pages/posts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { observer } from 'mobx-react-lite';
import { PostsContainer } from '../../../containers/PostsContainer';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';
import { GlobalStyle } from '@/styles/global-styles';

export const PostsPage = observer(() => {
Expand Down
24 changes: 24 additions & 0 deletions src/common/URL.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
export const URL_MAP = {
MAIN: '/',
/**
* 로그인
*/
LOGIN: '/login',
/**
* 게시물 편집
*/
POST_EDIT: '/edit2',
/**
* 포스트
*/
POSTS: '/post',
/**
* 관리
*/
MANAGE: '/manage',
/**
* 카테고리 관리
*/
ADMIN_CATEGORY: '/manage/category',
/**
* 블로그 정보 관리
*/
ADMIN_BLOG_INFO: '/manage/info',
/**
* 포스트 관리
*/
ADMIN_POST: '/manage/post',
/**
* 비밀글
*/
SECRET: '/secret',
};
2 changes: 1 addition & 1 deletion src/containers/ErrorFoundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { MainLayout } from '@/layouts/BlogMainLayout';
import { Alert } from '@mui/material';
import { observer } from 'mobx-react-lite';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';

interface ErrorComponentProps {
message: string;
Expand Down
2 changes: 1 addition & 1 deletion src/containers/LoginContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useAuth } from '@/blog/providers/auth/authProvider';
import { toast, ToastContainer } from 'react-toastify';
import { Box, Button, Stack, ThemeProvider, Typography } from '@mui/material';
import { URL_MAP } from '@/common/URL';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';
import 'react-toastify/dist/ReactToastify.css';

import {
Expand Down
4 changes: 2 additions & 2 deletions src/containers/PostEditorContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useAuthorized } from '@/hooks/auth/useAuthorized';
import dynamic from 'next/dynamic';
import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';
import FlexibleLoading from '@/blog/components/common/FlexibleLoading';
import { PostEditorPageHeader } from './PostEditorPageHeader';
import { PostEditorPageDescription } from './PostEditorPageDescription';
Expand All @@ -22,7 +22,7 @@ export interface EditPageProps {
const PostEditorPresent = dynamic(
async () => {
const [mod] = await Promise.all([
import('../blog/components/editor/PostEditorPresent'),
import('../blog/components/post/editor/PostEditorPresent'),
]);

return mod.PostEditorPresent;
Expand Down
2 changes: 1 addition & 1 deletion src/containers/PostsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { observer } from 'mobx-react-lite';
import { PostsPresent } from '../blog/components/posts/PostsPresent';
import { PostsPresent } from '../blog/components/post/list/PostsPresent';

export const PostsContainer = observer(() => {
return <PostsPresent />;
Expand Down
10 changes: 5 additions & 5 deletions src/layouts/BlogMainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { useCategoryService } from '@/hooks/services/useCategoryService';
import { observer } from 'mobx-react-lite';
import { useMediaQuery } from 'react-responsive';
import { menuStore } from '@/store/';
import { MyBlogHeader } from '../blog/components/header/MyBlogHeader';
import { MobileNav } from '../blog/components/menu/MobileNav';
import { MobileHamburger } from '../blog/components/menu/MobileHamburger';
import { MyBlogContentContainer } from '../blog/components/menu/MyBlogContentContainer';
import { MyBlogContentConsumer } from '../blog/components/menu/MyBlogContentConsumer';
import { MyBlogHeader } from '../blog/components/common/header/MyBlogHeader';
import { MobileNav } from '../blog/components/common/menu/MobileNav';
import { MobileHamburger } from '../blog/components/common/menu/MobileHamburger';
import { MyBlogContentContainer } from '../blog/components/common/menu/MyBlogContentContainer';
import { MyBlogContentConsumer } from '../blog/components/common/menu/MyBlogContentConsumer';
import { useCategoryTree } from '@/hooks/api/useCategoryTree';
import { useRouter } from 'next/navigation';

Expand Down
2 changes: 1 addition & 1 deletion src/layouts/ManageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { ToastContainer } from 'react-toastify';

import { ManageMenu } from '../blog/components/manage/ManageMenu';
import 'react-toastify/dist/ReactToastify.css';
import { Meta } from '@/blog/components/utils/Meta';
import { Meta } from '@/blog/components/common/utils/Meta';
import { useCallback, useState } from 'react';
import { useThemeStore } from '@/hooks/useThemeStore';

Expand Down

0 comments on commit 5f2b7a8

Please sign in to comment.