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

Remove aura promo #1489

Merged
merged 1 commit into from
Aug 9, 2021
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: 0 additions & 35 deletions src/browser/images/aura-logo-inverted.svg

This file was deleted.

35 changes: 0 additions & 35 deletions src/browser/images/aura-logo.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`ClickToCode does not render if no children 1`] = `<div />`;
exports[`ClickToCode renders all children 1`] = `
<div>
<code
class="sc-rBLzX dssDtR"
class="sc-jzgbtB hzRtWx"
>
<div>
<span>
Expand All @@ -20,7 +20,7 @@ exports[`ClickToCode renders all children 1`] = `
exports[`ClickToCode renders children as code if no code is provided 1`] = `
<div>
<code
class="sc-rBLzX dssDtR"
class="sc-jzgbtB hzRtWx"
>
hellohi!
</code>
Expand All @@ -30,7 +30,7 @@ exports[`ClickToCode renders children as code if no code is provided 1`] = `
exports[`ClickToCode renders code as the code when code is available 1`] = `
<div>
<code
class="sc-rBLzX dssDtR"
class="sc-jzgbtB hzRtWx"
>
hello
</code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`CodeViews CodeStatusbar displays no statusBarMessage 1`] = `
class="sc-jlyJG dMPRjC"
>
<div
class="sc-gGBfsJ hdpDrB"
class="sc-uJMKN VhEfq"
/>
</div>
</div>
Expand All @@ -18,7 +18,7 @@ exports[`CodeViews CodeStatusbar displays statusBarMessage 1`] = `
class="sc-jlyJG dMPRjC"
>
<div
class="sc-gGBfsJ hdpDrB"
class="sc-uJMKN VhEfq"
>
Started streaming 1 records after 5 ms and completed after 10 ms.
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`ErrorsViews ErrorsStatusbar displays error 1`] = `
title="Test.Error: Test error description"
>
<i
class="sc-laTMn jiKZdL fa fa-exclamation-triangle"
class="sc-bMvGRv iZbHS fa fa-exclamation-triangle"
/>

Test.Error: Test error description
Expand Down Expand Up @@ -61,7 +61,7 @@ exports[`ErrorsViews ErrorsView displays procedure link if unknown procedure 1`]
class="sc-hXRMBi iQncAP"
>
<i
class="sc-bMvGRv bDmlEQ fa fa-play-circle-o"
class="sc-gJWqzi cBFLEa fa fa-play-circle-o"
/>
 List available procedures
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`Visualization renders 1`] = `<div />`;
exports[`Visualization renders with result and escapes any HTML 1`] = `
<div>
<div
class="sc-bwCtUz hJgGYC"
class="sc-RefOD VXTKH"
>
<div
class="sc-iAyFgw ikvPvE one-legend-row"
Expand Down Expand Up @@ -137,15 +137,15 @@ exports[`Visualization renders with result and escapes any HTML 1`] = `
class="sc-cvbbAY cqXpvD zoom-in"
>
<i
class="sc-chbbiW fdVihP sl-zoom-in"
class="sc-iBEsjs jZFdEi sl-zoom-in"
style="font-size: 1em;"
/>
</button>
<button
class="sc-cvbbAY cqXpvD zoom-out"
>
<i
class="sc-kxynE dtqwBR sl-zoom-out"
class="sc-hzNEM kwYCdQ sl-zoom-out"
style="font-size: 1em;"
/>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`RelatableViews RelatableView displays bodyMessage if no rows 1`] = `
class="sc-Rmtcm keiynT"
>
<div
class="sc-gGBfsJ hdpDrB"
class="sc-uJMKN VhEfq"
>
(no changes, no records)
</div>
Expand All @@ -17,7 +17,7 @@ exports[`RelatableViews RelatableView displays bodyMessage if no rows 1`] = `
exports[`RelatableViews RelatableView does not display bodyMessage if rows, and escapes HTML 1`] = `
<div>
<div
class="sc-jnlKLf ktwZlk"
class="sc-bbmXgH lkCivW"
>
<div
class="relatable css-1dne9dv"
Expand Down Expand Up @@ -73,7 +73,7 @@ exports[`RelatableViews RelatableView does not display bodyMessage if rows, and
role="cell"
>
<span
class="sc-tilXH fvcfTT"
class="sc-jnlKLf bmCyjD"
>
"String with HTML &lt;strong&gt;in&lt;/strong&gt; it"
</span>
Expand All @@ -92,7 +92,7 @@ exports[`RelatableViews TableStatusbar displays no statusBarMessage 1`] = `
class="sc-Rmtcm keiynT"
>
<div
class="sc-gGBfsJ hdpDrB"
class="sc-uJMKN VhEfq"
/>
</div>
</div>
Expand All @@ -104,7 +104,7 @@ exports[`RelatableViews TableStatusbar displays statusBarMessage 1`] = `
class="sc-Rmtcm keiynT"
>
<div
class="sc-gGBfsJ hdpDrB"
class="sc-uJMKN VhEfq"
>
Started streaming 1 records after 5 ms and completed after 10 ms.
</div>
Expand Down
63 changes: 7 additions & 56 deletions src/browser/modules/Stream/PlayFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import React, { useContext, useEffect, useState } from 'react'
import React, { useEffect, useState } from 'react'
import { withBus } from 'react-suber'
import { fetchGuideFromAllowlistAction } from 'shared/modules/commands/commandsDuck'

