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

Track welcome modal changes #7183

Merged
merged 10 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add WhoIsThisTrackForView, pass down seniority level
  • Loading branch information
dem4ron committed Dec 4, 2024
commit 5a4d50dd3ec4d3817d866f52ac0d0701560dee2a
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assign, createMachine } from 'xstate'
import { createMachine } from 'xstate'

export type StateEvent =
| 'HAS_LEARNING_MODE'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from './TrackWelcomeModal.types'
import { ErrorBoundary, ErrorMessage } from '@/components/ErrorBoundary'
import { ErrorFallback } from '@/components/common/ErrorFallback'
import { SeniorityLevel } from '../welcome-modal/WelcomeModal'

const DEFAULT_ERROR = new Error('Unable to dismiss modal')

Expand All @@ -20,16 +21,19 @@ export const TrackContext = createContext<{
currentState: CurrentState
send: any
links: TrackWelcomeModalLinks
userSeniority: SeniorityLevel
}>({
track: {} as Track,
currentState: {} as CurrentState,
send: () => {},
links: {} as TrackWelcomeModalLinks,
userSeniority: '' as SeniorityLevel,
})

export const TrackWelcomeModal = ({
links,
track,
userSeniority,
}: Omit<ModalProps, 'className' | 'open' | 'onClose'> &
TrackWelcomeModalProps): JSX.Element => {
const {
Expand All @@ -46,7 +50,9 @@ export const TrackWelcomeModal = ({
onClose={() => null}
className="m-track-welcome-modal"
>
<TrackContext.Provider value={{ track, currentState, send, links }}>
<TrackContext.Provider
value={{ track, currentState, send, links, userSeniority }}
>
<div className="flex">
<LHS />
<RHS />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { State, ResolveTypegenMeta, BaseActionObject, ServiceMap } from 'xstate'
import { StateEvent } from './LHS/TrackWelcomeModal.machine'
import { Typegen0 } from './LHS/TrackWelcomeModal.machine.typegen'
import { Track } from '@/components/types'
import { SeniorityLevel } from '../welcome-modal/WelcomeModal'

export type TrackWelcomeModalProps = {
track: Track
links: TrackWelcomeModalLinks
userSeniority: SeniorityLevel
}

export type TrackWelcomeModalLinks = Record<
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import React, { useContext } from 'react'
import VimeoEmbed from '@/components/common/VimeoEmbed'
import { TrackContext } from './TrackWelcomeModal'
import { Track } from '@/components/types'

export function TrackWelcomeModalRHS(): JSX.Element {
const { track } = useContext(TrackContext)
const { track, currentState } = useContext(TrackContext)

return <VideoStepView track={track} />
}

function VideoStepView({ track }: { track: Track }): JSX.Element {
return (
<div className="rhs">
<div className="rounded-8 p-20 bg-backgroundColorD border-1 border-borderColor7">
Expand All @@ -21,3 +27,21 @@ export function TrackWelcomeModalRHS(): JSX.Element {
</div>
)
}

function WhoIsThisTrackForView({ track }: { track: Track }): JSX.Element {
return (
<div className="rhs">
<h2 className="text-h2 mb-16">Who is this track for?</h2>
<p className="mb-16">
{track.title} is for developers who are new to {track.title} and want to
learn the basics. If you're already familiar with {track.title}, you
might want to skip this track.
</p>
<p className="mb-16">
If you're not sure, it's a good idea to start with the Learning Mode.
This mode will guide you through the basics and help you get up to
speed.
</p>
</div>
)
}