Skip to content

Commit 597e7f6

Browse files
authored
Merge pull request #226 from kakao-tech-campus-2nd-step3/Develop
개발 상황 μ—…λ°μ΄νŠΈ
2 parents 97dc9a8 + f3e3009 commit 597e7f6

File tree

9 files changed

+167
-47
lines changed

9 files changed

+167
-47
lines changed

β€Žsrc/app/routes/path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const RouterPath = {
22
ROOT: '/',
3+
ONBOARD: 'onboard',
34
LOGIN: 'login',
45
SIGNUP: 'signup',
56
REGISTER: 'register',

β€Žsrc/app/routes/router.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom';
33

44
import { ProtectedRoute } from './components';
55
import { RouterPath } from './path';
6-
import { OnboardPage, RedirectPage, DummyRedirectPage } from '@/pages';
6+
import {
7+
OnboardPage,
8+
RedirectPage,
9+
DummyRedirectPage,
10+
RootPage,
11+
} from '@/pages';
712
import { Layout, LoadingView } from '@/shared/components';
813

914
export const RegisterPage = lazy(
@@ -128,6 +133,15 @@ export const router = createBrowserRouter([
128133
children: [
129134
{
130135
path: '',
136+
children: [
137+
{
138+
index: true,
139+
element: <RootPage />,
140+
},
141+
],
142+
},
143+
{
144+
path: RouterPath.ONBOARD,
131145
children: [
132146
{
133147
index: true,

β€Žsrc/pages/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './onboard';
33
export * from './redirect';
44
export * from './register';
55
export * from './service-manual';
6+
export * from './root';

β€Žsrc/pages/common/root/RootPage.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Navigate } from 'react-router-dom';
2+
3+
export const RootPage = () => {
4+
if (window.location.pathname !== '/') return null;
5+
6+
return <Navigate to='/onboard' />;
7+
};

β€Žsrc/pages/common/root/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { RootPage } from './RootPage';

β€Žsrc/pages/guard/guard-main/components/hello-call-apply/HelloCallApply.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const HelloCallApply = () => {
2626
<IconArrow fill='black' />
2727
</ServiceApplyButton>
2828
</Link>
29-
<StyledImage src={HelloCallImg} alt='hello-call' />
29+
<StyledImage src={HelloCallImg} alt='hello-call' fetchpriority='high' />
3030
</ContentWrapper>
3131
</Flex>
3232
);

β€Žsrc/pages/guard/hello-call-report/components/GuardReportDetail.tsx

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,16 @@ import { useReport } from '../hooks/useReport';
33
import IconCalendar from '@/pages/assets/hello-call/calendar.svg';
44
import IconFile from '@/pages/assets/hello-call/file.svg';
55
import heartIcon from '@/pages/assets/hello-call/heart.svg';
6-
import { Box, Text, Image, Divider, Button, Flex } from '@chakra-ui/react';
6+
import {
7+
Box,
8+
Text,
9+
Image,
10+
Divider,
11+
Button,
12+
Flex,
13+
Skeleton,
14+
SkeletonText,
15+
} from '@chakra-ui/react';
716

817
type Props = {
918
helloCallId: number;
@@ -13,8 +22,40 @@ const GuardReportDetail = ({ helloCallId }: Props) => {
1322
const { reportData, isLoading, isError } = useReport(helloCallId);
1423
const { completeHelloCall } = useCompleteHelloCall(helloCallId);
1524

16-
if (isLoading) return <Text>Loading...</Text>;
17-
if (isError) return <Text>Error loading report data</Text>;
25+
if (isLoading) {
26+
return (
27+
<>
28+
<Flex
29+
justifyContent='center'
30+
alignItems='center'
31+
backgroundColor='var(--color-secondary)'
32+
borderRadius='5px'
33+
padding='0.5rem'
34+
>
35+
<SkeletonText noOfLines={2} spacing='4' width='80%' />
36+
</Flex>
37+
<Flex
38+
direction='column'
39+
width='full'
40+
padding={4}
41+
borderRadius='0.5rem'
42+
gap='1rem'
43+
backgroundColor='#e4e4e4'
44+
border='1px solid var(--color-gray)'
45+
>
46+
<Skeleton height='50px' width='100%' />
47+
<Skeleton height='50px' width='100%' />
48+
<Skeleton height='50px' width='100%' />
49+
</Flex>
50+
<Divider />
51+
<Skeleton height='40px' width='200px' marginBottom='10px' />
52+
</>
53+
);
54+
}
55+
56+
if (isError) {
57+
return <Text>λ³΄κ³ μ„œλ₯Ό 뢈러올 수 μ—†μŠ΅λ‹ˆλ‹€!</Text>;
58+
}
1859

1960
return (
2061
<>

β€Žsrc/pages/sinitto/hello-call-list/ui/HelloCallListPage.tsx

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import {
66
useNavigateToDetail,
77
useGetServiceList,
88
} from '../hooks';
9-
import { LoadingView } from '@/shared/components';
10-
import { Text } from '@chakra-ui/react';
9+
import { Text, Skeleton } from '@chakra-ui/react';
1110
import styled from '@emotion/styled';
1211

1312
const CallRequest = lazy(
@@ -28,28 +27,46 @@ const HelloCallListPage = () => {
2827

2928
const allContent = data?.pages.flatMap((page) => page.content) ?? [];
3029

31-
if (isLoading && !data) return <LoadingView />;
30+
if (isLoading && !data) {
31+
return (
32+
<SkeletonPageWrapper>
33+
<Skeleton height='60px' width='100%' mb='1rem' />
34+
<Skeleton height='60px' width='100%' mb='1rem' />
35+
<Skeleton height='60px' width='100%' mb='1rem' />
36+
<Skeleton height='60px' width='100%' mb='1rem' />
37+
</SkeletonPageWrapper>
38+
);
39+
}
40+
3241
if (isError && !isLastPageReached) return <Text>μ—λŸ¬κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.</Text>;
3342
if (!data) return null;
3443

3544
return (
3645
<HelloCallListLayout>
37-
{allContent.map((item, index) => {
38-
const isLastElement = index === allContent.length - 1;
39-
return (
40-
<CallRequest
41-
key={item.helloCallId}
42-
seniorName={item.seniorName}
43-
days={item.days}
44-
onClick={() => handlerNavigate(item.helloCallId)}
45-
ref={isLastElement ? lastElementRef : null}
46-
/>
47-
);
48-
})}
46+
{isLoading
47+
? Array(10)
48+
.fill(null)
49+
.map((_, index) => (
50+
<Skeleton key={index} height='70px' width='100%' mb='1rem' />
51+
))
52+
: allContent.map((item, index) => {
53+
const isLastElement = index === allContent.length - 1;
54+
return (
55+
<CallRequest
56+
key={item.helloCallId}
57+
seniorName={item.seniorName}
58+
days={item.days}
59+
onClick={() => handlerNavigate(item.helloCallId)}
60+
ref={isLastElement ? lastElementRef : null}
61+
/>
62+
);
63+
})}
4964
{(!hasNextPage || isLastPageReached) && (
5065
<Text>더 이상 μš”μ²­μ΄ μ—†μ–΄μš” πŸ₯²</Text>
5166
)}
52-
{isLoading && hasNextPage && !isLastPageReached && <LoadingView />}
67+
{isLoading && hasNextPage && !isLastPageReached && (
68+
<Skeleton height='70px' width='100%' mb='1rem' />
69+
)}
5370
</HelloCallListLayout>
5471
);
5572
};
@@ -64,3 +81,12 @@ const HelloCallListLayout = styled.div`
6481
gap: 1rem;
6582
margin: 3rem 1.5rem;
6683
`;
84+
85+
const SkeletonPageWrapper = styled.div`
86+
display: flex;
87+
flex-direction: column;
88+
align-items: center;
89+
height: 100%;
90+
gap: 1rem;
91+
margin: 3rem 1.5rem;
92+
`;

β€Žsrc/pages/sinitto/service-history/ui/SinittoServiceHistoryPage.tsx

Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
import {
2-
CallBackServiceList,
3-
HelloCallServiceList,
4-
TextArea,
5-
} from '../components';
1+
import { lazy } from 'react';
2+
63
import { CALLBACK_SCHEMA, HELLO_CALL_SCHEMA } from '../data';
74
import { useAcceptedCallBackData, useApplyHelloCallData } from '../hooks';
85
import { PageLayout } from '@/shared';
9-
import { Spinner, Flex } from '@chakra-ui/react';
6+
import { Flex, Skeleton } from '@chakra-ui/react';
107
import styled from '@emotion/styled';
118

9+
const CallBackServiceList = lazy(() =>
10+
import(
11+
'../components/common/call-back-service-list/CallBackServiceList'
12+
).then((module) => ({
13+
default: module.CallBackServiceList,
14+
}))
15+
);
16+
17+
const HelloCallServiceList = lazy(() =>
18+
import(
19+
'../components/common/hello-call-service-list/HelloCallServiceList'
20+
).then((module) => ({
21+
default: module.HelloCallServiceList,
22+
}))
23+
);
24+
25+
const TextArea = lazy(() =>
26+
import('../components/features/text-area/TextArea').then((module) => ({
27+
default: module.TextArea,
28+
}))
29+
);
30+
1231
export const SinittoServiceHistoryPage = () => {
1332
const { acceptedCallBackList, isAcceptedLoading, isAcceptedError } =
1433
useAcceptedCallBackData();
@@ -18,15 +37,19 @@ export const SinittoServiceHistoryPage = () => {
1837
return (
1938
<PageLayout>
2039
<Flex flexDir='column' w='full' gap='var(--space-sm)'>
21-
<TextArea
22-
title={CALLBACK_SCHEMA.TITLE}
23-
status={CALLBACK_SCHEMA.STATUS}
24-
description={CALLBACK_SCHEMA.DESCRIPTION}
25-
textDirection='start'
26-
/>
40+
{isAcceptedLoading ? (
41+
<SkeletonTextArea />
42+
) : (
43+
<TextArea
44+
title={CALLBACK_SCHEMA.TITLE}
45+
status={CALLBACK_SCHEMA.STATUS}
46+
description={CALLBACK_SCHEMA.DESCRIPTION}
47+
textDirection='start'
48+
/>
49+
)}
2750
{isAcceptedLoading ? (
2851
<StyledSpinnerWrapper>
29-
<Spinner size='lg' thickness='3px' color='blue.500' />
52+
<Skeleton height='50px' width='100%' />
3053
</StyledSpinnerWrapper>
3154
) : isAcceptedError ? (
3255
<NoServiceMessage>
@@ -46,21 +69,25 @@ export const SinittoServiceHistoryPage = () => {
4669
</Flex>
4770

4871
<Flex flexDir='column' w='full' gap='var(--space-sm)'>
49-
<TextArea
50-
title={HELLO_CALL_SCHEMA.TITLE}
51-
status={[
52-
HELLO_CALL_SCHEMA.STATUS_PROCESS,
53-
HELLO_CALL_SCHEMA.STATUS_FINISH,
54-
]}
55-
description={[
56-
HELLO_CALL_SCHEMA.DESCRIPTION_PROCESS,
57-
HELLO_CALL_SCHEMA.DESCRIPTION_FINISH,
58-
]}
59-
textDirection='end'
60-
/>
72+
{isApplyHelloLoading ? (
73+
<SkeletonTextArea />
74+
) : (
75+
<TextArea
76+
title={HELLO_CALL_SCHEMA.TITLE}
77+
status={[
78+
HELLO_CALL_SCHEMA.STATUS_PROCESS,
79+
HELLO_CALL_SCHEMA.STATUS_FINISH,
80+
]}
81+
description={[
82+
HELLO_CALL_SCHEMA.DESCRIPTION_PROCESS,
83+
HELLO_CALL_SCHEMA.DESCRIPTION_FINISH,
84+
]}
85+
textDirection='end'
86+
/>
87+
)}
6188
{isApplyHelloLoading ? (
6289
<StyledSpinnerWrapper>
63-
<Spinner size='lg' thickness='3px' color='blue.500' />
90+
<Skeleton height='50px' width='100%' />
6491
</StyledSpinnerWrapper>
6592
) : applyHelloCallList && applyHelloCallList.length > 0 ? (
6693
<Flex w='full' flexDir='column' gap='var(--space-xs)'>
@@ -96,3 +123,5 @@ const NoServiceMessage = styled.p`
96123
color: var(--color-black);
97124
text-align: center;
98125
`;
126+
127+
const SkeletonTextArea = () => <Skeleton height='150px' width='100%' />;

0 commit comments

Comments
Β (0)