refactor(client): daily challenges to use path params (#61776)

This commit is contained in:
Tom
2025-08-12 01:39:52 -05:00
committed by GitHub
parent 8405f24a40
commit 7634b5c8a1
14 changed files with 114 additions and 53 deletions
+3 -1
View File
@@ -35,7 +35,9 @@ function getComponentNameAndProps(
location: {
pathname
},
pageContext
pageContext,
params: { '*': '' },
path: ''
}
});
utils.render(<Provider store={store}>{LayoutReactComponent}</Provider>);
+5 -2
View File
@@ -10,6 +10,8 @@ interface LayoutSelectorProps {
data: { challengeNode?: { challenge?: { usesMultifileEditor?: boolean } } };
location: { pathname: string };
pageContext?: { challengeMeta?: { block?: string; superBlock?: string } };
params: { '*'?: string };
path: string;
};
}
export default function layoutSelector({
@@ -20,8 +22,8 @@ export default function layoutSelector({
location: { pathname }
} = props;
const isDailyChallenge =
props.location.pathname === '/learn/daily-coding-challenge';
const isDailyChallenge = props.path === '/learn/daily-coding-challenge/*';
const dailyChallengeParam = props.params['*'];
const isChallenge = !!props.pageContext?.challengeMeta || isDailyChallenge;
@@ -42,6 +44,7 @@ export default function layoutSelector({
showFooter={false}
isChallenge={true}
isDailyChallenge={isDailyChallenge}
dailyChallengeParam={dailyChallengeParam}
usesMultifileEditor={
props.data?.challengeNode?.challenge?.usesMultifileEditor
}