Skip to content

Commit

Permalink
Merge pull request #1978 from neo4j/new-browser-advertisement
Browse files Browse the repository at this point in the history
adding advertisement tile for the new browser ui
  • Loading branch information
nnecla authored Oct 15, 2024
2 parents b0d989c + d2bb86e commit c0841a7
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 6 deletions.
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

0 comments on commit c0841a7

Please sign in to comment.