Skip to content

Commit c17165e

Browse files
Merge pull request #162 from dnd-side-project/feature/#158/dowmtime-notice
2 parents 1f13526 + 9d5f1f9 commit c17165e

File tree

5 files changed

+28
-19
lines changed

5 files changed

+28
-19
lines changed

src/App.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from '@/assets/images'
2222
import { useAnonymousLogin } from '@/features/auth/model/useAuth'
2323
import { useAuthStore } from '@/features/auth/store/authStore'
24+
import { isDowntimeNow } from '@/shared/lib/isDowntimeNow'
2425
import { GlobalErrorModal } from '@/shared/ui'
2526
import NavBar, { NAV_HEIGHT } from '@/widgets/layout/NavBar'
2627

@@ -42,7 +43,6 @@ const App = () => {
4243
const LAYOUT_BOTTOM_GAP = isMobileView ? 16 : 34
4344

4445
// 비회원일 경우 API 호출을 위한 익명 토큰 발급
45-
// TODO: 토큰 만료됐을 경우 응답 체크해서 해당 값일 경우 토큰 재발급
4646
const checkAnonymousLogin = () => {
4747
const token = sessionStorage.getItem('anonymous_token')
4848
if (!isLogin && !token) {
@@ -85,23 +85,17 @@ const App = () => {
8585

8686
useEffect(() => {
8787
const { pathname } = location
88+
const isDowntime = isDowntimeNow()
8889

89-
// 서버 클로징 시간(한국 기준 3시~7시)일 경우 /downtime으로 랜딩
90-
const hourKST = Number(
91-
new Date().toLocaleString('en-US', {
92-
timeZone: 'Asia/Seoul',
93-
hour: '2-digit',
94-
hour12: false,
95-
})
96-
)
97-
const isDowntime = hourKST >= 3 && hourKST < 7
90+
// 네비게이션 미노출 여부 확인
91+
setIsNavVisible(!getHideNav(pathname))
9892

99-
if (isDowntime && pathname !== '/downtime') {
100-
navigate('/downtime')
93+
if (isDowntime) {
94+
if (pathname !== '/downtime') navigate('/downtime')
10195
return
10296
}
10397

104-
if (!isDowntime && pathname === '/downtime') {
98+
if (pathname === '/downtime') {
10599
navigate('/')
106100
return
107101
}
@@ -112,9 +106,6 @@ const App = () => {
112106
} else {
113107
checkAnonymousLogin()
114108
}
115-
116-
// 네비게이션 미노출 여부 확인
117-
setIsNavVisible(!getHideNav(pathname))
118109
}, [location.pathname])
119110

120111
return (

src/entities/playlist/model/usePlaylists.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from '@/entities/playlist/api/playlist'
1616
import type { Cursor, PlaylistResponse } from '@/entities/playlist/types/playlist'
1717
import { useAuthStore } from '@/features/auth/store/authStore'
18+
import { isDowntimeNow } from '@/shared/lib/isDowntimeNow'
1819

1920
export const useShufflePlaylists = (size: number = 5) => {
2021
return useInfiniteQuery<
@@ -38,7 +39,9 @@ export const useShufflePlaylists = (size: number = 5) => {
3839
}
3940
return undefined
4041
},
41-
enabled: !!useAuthStore.getState().accessToken || !!sessionStorage.getItem('anonymous_token'),
42+
enabled:
43+
(!!useAuthStore.getState().accessToken || !!sessionStorage.getItem('anonymous_token')) &&
44+
!isDowntimeNow(),
4245
})
4346
}
4447

src/pages/home/ui/FeedbackBottomSheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const FeedbackBottomSheet = ({ isOpen, onClose }: FeedbackBottomSheetProps) => {
4242
<img src={FeedbackImg} alt="feedback" width={206} height={206} />
4343
</Content>
4444
<ButtonWrapper>
45-
<Label>~ 11/30(일)까지</Label>
45+
<Label>~ 12/31(수)까지</Label>
4646
<Button onClick={() => navigate('/feedback')} size="L" state="primary">
4747
유저테스트 참여하기
4848
</Button>

src/pages/mycd/ui/PlaylistCarousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export default PlaylistCarousel
9999
const EmblaSlide = styled.div<{ $isMobile?: boolean }>`
100100
flex: 0 0 50%;
101101
${flexRowCenter}
102-
padding: ${({ $isMobile }) => ($isMobile ? '4px 0 0 0' : '16px 0')};
102+
padding: ${({ $isMobile }) => ($isMobile ? '6px 0 0 0' : '16px 0')};
103103
`
104104

105105
const Slide = styled.div<{ $active?: boolean; $isMobile?: boolean }>`

src/shared/lib/isDowntimeNow.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// 서버 클로징 시간 (한국 기준 3시~7시)
2+
const START_HOUR = 3
3+
const END_HOUR = 7
4+
5+
export const isDowntimeNow = () => {
6+
const hourKST = Number(
7+
new Date().toLocaleString('en-US', {
8+
timeZone: 'Asia/Seoul',
9+
hour: '2-digit',
10+
hour12: false,
11+
})
12+
)
13+
14+
return hourKST >= START_HOUR && hourKST < END_HOUR
15+
}

0 commit comments

Comments
 (0)