Skip to content

Commit 1fd3594

Browse files
Merge pull request #14111 from guardian/disable-article-swipe
2 parents fcd6113 + 3e2f6e1 commit 1fd3594

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

dotcom-rendering/.storybook/mocks/bridgetApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ export const getDiscussionClient: BridgetApi<'getDiscussionClient'> = () => ({
8686
recommend: async () => discussionErrorResponse,
8787
});
8888

89-
export const getInteractionClient: BridgetApi<
90-
'getInteractionClient'
91-
> = () => ({});
89+
export const getInteractionClient: BridgetApi<'getInteractionClient'> = () => ({
90+
disableArticleSwipe: async () => void 0,
91+
});
9292

9393
export const getInteractivesClient: BridgetApi<
9494
'getInteractivesClient'
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { log } from '@guardian/libs';
2+
import { useEffect } from 'react';
3+
import { getInteractionClient } from '../lib/bridgetApi';
4+
5+
export const InteractivesDisableArticleSwipe = () => {
6+
useEffect(() => {
7+
void getInteractionClient()
8+
.disableArticleSwipe(true)
9+
.catch((error) => {
10+
log('dotcom', 'disableArticleSwipe failed:', error);
11+
});
12+
}, []);
13+
return null;
14+
};

dotcom-rendering/src/layouts/FullPageInteractiveLayout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import { AdSlot, MobileStickyContainer } from '../components/AdSlot.web';
88
import { Footer } from '../components/Footer';
99
import { HeaderAdSlot } from '../components/HeaderAdSlot';
10+
import { InteractivesDisableArticleSwipe } from '../components/InteractivesDisableArticleSwipe.importable';
1011
import { InteractivesNativePlatformWrapper } from '../components/InteractivesNativePlatformWrapper.importable';
1112
import { Island } from '../components/Island';
1213
import { LabsHeader } from '../components/LabsHeader';
@@ -215,6 +216,9 @@ export const FullPageInteractiveLayout = (props: WebProps | AppsProps) => {
215216
<Island priority="critical">
216217
<InteractivesNativePlatformWrapper />
217218
</Island>
219+
<Island priority="critical">
220+
<InteractivesDisableArticleSwipe />
221+
</Island>
218222
<Global styles={temporaryBodyCopyColourOverride} />
219223
</>
220224
)}

dotcom-rendering/src/layouts/InteractiveLayout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { DiscussionLayout } from '../components/DiscussionLayout';
2424
import { Footer } from '../components/Footer';
2525
import { GridItem } from '../components/GridItem';
2626
import { HeaderAdSlot } from '../components/HeaderAdSlot';
27+
import { InteractivesDisableArticleSwipe } from '../components/InteractivesDisableArticleSwipe.importable';
2728
import { InteractivesNativePlatformWrapper } from '../components/InteractivesNativePlatformWrapper.importable';
2829
import { Island } from '../components/Island';
2930
import { LabsHeader } from '../components/LabsHeader';
@@ -251,6 +252,9 @@ export const InteractiveLayout = (props: WebProps | AppsProps) => {
251252
<Island priority="critical">
252253
<InteractivesNativePlatformWrapper />
253254
</Island>
255+
<Island priority="critical">
256+
<InteractivesDisableArticleSwipe />
257+
</Island>
254258
<Global styles={temporaryBodyCopyColourOverride} />
255259
</>
256260
)}

0 commit comments

Comments
 (0)