fix(client): adjust project link logic to show files (#42717)
This commit is contained in:
@ -23,14 +23,14 @@ interface IShowProjectLinksProps {
|
|||||||
|
|
||||||
type SolutionStateType = {
|
type SolutionStateType = {
|
||||||
projectTitle: string;
|
projectTitle: string;
|
||||||
challengeFiles: ChallengeFileType[] | null;
|
files?: ChallengeFileType[] | null;
|
||||||
solution: CompletedChallenge['solution'];
|
solution: CompletedChallenge['solution'];
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const initSolutionState: SolutionStateType = {
|
const initSolutionState: SolutionStateType = {
|
||||||
projectTitle: '',
|
projectTitle: '',
|
||||||
challengeFiles: null,
|
files: null,
|
||||||
solution: null,
|
solution: null,
|
||||||
isOpen: false
|
isOpen: false
|
||||||
};
|
};
|
||||||
@ -55,16 +55,16 @@ const ShowProjectLinks = (props: IShowProjectLinksProps): JSX.Element => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { solution, githubLink, challengeFiles } = completedProject;
|
const { solution, githubLink, files } = completedProject;
|
||||||
const onClickHandler = () =>
|
const onClickHandler = () =>
|
||||||
setSolutionState({
|
setSolutionState({
|
||||||
projectTitle,
|
projectTitle,
|
||||||
challengeFiles,
|
files,
|
||||||
solution,
|
solution,
|
||||||
isOpen: true
|
isOpen: true
|
||||||
});
|
});
|
||||||
|
|
||||||
if (challengeFiles) {
|
if (files) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
className='project-link-button-override'
|
className='project-link-button-override'
|
||||||
@ -162,7 +162,7 @@ const ShowProjectLinks = (props: IShowProjectLinksProps): JSX.Element => {
|
|||||||
name,
|
name,
|
||||||
user: { username }
|
user: { username }
|
||||||
} = props;
|
} = props;
|
||||||
const { challengeFiles, isOpen, projectTitle, solution } = solutionState;
|
const { files, isOpen, projectTitle, solution } = solutionState;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{t(
|
{t(
|
||||||
@ -176,7 +176,7 @@ const ShowProjectLinks = (props: IShowProjectLinksProps): JSX.Element => {
|
|||||||
<Spacer />
|
<Spacer />
|
||||||
{isOpen ? (
|
{isOpen ? (
|
||||||
<ProjectModal
|
<ProjectModal
|
||||||
files={challengeFiles}
|
files={files}
|
||||||
handleSolutionModalHide={handleSolutionModalHide}
|
handleSolutionModalHide={handleSolutionModalHide}
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
projectTitle={projectTitle}
|
projectTitle={projectTitle}
|
||||||
|
@ -305,6 +305,8 @@ export type CompletedChallenge = {
|
|||||||
challengeType?: number;
|
challengeType?: number;
|
||||||
completedDate: number;
|
completedDate: number;
|
||||||
challengeFiles: ChallengeFileType[] | null;
|
challengeFiles: ChallengeFileType[] | null;
|
||||||
|
// TODO: remove once files->challengeFiles is refactored
|
||||||
|
files?: ChallengeFileType[] | null;
|
||||||
};
|
};
|
||||||
// TODO: renames: files => challengeFiles; key => fileKey; #42489
|
// TODO: renames: files => challengeFiles; key => fileKey; #42489
|
||||||
export type ChallengeFileType =
|
export type ChallengeFileType =
|
||||||
|
Reference in New Issue
Block a user