Fakultas Ilmu Komputer UI

navigation.ts 4.71 KB
Newer Older
1
import * as ROUTES from 'constants/routes';
2
import {
3
4
5
6
7
8
9
10
11
  // Extended Questionnaire
  ExtendedQuestionnaire,
  ConsentForm,
  Questionnaire1,
  Questionnaire2,
  Questionnaire3,
  Questionnaire4,
  Questionnaire5,

12
  // Public
13
14
15
16
  AllAccessQuestionnaire,
  ChoosePlan,
  DietelaQuizResult,
  InitialPage,
17
  ManualRegistrationPage,
18
  LoginPage,
19
  NutritionistAdminLogin,
20
  ProgramDetail,
21
  NutritionistDetail,
22
23
24

  // Private
  Checkout,
Wulan Mantiri's avatar
Wulan Mantiri committed
25
  PaymentResult,
26
  ReadOnlyDietProfile,
27
  ClientListNutritionist,
28
  ComingSoonPage,
29
  ClientProfile,
30
  ClientDietRecommendationForAdmin,
31
  PaymentWebView,
32
33
34
  ProfileDietRecommendation,
  ClientListAdmin,
  LoginChoosePlan,
35
} from 'scenes';
36
import { FC } from 'react';
37

38
export interface NavRoute<T = any> {
39
  name: string;
40
  component: FC<T>;
41
42
43
  header?: string;
}

Wulan Mantiri's avatar
Wulan Mantiri committed
44
const navigation: NavRoute[] = [
45
46
47
48
49
  {
    name: ROUTES.allAccessQuestionnaire,
    component: AllAccessQuestionnaire,
    header: 'Dietela Quiz',
  },
50
51
52
53
54
  {
    name: ROUTES.dietelaQuizResult,
    component: DietelaQuizResult,
    header: 'Dietela Quiz Result',
  },
55
56
57
58
59
60
61
  {
    name: ROUTES.choosePlan,
    component: ChoosePlan,
    header: 'Choose Plan',
  },
  {
    name: ROUTES.programDetail,
62
    component: ProgramDetail,
63
64
65
66
    header: 'Program Dietela',
  },
  {
    name: ROUTES.nutritionistDetail,
67
    component: NutritionistDetail,
68
69
    header: 'Nutrisionis',
  },
Wulan Mantiri's avatar
Wulan Mantiri committed
70
71
72
73
74
75
76
77
];

export const publicNavigation: NavRoute[] = [
  {
    name: ROUTES.initial,
    component: InitialPage,
  },
  ...navigation,
78
79
80
81
82
  {
    name: ROUTES.registration,
    component: ManualRegistrationPage,
    header: 'Registrasi',
  },
83
84
85
86
87
  {
    name: ROUTES.login,
    component: LoginPage,
    header: 'Login',
  },
88
89
90
91
92
  {
    name: ROUTES.loginChoosePlan,
    component: LoginChoosePlan,
    header: 'Login',
  },
93
94
95
96
97
  {
    name: ROUTES.nutritionistAdminLogin,
    component: NutritionistAdminLogin,
    header: 'Login Tim Dietela',
  },
Wulan Mantiri's avatar
Wulan Mantiri committed
98
99
];

100
export const clientNavigation: NavRoute[] = [
Wulan Mantiri's avatar
Wulan Mantiri committed
101
102
103
104
105
106
  {
    name: ROUTES.checkout,
    component: Checkout,
    header: 'Checkout',
  },
  {
107
108
    name: ROUTES.payment,
    component: PaymentWebView,
Wulan Mantiri's avatar
Wulan Mantiri committed
109
110
    header: 'Pembayaran',
  },
111
  {
112
113
    name: ROUTES.paymentResult,
    component: PaymentResult,
114
  },
115
  ...navigation,
Wulan Mantiri's avatar
Wulan Mantiri committed
116
117
118
  {
    name: ROUTES.extendedQuestionnaire,
    component: ExtendedQuestionnaire,
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
    header: 'Profil Saya',
  },
  ...[
    {
      component: ConsentForm,
      header: 'Persetujuan',
    },
    {
      component: Questionnaire1,
      header: 'Identitas Diri',
    },
    {
      component: Questionnaire2,
      header: 'Pola Makan',
    },
    {
      component: Questionnaire3,
      header: 'Konsumsi Makan',
    },
    {
      component: Questionnaire4,
      header: 'Gaya Hidup',
    },
    {
      component: Questionnaire5,
      header: 'Kondisi Pribadi',
    },
  ].map((nav, id) => ({
    ...nav,
    name: ROUTES.extendedQuestionnaireById(id),
  })),
150
151
152
153
154
  {
    name: ROUTES.clientProfile,
    component: ClientProfile,
    header: 'Profil Saya',
  },
155
156
];

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
export const nutritionistNavigation: NavRoute[] = [
  {
    name: ROUTES.clientListForNutritionist,
    component: ClientListNutritionist,
    header: 'List Klien',
  },
  {
    name: ROUTES.clientChatNutritionist,
    component: ComingSoonPage,
    header: 'Chat Klien',
  },
  {
    name: ROUTES.clientDietReportNutritionist,
    component: ComingSoonPage,
    header: 'Laporan Klien',
  },
  {
    name: ROUTES.clientProfileNutritionist,
    component: ReadOnlyDietProfile,
    header: 'Profil Klien',
  },
178
179
180
181
182
  {
    name: ROUTES.profileDietRecommendation,
    component: ProfileDietRecommendation,
    header: 'Rekomendasi Profil Diet',
  },
183
184
];

185
186
export const adminNavigation: NavRoute[] = [
  {
187
188
189
190
191
192
    name: ROUTES.clientListForAdmin,
    component: ClientListAdmin,
    header: 'List Klien',
  },
  {
    name: ROUTES.clientProfileAdmin,
193
    component: ReadOnlyDietProfile,
194
195
    header: 'Profil Klien',
  },
196
197
198
199
200
201
202
203
204
205
  {
    name: ROUTES.clientDietReportAdmin,
    component: ComingSoonPage,
    header: 'Profil Klien',
  },
  {
    name: ROUTES.clientChatAdmin,
    component: ComingSoonPage,
    header: 'Profil Klien',
  },
206
207
208
209
210
  {
    name: ROUTES.clientDietRecommendation,
    component: ClientDietRecommendationForAdmin,
    header: 'Rekomendasi Profil Diet',
  },
211
212
];

213
export const testNavigation: NavRoute[] = [
214
215
  ...clientNavigation,
  ...nutritionistNavigation,
216
  ...adminNavigation,
217
218
219
220
221
222
223
224
225
226
227
228
229
230
  {
    name: ROUTES.initial,
    component: InitialPage,
  },
  {
    name: ROUTES.registration,
    component: ManualRegistrationPage,
    header: 'Registrasi',
  },
  {
    name: ROUTES.login,
    component: LoginPage,
    header: 'Login',
  },
231
232
233
234
235
  {
    name: ROUTES.loginChoosePlan,
    component: LoginChoosePlan,
    header: 'Login',
  },
236
237
238
239
240
  {
    name: ROUTES.nutritionistAdminLogin,
    component: NutritionistAdminLogin,
    header: 'Login Tim Dietela',
  },
241
];