Skip to content

Commit 610cc32

Browse files
authored
Merge pull request #327 from Nexters/develop
[운영배포] 선물하기 버그수정, 공연 시간 버그 수정
2 parents e0fb9fc + 3d746ff commit 610cc32

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

apps/admin/src/pages/GiftRegisterPage/components/GiftInformation/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { format } from 'date-fns/format';
77
import { GiftStatus } from '@boolti/api/src/types/gift';
88
import { useDeviceWidth } from '~/hooks/useDeviceWidth';
99
import { useTheme } from '@emotion/react';
10-
import { openStoreLink } from '~/utils/link';
1110
import { LINK } from '~/constants/link';
11+
import { navigateToAppScheme } from '~/utils/app';
1212

1313
const GiftInformation = () => {
1414
const { giftId = '' } = useParams<{ giftId: string }>();
@@ -53,7 +53,7 @@ const GiftInformation = () => {
5353
return;
5454
}
5555

56-
openStoreLink();
56+
navigateToAppScheme(`boolti://gift/${giftId}`);
5757
};
5858

5959
return (

apps/admin/src/pages/ShowInfoPage/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ const ShowInfoPage = () => {
4646
const isImageFilesDirty = imageFiles.some((file) => file.preview.startsWith('blob:'));
4747
const isCastTeamListDraftDirty =
4848
initialCastTeamListRef.current !== JSON.stringify(castTeamListDraft);
49-
const showBasicInfoForm = useForm<ShowBasicInfoFormInputs>();
50-
const showDetailInfoForm = useForm<ShowDetailInfoFormInputs>();
5149

5250
const showId = Number(params!.showId);
5351
const { data: show, refetch: refetchShowDetail } = useShowDetail(showId);
5452
const { data: showSalesInfo, refetch: refetchShowSalesInfo } = useShowSalesInfo(showId);
5553
const { data: castTeamList, refetch: refetchCastTeamList } = useCastTeamList(showId);
5654

55+
const showBasicInfoForm = useForm<ShowBasicInfoFormInputs>();
56+
const showDetailInfoForm = useForm<ShowDetailInfoFormInputs>();
57+
5758
const editShowInfoMutation = useEditShowInfo();
5859
const uploadShowImageMutation = useUploadShowImage();
5960
const isNonTicketingShow = !showSalesInfo?.salesEndTime && !showSalesInfo?.salesStartTime;

apps/admin/src/utils/app.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { openStoreLink } from './link';
2+
3+
export const navigateToAppScheme = async (appScheme: string) => {
4+
let timerId: ReturnType<typeof setTimeout>;
5+
6+
return new Promise((resolve) => {
7+
const startTime = Date.now();
8+
9+
const handleVisibilityChange = () => {
10+
if (document.hidden) {
11+
clearTimeout(timerId);
12+
document.removeEventListener('visibilitychange', handleVisibilityChange);
13+
14+
resolve(true);
15+
}
16+
};
17+
18+
window.addEventListener(
19+
'blur',
20+
() => {
21+
clearTimeout(timerId);
22+
document.removeEventListener('visibilitychange', handleVisibilityChange);
23+
resolve(true);
24+
},
25+
{ once: true },
26+
);
27+
28+
window.location.href = appScheme;
29+
30+
timerId = setTimeout(() => {
31+
document.removeEventListener('visibilitychange', handleVisibilityChange);
32+
33+
const elapsedTime = Date.now() - startTime;
34+
35+
if (elapsedTime < 1_500) {
36+
resolve(false);
37+
38+
openStoreLink();
39+
} else {
40+
resolve(false);
41+
}
42+
}, 2_000);
43+
});
44+
};

packages/ui/src/components/TimePicker/index.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ function TimePicker({ disabled, errorMessage, value, onChange, onBlur }: Props)
2424
const ref = useRef<HTMLDivElement>(null);
2525
const hourRef = useRef<HTMLDivElement>(null);
2626
const minuteRef = useRef<HTMLDivElement>(null);
27+
2728
const [hour, minute] = value ? value.split(':').map(Number) : [];
2829
const [isAM, setIsAM] = useState(value ? hour < 12 : true);
2930
const [open, setIsOpen] = useState(false);
@@ -59,6 +60,15 @@ function TimePicker({ disabled, errorMessage, value, onChange, onBlur }: Props)
5960
// eslint-disable-next-line react-hooks/exhaustive-deps
6061
}, [open]);
6162

63+
useEffect(() => {
64+
if (value) {
65+
const [hour, minute] = value.split(':').map(Number);
66+
setCurrentHour(hour);
67+
setCurrentMinute(minute);
68+
setIsAM(hour < 12);
69+
}
70+
}, [value]);
71+
6272
useEffect(() => {
6373
if (nextValue) {
6474
onChange?.(nextValue);

0 commit comments

Comments
 (0)