Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding advertisement tile for the new browser ui #1978

Merged
merged 5 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/browser/images/clusters.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion src/browser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ import ReactDOM from 'react-dom'

import AppInit, { setupSentry } from './AppInit'
import './init'
import { navigateToPreview } from './modules/Stream/StartPreviewFrame'

setupSentry()
ReactDOM.render(<AppInit />, document.getElementById('mount'))
;(async () => {
const doesPreferQuery = localStorage.getItem('prefersOldBrowser') === 'false'
try {
const response = await fetch('./preview/manifest.json')
if (response.status === 200) {
if (doesPreferQuery) {
navigateToPreview()
} else {
localStorage.setItem('previewAvailable', 'true')
}
} else {
localStorage.setItem('previewAvailable', 'false')
}
} catch (e) {
localStorage.setItem('previewAvailable', 'false')
}

ReactDOM.render(<AppInit />, document.getElementById('mount'))
})()
12 changes: 12 additions & 0 deletions src/browser/modules/Carousel/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@
border: 0;
display: inline-block;
}
.btn-advertise {
padding: 1em;
background-color: #fff;
color: #008cc1;
border-radius: 4px;
border: 0;
display: inline-block;
margin-bottom: 5px;
margin-right: 5px;
font-size: 12px;
line-height: 18px;
}
.teasers {
display: flex;
justify-content: center;
Expand Down
13 changes: 13 additions & 0 deletions src/browser/modules/Carousel/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,19 @@ export const StyledSlide = styled.div`
background-color: ${props => props.theme.teaserCardBackground} !important;
}

&.slide .teaser-advertise {
color: white !important;
background-color: #0a6190 !important;

& .img-advertise {
position: absolute;
left: 0;
bottom: -10px;
opacity: 0.15;
pointer-events: none;
}
}

&.slide input {
color: ${props => props.theme.inputText};
}
Expand Down
7 changes: 6 additions & 1 deletion src/browser/modules/Stream/PlayFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { isConnectedAuraHost } from 'shared/modules/connections/connectionsDuck'
import { getEdition, isEnterprise } from 'shared/modules/dbMeta/dbMetaDuck'
import { DARK_THEME } from 'shared/modules/settings/settingsDuck'
import { LAST_GUIDE_SLIDE } from 'shared/modules/udc/udcDuck'
import { PreviewFrame } from './StartPreviewFrame'

const AuraPromotion = () => {
const theme = useContext(ThemeContext)
Expand Down Expand Up @@ -287,15 +288,19 @@ function generateContent(

// Check if content exists locally
if (isPlayChapter(guideName)) {
const isPreviewAvailable =
localStorage.getItem('previewAvailable') === 'true'
const { content, title, subtitle, slides = null } = chapters[guideName]

const isPlayStart = stackFrame.cmd.trim() === ':play start'
const updatedContent =
isPlayStart && showPromotion ? (
<>
{content}
{isPreviewAvailable ? <PreviewFrame /> : content}
<AuraPromotion />
</>
) : isPreviewAvailable ? (
<PreviewFrame />
) : (
content
)
Expand Down
Loading
Loading