This repository was archived by the owner on Apr 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCommonLinks.tsx
More file actions
145 lines (126 loc) · 3.89 KB
/
Copy pathCommonLinks.tsx
File metadata and controls
145 lines (126 loc) · 3.89 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
import { Link } from 'components/Link';
import { Button } from 'design-system-react';
import type { ComponentProps, ReactElement } from 'react';
import { useNavigate, useParams } from 'react-router-dom';
function GLIEF(arguments_: ComponentProps<typeof Link>): ReactElement {
return (
<Link href='https://www.gleif.org/' {...arguments_}>
GLEIF
</Link>
);
}
function GetAnLEI(): ReactElement {
return (
<Link href='https://www.gleif.org/en/about-lei/get-an-lei-find-lei-issuing-organizations'>
GLEIF
</Link>
);
}
function NIC(): ReactElement {
return <Link href='https://www.ffiec.gov/NPW'>NIC</Link>;
}
interface UpdateInstitutionProfileProperties {
isCallToAction?: boolean;
// eslint-disable-next-line react/require-default-props
className?: string;
}
function UpdateInstitutionProfile({
isCallToAction,
className = 'font-normal',
}: UpdateInstitutionProfileProperties): ReactElement {
const { lei } = useParams();
return (
<Link href={`/institution/${lei}/update`} className={className}>
{isCallToAction
? 'Update your financial institution profile'
: 'update your financial institution profile'}
</Link>
);
}
UpdateInstitutionProfile.defaultProps = { isCallToAction: false };
interface UpdateFilingDetailsProperties {
// eslint-disable-next-line react/require-default-props
label?: string;
// eslint-disable-next-line react/require-default-props, react/no-unused-prop-types
className?: string;
}
function UpdateFilingDetails({
label = 'update your filing details',
className = 'font-normal',
}: UpdateFilingDetailsProperties): ReactElement {
const { lei, year } = useParams();
const navigate = useNavigate();
const onClick = (): void => navigate(`/filing/${year}/${lei}/details`);
return (
<Button className={className} asLink onClick={onClick} label={label} />
);
}
function UploadANewFile({
label = 'upload a new file',
className = 'font-normal',
}: UpdateFilingDetailsProperties): ReactElement {
const { lei, year } = useParams();
const navigate = useNavigate();
const onClick = (): void => navigate(`/filing/${year}/${lei}/upload`);
return (
<Button className={className} asLink onClick={onClick} label={label} />
);
}
const RegulationBSectionUrls = {
'§ 1002.109(a)(1)(ii)': '/1002/109/#a-1-ii',
'§ 1002.109(b)(10)': '/1002/109/#b-10',
'§ 1002.109(b)(3)': '/1002/109/#b-3',
'§ 1002.109(b)(9)': '/1002/109/#b-9',
} as const;
export type RegulationBSectionUrlsKey = keyof typeof RegulationBSectionUrls;
export type RegulationBSectionUrlsValues =
(typeof RegulationBSectionUrls)[RegulationBSectionUrlsKey];
function RegulationB({
section,
}: {
section: RegulationBSectionUrlsKey;
}): JSX.Element {
const baseUrl = 'https://www.consumerfinance.gov/rules-policy/regulations';
const sectionUrl = RegulationBSectionUrls[
section
] satisfies RegulationBSectionUrlsValues;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!sectionUrl) return section as unknown as JSX.Element;
return <Link href={baseUrl + sectionUrl}>{section}</Link>;
}
function EmailSupportStaff({
subject,
isBeta = true,
label = 'email our support staff',
}: {
subject: string;
// eslint-disable-next-line react/require-default-props
isBeta?: boolean;
// eslint-disable-next-line react/require-default-props
label?: string;
}): ReactElement {
const formattedSubject = (isBeta ? '[BETA] ' : '') + subject;
return (
<Link href={`mailto:SBLHelp@cfpb.gov?subject=${formattedSubject}`}>
{label}
</Link>
);
}
function FederalReserveBoard(): ReactElement {
return (
<Link href='https://www.federalreserve.gov/apps/reportingforms/Report/Index/FR_Y-10'>
Federal Reserve Board
</Link>
);
}
export default {
EmailSupportStaff,
FederalReserveBoard,
RegulationB,
GLIEF,
GetAnLEI,
NIC,
UpdateInstitutionProfile,
UpdateFilingDetails,
UploadANewFile,
};