Skip to content

Commit 90f6a4d

Browse files
committed
adding advertisement tile for the new browser ui
1 parent b0d989c commit 90f6a4d

File tree

7 files changed

+189
-6
lines changed

7 files changed

+189
-6
lines changed

src/browser/images/clusters.svg

Lines changed: 35 additions & 0 deletions
Loading

src/browser/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,19 @@ import AppInit, { setupSentry } from './AppInit'
2424
import './init'
2525

2626
setupSentry()
27-
ReactDOM.render(<AppInit />, document.getElementById('mount'))
27+
;(async () => {
28+
const doesPreferQuery = localStorage.getItem('prefersOldBrowser') === 'false'
29+
30+
const response = await fetch('/preview/manifest.json')
31+
if (response.status === 200) {
32+
if (doesPreferQuery) {
33+
window.location.pathname = '/preview/'
34+
} else {
35+
localStorage.setItem('previewAvailable', 'true')
36+
}
37+
} else {
38+
localStorage.setItem('previewAvailable', 'false')
39+
}
40+
41+
ReactDOM.render(<AppInit />, document.getElementById('mount'))
42+
})()

src/browser/modules/Carousel/style.less

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,18 @@
345345
border: 0;
346346
display: inline-block;
347347
}
348+
.btn-advertise {
349+
padding: 1em;
350+
background-color: #fff;
351+
color: #008cc1;
352+
border-radius: 4px;
353+
border: 0;
354+
display: inline-block;
355+
margin-bottom: 5px;
356+
margin-right: 5px;
357+
font-size: 12px;
358+
line-height: 18px;
359+
}
348360
.teasers {
349361
display: flex;
350362
justify-content: center;

src/browser/modules/Carousel/styled.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,18 @@ export const StyledSlide = styled.div`
301301
background-color: ${props => props.theme.teaserCardBackground} !important;
302302
}
303303
304+
&.slide .teaser-advertise {
305+
color: white !important;
306+
background-color: #0a6190 !important;
307+
308+
& .img-advertise {
309+
position: absolute;
310+
left: 0;
311+
bottom: -10px;
312+
opacity: 0.15;
313+
}
314+
}
315+
304316
&.slide input {
305317
color: ${props => props.theme.inputText};
306318
}

src/browser/modules/Stream/PlayFrame.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ import { isConnectedAuraHost } from 'shared/modules/connections/connectionsDuck'
4747
import { getEdition, isEnterprise } from 'shared/modules/dbMeta/dbMetaDuck'
4848
import { DARK_THEME } from 'shared/modules/settings/settingsDuck'
4949
import { LAST_GUIDE_SLIDE } from 'shared/modules/udc/udcDuck'
50+
import { PreviewFrame } from './StartPreviewFrame'
51+
import {
52+
experimentalFeaturePreviewName,
53+
showFeature
54+
} from 'shared/modules/experimentalFeatures/experimentalFeaturesDuck'
5055

5156
const AuraPromotion = () => {
5257
const theme = useContext(ThemeContext)
@@ -88,13 +93,15 @@ type PlayFrameProps = {
8893
showPromotion: boolean
8994
isFullscreen: boolean
9095
isCollapsed: boolean
96+
isAdvertiseFlagOn: boolean
9197
}
9298
export function PlayFrame({
9399
stack,
94100
bus,
95101
showPromotion,
96102
isFullscreen,
97-
isCollapsed
103+
isCollapsed,
104+
isAdvertiseFlagOn
98105
}: PlayFrameProps): JSX.Element {
99106
const [stackIndex, setStackIndex] = useState(0)
100107
const [atSlideStart, setAtSlideStart] = useState<boolean | null>(null)
@@ -123,7 +130,8 @@ export function PlayFrame({
123130
bus,
124131
onSlide,
125132
initialPlay,
126-
showPromotion
133+
showPromotion,
134+
isAdvertiseFlagOn
127135
)
128136
if (stillMounted) {
129137
setInitialPlay(false)
@@ -206,7 +214,8 @@ function generateContent(
206214
bus: Bus,
207215
onSlide: any,
208216
shouldUseSlidePointer: boolean,
209-
showPromotion = false
217+
showPromotion = false,
218+
isAdvertiseFlagOn: boolean
210219
): Content | Promise<Content> {
211220
// Not found
212221
if (stackFrame.response && stackFrame.response.status === 404) {
@@ -287,15 +296,20 @@ function generateContent(
287296

288297
// Check if content exists locally
289298
if (isPlayChapter(guideName)) {
299+
const isPreviewAvailable =
300+
localStorage.getItem('previewAvailable') === 'true'
301+
const showAdvertiseTile = isAdvertiseFlagOn && isPreviewAvailable
290302
const { content, title, subtitle, slides = null } = chapters[guideName]
291303

292304
const isPlayStart = stackFrame.cmd.trim() === ':play start'
293305
const updatedContent =
294306
isPlayStart && showPromotion ? (
295307
<>
296-
{content}
308+
{showAdvertiseTile ? <PreviewFrame /> : content}
297309
<AuraPromotion />
298310
</>
311+
) : showAdvertiseTile ? (
312+
<PreviewFrame />
299313
) : (
300314
content
301315
)
@@ -378,7 +392,8 @@ const mapStateToProps = (state: GlobalState) => ({
378392
(getEdition(state) !== null &&
379393
!isEnterprise(state) &&
380394
!isConnectedAuraHost(state)) ||
381-
inDesktop(state)
395+
inDesktop(state),
396+
isAdvertiseFlagOn: showFeature(state, experimentalFeaturePreviewName)
382397
})
383398

384399
export default connect(mapStateToProps)(withBus(PlayFrame))

0 commit comments

Comments
 (0)