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

fix: support minimal top bar for onboarding screens #18077

Merged
merged 11 commits into from
Oct 19, 2023

Conversation

raquelmsmith
Copy link
Member

@raquelmsmith raquelmsmith commented Oct 18, 2023

Problem

The Products and Onboarding scenes used the std navigation, but this was distracting for people because most of the buttons don't work on these scenes.

Changes

Before:

image

After:

image

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

How did you test this code?

I didn't see a good way to do a story for just the minimal nav since it's computed based on the scene that is showing. So i instead added a story for the Products scene, which does use this minimal nav bar, which would change if the top bar were inadvertently changed.

I also had to update useFeatureFlags so it could specify the flag value in the case of multivariate flags, so that works now too!

@raquelmsmith raquelmsmith marked this pull request as ready for review October 19, 2023 03:21
@raquelmsmith
Copy link
Member Author

@mariusandra you are the lucky recipient of my random review request :)

Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, except that snapshot... however it might be better to tag @Twixes , @thmsobrmlr or anyone else from the Frontend NoteForce team for UI 👀

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow, this snapshot leaves me feeling empty.

Copy link
Contributor

@thmsobrmlr thmsobrmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me as well.. except for the snapshot :) Don't know what is going on with that.

Also I've left a comment inline for what I think would be more standard kea usage.

Regarding PostHog 3000: We're planning on releasing parts of the UI update soon and this will need some changes/updates as well. We (that is @PostHog/noteforce-3000) will take care of that and loop you in accordingly.

Comment on lines 126 to 133
minimalTopBar: [
(s) => [s.fullscreen, s.sceneConfig],
() => {
const activeScene = sceneLogic.values.activeScene
const minimalTopBarScenes = [Scene.Products, Scene.Onboarding]
return activeScene && minimalTopBarScenes.includes(activeScene)
},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a connected selector instead of directly accessing sceneLogic.values.activeScene feels more "canonical kea" to me.

Suggested change
minimalTopBar: [
(s) => [s.fullscreen, s.sceneConfig],
() => {
const activeScene = sceneLogic.values.activeScene
const minimalTopBarScenes = [Scene.Products, Scene.Onboarding]
return activeScene && minimalTopBarScenes.includes(activeScene)
},
],
minimalTopBar: [
(s) => [s.activeScene],
(activeScene) => {
const minimalTopBarScenes = [Scene.Products, Scene.Onboarding]
return activeScene && minimalTopBarScenes.includes(activeScene)
},
],

This requires changing the connected values as well:

    connect: {
        values: [sceneLogic, ['sceneConfig', 'activeScene'], membersLogic, ['members', 'membersLoading']],
        ...
    }

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

  • chromium: 0 added, 1 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@@ -20,7 +20,7 @@ function notifyFlagIfNeeded(flag: string, flagState: string | boolean | undefine

function getPersistedFeatureFlags(appContext: AppContext | undefined = getAppContext()): FeatureFlagsSet {
const persistedFeatureFlags = appContext?.persisted_feature_flags || []
return Object.fromEntries(persistedFeatureFlags.map((f) => [f, true]))
return Object.fromEntries(persistedFeatureFlags.map((f) => (Array.isArray(f) ? f : [f, true])))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can now default the persistedFeatureFlags to be an object (Record<string, string | boolean>) and get rid of the whole Object.fromEntries() schenanigans here and simplify things everywhere else too.

Just add true as value to previous default persisted flags

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, coming from env var as well, much more annoying to change 😅

@raquelmsmith
Copy link
Member Author

This is so frustrating, why is the snapshot blank??

@thmsobrmlr thmsobrmlr force-pushed the fix/onboarding-top-nav branch from bb4c94b to db4769b Compare October 19, 2023 18:05
@raquelmsmith
Copy link
Member Author

i can't figure out the issue with the stories rn but need to get this out so will make the story changes in another pr.

@raquelmsmith raquelmsmith enabled auto-merge (squash) October 19, 2023 21:00
@raquelmsmith raquelmsmith merged commit 1dc09c2 into master Oct 19, 2023
73 checks passed
@raquelmsmith raquelmsmith deleted the fix/onboarding-top-nav branch October 19, 2023 21:23
Justicea83 pushed a commit to Justicea83/posthog that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants