File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/app/pages/details/common/get-this-title-files Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import RecommendedCallout from './recommended-callout/recommended-callout';
18
18
import { useOpenGiveDialog } from './give-before-pdf/use-give-dialog' ;
19
19
import useCalloutCounter from './recommended-callout/use-callout-counter' ;
20
20
import trackLink from '../track-link' ;
21
+ import usePortalContext from '~/contexts/portal' ;
21
22
import type { Model } from '../get-this-title' ;
22
23
import type { TrackedMouseEvent } from '~/components/shell/router-helpers/use-link-handler' ;
23
24
@@ -104,6 +105,15 @@ export function TocOption({model}: {model: Model}) {
104
105
) ;
105
106
}
106
107
108
+ function useRexPortalLinkOrNot ( link : string ) {
109
+ const { portalPrefix} = usePortalContext ( ) ;
110
+
111
+ if ( ! portalPrefix ) {
112
+ return link ;
113
+ }
114
+ return link . replace ( 'books/' , `portal${ portalPrefix } /books/` ) ;
115
+ }
116
+
107
117
108
118
export function WebviewOption ( { model} : { model : Model } ) {
109
119
const [ showCallout , hideForever ] = useCalloutCounter ( model . slug ) ;
@@ -113,7 +123,7 @@ export function WebviewOption({model}: {model: Model}) {
113
123
link : intl . formatMessage ( { id : 'getit.webview.link' } )
114
124
} ;
115
125
const isRex = Boolean ( model . webviewRexLink ) ;
116
- const webviewLink = model . webviewRexLink || model . webviewLink ;
126
+ const webviewLink = useRexPortalLinkOrNot ( model . webviewRexLink ) || model . webviewLink ;
117
127
const iconAndTextArgs = {
118
128
icon : faLaptop ,
119
129
text : $ . isPolish ( model . title ) ? 'Zobacz w przeglądarce' : texts . link
You can’t perform that action at this time.
0 commit comments