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