mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor(client): daily challenges to use path params (#61776)
This commit is contained in:
@@ -35,7 +35,9 @@ function getComponentNameAndProps(
|
||||
location: {
|
||||
pathname
|
||||
},
|
||||
pageContext
|
||||
pageContext,
|
||||
params: { '*': '' },
|
||||
path: ''
|
||||
}
|
||||
});
|
||||
utils.render(<Provider store={store}>{LayoutReactComponent}</Provider>);
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user