-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuseRouter.ts
More file actions
85 lines (74 loc) · 2.64 KB
/
useRouter.ts
File metadata and controls
85 lines (74 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { useNavigate } from 'react-router-dom';
import { StockCountryKey } from '@ts/StockCountry';
import { TermKey } from '@ts/Term';
import { useIsMobile } from '@hooks/useIsMobile';
import { webPath } from '.';
const useRouter = () => {
const navigate = useNavigate();
const isMobile = useIsMobile();
const navToBack = () => navigate(-1);
const navToHome = () => navigate(webPath.home);
const navToStock = (name: string, country: StockCountryKey, options?: { replace?: boolean }) => {
navigate(`${webPath.stock}?name=${name}&country=${country}`, options);
};
const navToFavorites = () => navigate(webPath.favorites);
const navToShortView = () => navigate(webPath.shortView);
const navToLab = () => navigate(webPath.lab);
const navToMyPage = () => navigate(webPath.mypage);
const navToNotification = () => navigate(webPath.notification);
const navToUsage = () => navigate(webPath.usage);
const navToEditProfile = () => navigate(webPath.editProfile);
const navToEditProfileDone = () => navigate(webPath.editProfileDone);
const navToWithdraw = () => navigate(webPath.withdraw);
const navToWithdrawDone = () => navigate(webPath.withdrawDone);
const navToRegisterDone = () => navigate(webPath.registerDone);
const navToLabStep = (step: number) => navigate(webPath.labStep, { state: { step } });
const navToLabRecordSheet = () => navigate(webPath.labRecordSheet);
const navToAbout = () => navigate(webPath.about);
const navToTerm = (termKey: TermKey) => navigate(`${webPath.term}?term=${termKey}`);
const openBusinessProposal = () => {
window.location.href = 'mailto:humanzipyo2024@gmail.com?cc=anyany3151@naver.com';
};
const openServiceCenter = () => {
window.location.href = 'https://forms.gle/eus2xRNHGxbSBaAK9';
};
const openInstagram = () => {
window.location.href = 'https://www.instagram.com/humanzipyo/';
};
const openLinkedIn = () => {
if (isMobile) {
window.location.href = 'linkedin://profile/humanzipyo';
return;
}
window.location.href = 'https://www.linkedin.com/company/humanzipyo';
};
const openThreads = () => {
window.location.href = 'https://www.threads.net/@humanzipyo';
};
return {
navToBack,
navToHome,
navToStock,
navToFavorites,
navToShortView,
navToLab,
navToMyPage,
navToNotification,
navToUsage,
navToEditProfile,
navToEditProfileDone,
navToWithdrawDone,
navToAbout,
navToTerm,
navToWithdraw,
navToLabStep,
navToLabRecordSheet,
openBusinessProposal,
openServiceCenter,
openInstagram,
openLinkedIn,
openThreads,
navToRegisterDone,
};
};
export default useRouter;