Skip to content

Commit 67738ae

Browse files
authored
Feat: Fix console button not showing on OnboardingCompletionModal (#816)
1 parent ad2223c commit 67738ae

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

www/src/components/shell/OnboardingCompletionModal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import Fireworks from '@fireworks-js/react'
1515
type OnboardingCompletionModalProps = {
1616
open: boolean
1717
onClose: () => void
18-
skipConsoleInstall: boolean
18+
displayConsoleButton: boolean
1919
shell: any
2020
}
2121

2222
function OnboardingCompletionModal({
2323
open,
2424
onClose,
25-
skipConsoleInstall,
25+
displayConsoleButton,
2626
shell,
2727
}: OnboardingCompletionModalProps) {
2828
const [feedback, setFeedback] = useState<null | 'good' | 'bad'>(null)
@@ -54,7 +54,7 @@ function OnboardingCompletionModal({
5454
<P marginBottom="large">
5555
Congratulations, you've installed your first apps!
5656
</P>
57-
{skipConsoleInstall && (
57+
{!displayConsoleButton && (
5858
<Button
5959
primary
6060
width="100%"
@@ -64,7 +64,7 @@ function OnboardingCompletionModal({
6464
View my apps
6565
</Button>
6666
)}
67-
{!skipConsoleInstall && (
67+
{displayConsoleButton && (
6868
<Flex align="center">
6969
<Button
7070
primary

www/src/components/shell/TerminalSidebar.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,31 @@ function TerminalSidebar({ shell, showCheatsheet, ...props }: any) {
5555
const [isModalOpen, setIsModalOpen] = useState(false)
5656
const [stepIndex, setStepIndex] = useState(0)
5757
const {
58-
workingSteps, skipConsoleInstall, appCount, stackName,
58+
workingSteps,
59+
skipConsoleInstall,
60+
displayConsoleButton,
61+
appCount,
62+
stackName,
5963
} = useMemo(() => {
6064
const workingSteps = [...steps]
61-
const shouldInstallConsole = retrieveConsole()
6265
const applications = retrieveApplications()
6366
const stack = retrieveStack()
67+
const shouldInstallConsole = retrieveConsole()
68+
const hasApplicationConsole = applications.some(a => a.name === 'console')
6469

6570
const ret = {
6671
appCount: applications?.length,
6772
stackName: stack?.name,
6873
workingSteps,
74+
skipConsoleInstall: !shouldInstallConsole || hasApplicationConsole,
75+
displayConsoleButton: shouldInstallConsole || hasApplicationConsole,
6976
}
7077

71-
if (applications.length === 1 && applications[0].name !== 'console') return { ...ret, skipConsoleInstall: false }
72-
if (shouldInstallConsole) return { ...ret, skipConsoleInstall: false }
73-
74-
ret.workingSteps.shift()
75-
76-
return {
77-
...ret, skipConsoleInstall: true,
78+
if (ret.skipConsoleInstall) {
79+
ret.workingSteps.shift()
7880
}
81+
82+
return ret
7983
}, [])
8084

8185
const { title, Component } = workingSteps[stepIndex]
@@ -201,7 +205,7 @@ function TerminalSidebar({ shell, showCheatsheet, ...props }: any) {
201205
<OnboardingCompletionModal
202206
open={isModalOpen}
203207
onClose={() => setIsModalOpen(false)}
204-
skipConsoleInstall={skipConsoleInstall}
208+
displayConsoleButton={displayConsoleButton}
205209
shell={shell}
206210
/>
207211
</>

0 commit comments

Comments
 (0)