Skip to content

Commit 0aac1cf

Browse files
committed
Rewrite links for footer and selected page elements
1 parent 1f67c8e commit 0aac1cf

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/app/components/shell/router-helpers/use-link-handler.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {useCallback} from 'react';
22
import {useNavigate, NavigateOptions} from 'react-router-dom';
3-
import usePortalContext from '~/contexts/portal';
43
import linkHelper from '~/helpers/link';
54
import $ from '~/helpers/$';
65
import retry from '~/helpers/retry';
@@ -11,12 +10,9 @@ export type TrackingInfo = {
1110
book_format?: string;
1211
contact_id?: string;
1312
resource_name?: string;
14-
};
13+
}
1514

16-
export type TrackedMouseEvent = React.MouseEvent<
17-
HTMLAnchorElement,
18-
MouseEvent
19-
> & {
15+
export type TrackedMouseEvent = React.MouseEvent<HTMLAnchorElement, MouseEvent> & {
2016
trackingInfo: TrackingInfo;
2117
};
2218

@@ -36,18 +32,12 @@ function handleExternalLink(href: Location['href'], el: HTMLElement) {
3632
type State = NavigateOptions & {x: number; y: number};
3733

3834
export default function useLinkHandler() {
39-
const {portal} = usePortalContext();
4035
const navigate = useNavigate();
4136
const navigateTo = useCallback(
4237
(path: Location['href'], state: State = {x: 0, y: 0}) => {
43-
let adjustedPath = linkHelper.stripOpenStaxDomain(path);
44-
45-
if (portal && !adjustedPath.startsWith(`/${portal}`)) {
46-
adjustedPath = `/${portal}${adjustedPath}`;
47-
}
48-
navigate(adjustedPath, state);
38+
navigate(linkHelper.stripOpenStaxDomain(path), state);
4939
},
50-
[navigate, portal]
40+
[navigate]
5141
);
5242
const linkHandler = useCallback(
5343
// eslint-disable-next-line complexity

0 commit comments

Comments
 (0)