Skip to content

Commit

Permalink
[FE] refactor after merge #643, #642 (#649)
Browse files Browse the repository at this point in the history
* Refactor : Remove unused code and update import path

* Refactor : Update default topic and profile images

* Refactor :  Profile component and update routingHandlers
  • Loading branch information
jiwonh423 authored Feb 5, 2024
1 parent f7d8897 commit d77d381
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 58 deletions.
36 changes: 0 additions & 36 deletions frontend/src/apis/Patrick/http.ts

This file was deleted.

6 changes: 0 additions & 6 deletions frontend/src/apis/Patrick/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/src/apis/new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ import { TopicCardProps } from '../../types/Topic';
import { http } from './http';

export const getTopics = (url: string) => http.get<TopicCardProps[]>(url);

export const getProfile = () =>
http.get<TopicCardProps[] | null>('/members/my/topics');
2 changes: 1 addition & 1 deletion frontend/src/components/TopicCardList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ReactNode } from 'react';

import useGetTopics from '../../apiHooks/new/useGetTopics';
import Button from '../common/Button';
import Flex from '../common/Flex';
import Grid from '../common/Grid';
import Space from '../common/Space';
import Text from '../common/Text';
import TopicCard from '../TopicCard';
import useProfileList from '../../hooks/queries/useProfileList';

interface TopicCardListProps {
url: string;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export const SIDEBAR = '372px';
export const LAYOUT_PADDING = '40px';

export const DEFAULT_TOPIC_IMAGE =
'https://dr702blqc4x5d.cloudfront.net/2023-map-be-fine/icon/topic_defaultImage.svg';
'https://velog.velcdn.com/images/semnil5202/post/37f3bcb9-0b07-4100-85f6-f1d5ad037c14/image.svg';
export const DEFAULT_PROFILE_IMAGE =
'https://dr702blqc4x5d.cloudfront.net/2023-map-be-fine/icon/profile_defaultImage.svg';
'https://avatars.githubusercontent.com/u/103165859?v=4';

export const DEFAULT_PROD_URL =
process.env.APP_URL || 'https://mapbefine.com/api';
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/hooks/queries/useProfileList.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useSuspenseQuery } from '@tanstack/react-query';
import { getProfile } from '../../apis/Patrick';

import { getProfile } from '../../apis/new';

const useProfileList = () => {
const { data, refetch } = useSuspenseQuery({
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import ReactDOM from 'react-dom/client';
import ReactGA from 'react-ga4';
import { ThemeProvider } from 'styled-components';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

import App from './App';
import ErrorBoundary from './components/ErrorBoundary';
Expand All @@ -25,8 +24,6 @@ const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Failed to find the root element');
const root = ReactDOM.createRoot(rootElement);

const queryClient = new QueryClient();

// if (process.env.NODE_ENV === 'development') {
// const { worker } = require('./mocks/browser');
// worker.start({ quiet: true });
Expand Down
11 changes: 3 additions & 8 deletions frontend/src/pages/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ import useSetNavbarHighlight from '../hooks/useSetNavbarHighlight';
const TopicCardList = lazy(() => import('../components/TopicCardList'));

function Profile() {
const { routePage } = useNavigator();
const { routingHandlers } = useNavigator();
useSetLayoutWidth(FULLSCREEN);
useSetNavbarHighlight('profile');

const goToNewTopic = () => {
routePage('/new-topic');
};

return (
<Wrapper>
<MyInfoWrapper $justifyContent="center" $alignItems="center">
Expand Down Expand Up @@ -56,10 +52,9 @@ function Profile() {
<Suspense fallback={<TopicListSkeleton />}>
<TopicCardList
url="/members/my/topics"
errorMessage="๋กœ๊ทธ์ธ ํ›„ ์ด์šฉํ•ด์ฃผ์„ธ์š”."
commentWhenEmpty="์ถ”๊ฐ€ํ•˜๊ธฐ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ ์ง€๋„๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด์„ธ์š”."
pageCommentWhenEmpty="์ง€๋„ ๋งŒ๋“ค๋Ÿฌ ๊ฐ€๊ธฐ"
routePage={goToNewTopic}
routePageName="๋ฉ”์ธ ํŽ˜์ด์ง€๋กœ ๊ฐ€๊ธฐ"
routePage={routingHandlers.home}
/>
</Suspense>

Expand Down
1 change: 0 additions & 1 deletion frontend/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Home from './pages/Home';
import NotFound from './pages/NotFound';
import RootPage from './pages/RootPage';
import Search from './pages/Search';
import TopicListSkeleton from './components/Skeletons/TopicListSkeleton';

const SelectedTopic = lazy(() => import('./pages/SelectedTopic'));
const NewPin = lazy(() => import('./pages/NewPin'));
Expand Down

0 comments on commit d77d381

Please sign in to comment.