Expand All @@ -38,36 +38,6 @@ import {
} from 'browser-components/icons/Icons'
import { splitMdxSlides } from '../Docs/MDX/splitMdx'
import { LAST_GUIDE_SLIDE } from 'shared/modules/udc/udcDuck'
import { connect } from 'react-redux'
import { GlobalState } from 'shared/globalState'
import { inCloudEnv } from 'shared/modules/app/appDuck'
import { getEdition, isEnterprise } from 'shared/modules/dbMeta/dbMetaDuck'
import { PromotionContainer, AuraPromoLink } from './styled'
import { ThemeContext } from 'styled-components'
import { DARK_THEME } from 'shared/modules/settings/settingsDuck'

const AuraPromotion = () => {
const theme = useContext(ThemeContext)
const isDarkTheme = theme.name === DARK_THEME

return (
<PromotionContainer>
<AuraPromoLink
href="https://neo4j.com/cloud/aura/pricing/?utm_medium=browser&utm_source=ce&utm_campaign=wl_v1"
rel="noreferrer"
target="_blank"
>
Sign up
</AuraPromoLink>
for a free Neo4j cloud instance with
<img
src={`./assets/images/aura-logo${isDarkTheme ? '-inverted' : ''}.svg`}
alt="Neo4j"
style={{ marginLeft: '5px', width: '100%', maxWidth: '140px' }}
/>
</PromotionContainer>
)
}

const {
play: { chapters }
Expand All @@ -80,7 +50,7 @@ const checkHtmlForSlides = (html: any) => {
return !!slides.length
}

export function PlayFrame({ stack, bus, showPromotion }: any): JSX.Element {
export function PlayFrame({ stack, bus }: any): JSX.Element {
const [stackIndex, setStackIndex] = useState(0)
const [atSlideStart, setAtSlideStart] = useState<boolean | null>(null)
const [atSlideEnd, setAtSlideEnd] = useState<boolean | null>(null)
Expand All @@ -105,8 +75,7 @@ export function PlayFrame({ stack, bus, showPromotion }: any): JSX.Element {
currentFrame,
bus,
onSlide,
shouldUseSlidePointer,
showPromotion
shouldUseSlidePointer
)
if (stillMounted) {
setInitialPlay(false)
Expand All @@ -119,7 +88,7 @@ export function PlayFrame({ stack, bus, showPromotion }: any): JSX.Element {
stillMounted = false
}
// The full dependency array causes a re-run which switches to slide 1
}, [bus, currentFrame, showPromotion])
}, [bus, currentFrame])

const { guide, aside, hasCarousel, isRemote } = guideObj

Expand Down Expand Up @@ -189,8 +158,7 @@ function generateContent(
stackFrame: any,
bus: any,
onSlide: any,
shouldUseSlidePointer: any,
showPromotion = false
shouldUseSlidePointer: any
): any {
// Not found
if (stackFrame.response && stackFrame.response.status === 404) {
Expand Down Expand Up @@ -274,25 +242,13 @@ function generateContent(
// Check if content exists locally
if (isPlayChapter(guideName)) {
const { content, title, subtitle, slides = null } = chapters[guideName]

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

return {
guide: (
<Docs
lastUpdate={stackFrame.ts}
originFrameId={stackFrame.id}
withDirectives
content={slides ? null : updatedContent}
content={slides ? null : content}
slides={slides ? slides : null}
initialSlide={initialSlide}
onSlide={onSlide}
Expand Down Expand Up @@ -359,9 +315,4 @@ const unfound = (
}
}

const mapStateToProps = (state: GlobalState) => ({
showPromotion:
getEdition(state) !== null && !isEnterprise(state) && !inCloudEnv(state)
})

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