-
Notifications
You must be signed in to change notification settings - Fork 482
/
DeleteAccountHelpers.jsx
102 lines (96 loc) · 2.62 KB
/
DeleteAccountHelpers.jsx
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React from 'react';
import _ from 'lodash';
import i18n from '@cdo/locale';
import {ADD_A_PERSONAL_LOGIN_HELP_URL, RELEASE_OR_DELETE_RECORDS_EXPLANATION} from '@cdo/apps/lib/util/urlHelpers';
export const TeacherWarning = () => {
return (
<div>
<p>
{i18n.deleteAccount_teacherWarning1()}
<strong>{i18n.deleteAccount_teacherWarning2()}</strong>
{i18n.deleteAccount_teacherWarning3()}
</p>
<p>
{i18n.deleteAccount_teacherWarning4()}
<a
href={ADD_A_PERSONAL_LOGIN_HELP_URL}
target="_blank"
>
{i18n.deleteAccount_teacherWarning5()}
</a>
{i18n.deleteAccount_teacherWarning6()}
</p>
</div>
);
};
export const StudentWarning = () => {
return (
<div>{i18n.deleteAccount_studentWarning()}</div>
);
};
export const getCheckboxes = (dependedUponForLogin, hasStudents) => {
let ids = [];
if (dependedUponForLogin) {
ids = TEACHER_DEPENDED_UPON_FOR_LOGIN_CHECKBOXES;
} else if (hasStudents) {
ids = TEACHER_WITH_STUDENTS_CHECKBOXES;
}
return _.pick(CHECKBOX_MAP, ids);
};
// Teacher that has students who depend on them to log in is required to see/check all 5 checkboxes to delete their account.
const TEACHER_DEPENDED_UPON_FOR_LOGIN_CHECKBOXES = [1,2,3,4,5];
// Teacher with students is only required to see/check the first checkbox to delete their account.
const TEACHER_WITH_STUDENTS_CHECKBOXES = [1];
const CHECKBOX_MAP = {
1: {
checked: false,
label: (
<span>
<strong>{i18n.deleteAccountDialog_checkbox1_1()}</strong>
{i18n.deleteAccountDialog_checkbox1_2()}
<a href={RELEASE_OR_DELETE_RECORDS_EXPLANATION} target="_blank">
{i18n.learnMore()}
</a>
</span>
)
},
2: {
checked: false,
label: (
<span>
{i18n.deleteAccountDialog_checkbox2_1()}
<a href={ADD_A_PERSONAL_LOGIN_HELP_URL} target="_blank">
{i18n.deleteAccountDialog_checkbox2_2()}
</a>
{i18n.deleteAccountDialog_checkbox2_3()}
</span>
)
},
3: {
checked: false,
label: (
<span>
{i18n.deleteAccountDialog_checkboxPreface()}
<strong>{i18n.deleteAccountDialog_checkbox3()}</strong>
</span>
)
},
4: {
checked: false,
label: (
<span>
{i18n.deleteAccountDialog_checkboxPreface()}
<strong>{i18n.deleteAccountDialog_checkbox4()}</strong>
</span>
)
},
5: {
checked: false,
label: (
<span>
{i18n.deleteAccountDialog_checkboxPreface()}
<strong>{i18n.deleteAccountDialog_checkbox5()}</strong>
</span>
)
}
};