Skip to content

Commit

Permalink
chore: Fix mobile shell menu
Browse files Browse the repository at this point in the history
  • Loading branch information
flozia committed Dec 19, 2024
1 parent 248d198 commit 6c396f7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 30 deletions.
4 changes: 2 additions & 2 deletions config/nimbus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ features:
defaults:
- channel: local
value: {
"enabled": false,
"variant": default,
"enabled": true,
"variant": redesign,
}
- channel: staging
value: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
flex-shrink: 0;
}

@media screen and (max-width: $screen-xl) {
display: none;
&.navDesktop {
@media screen and (max-width: $screen-xl) {
display: none;
}
}
}

Expand Down
57 changes: 32 additions & 25 deletions src/app/(proper_react)/(redesign)/(public)/PublicShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,50 @@ export type Props = {
experimentData: ExperimentData;
};

const PublicMobileShell = (props: Props) => {
if (
!(
props.enabledFeatureFlags.includes("LandingPageRedesign") &&
props.experimentData["landing-page-redesign"].enabled &&
props.experimentData["landing-page-redesign"].variant === "redesign"
)
) {
return props.children;
const PublicMobileShell = (
props: Props & {
hasLandingPageRedesign: boolean;
},
) => {
if (props.hasLandingPageRedesign) {
return (
<MobileShell
countryCode={props.countryCode}
enabledFeatureFlags={props.enabledFeatureFlags}
fxaSettingsUrl={process.env.FXA_SETTINGS_URL!}
monthlySubscriptionUrl={getPremiumSubscriptionUrl({ type: "monthly" })}
session={null}
subscriptionBillingAmount={getSubscriptionBillingAmount()}
yearlySubscriptionUrl={getPremiumSubscriptionUrl({ type: "yearly" })}
>
{props.children}
</MobileShell>
);
}

return (
<MobileShell
{...props}
session={null}
monthlySubscriptionUrl={getPremiumSubscriptionUrl({ type: "monthly" })}
yearlySubscriptionUrl={getPremiumSubscriptionUrl({ type: "yearly" })}
subscriptionBillingAmount={getSubscriptionBillingAmount()}
fxaSettingsUrl={process.env.FXA_SETTINGS_URL!}
/>
);
return props.children;
};

export const PublicShell = (props: Props) => {
const hasLandingPageRedesign =
props.enabledFeatureFlags.includes("LandingPageRedesign") &&
props.experimentData["landing-page-redesign"].enabled &&
props.experimentData["landing-page-redesign"].variant === "redesign";
return (
<PublicMobileShell {...props}>
<PublicMobileShell
{...props}
hasLandingPageRedesign={hasLandingPageRedesign}
>
<div className={styles.wrapper}>
<ToastContainer
toastClassName={styles.toastBody}
position="top-center"
theme="colored"
autoClose={false}
/>
<nav className={styles.nav}>
<nav
className={`${styles.nav} ${hasLandingPageRedesign ? styles.navDesktop : ""}`}
>
<h1>
<Link href="/">
<Image
Expand All @@ -72,10 +82,7 @@ export const PublicShell = (props: Props) => {
/>
</Link>
</h1>
{props.enabledFeatureFlags.includes("LandingPageRedesign") &&
props.experimentData["landing-page-redesign"].enabled &&
props.experimentData["landing-page-redesign"].variant ===
"redesign" && <TopNavBar styles={styles} />}
{hasLandingPageRedesign && <TopNavBar styles={styles} />}
<SignInButton variant="secondary" />
</nav>
<div className={styles.content}>{props.children}</div>
Expand Down
6 changes: 5 additions & 1 deletion src/app/(proper_react)/(redesign)/(public)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ import { getCountryCode } from "../../../functions/server/getCountryCode";
import { getLocale } from "../../../functions/universal/getLocale";
import { getExperiments } from "../../../functions/server/getExperiments";
import { getExperimentationId } from "../../../functions/server/getExperimentationId";
import { getEnabledFeatureFlags } from "../../../../db/tables/featureFlags";

export default async function Layout(props: { children: ReactNode }) {
const headersList = headers();
const countryCode = getCountryCode(headersList);
const enabledFeatureFlags = await getEnabledFeatureFlags({
isSignedOut: true,
});
const experimentationId = getExperimentationId(null);
const experimentData = await getExperiments({
experimentationId,
Expand All @@ -26,7 +30,7 @@ export default async function Layout(props: { children: ReactNode }) {
<PublicShell
l10n={getL10n()}
countryCode={countryCode}
enabledFeatureFlags={[]}
enabledFeatureFlags={enabledFeatureFlags}
experimentData={experimentData}
>
{props.children}
Expand Down

0 comments on commit 6c396f7

Please sign in to comment.