mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-24 11:03:17 -04:00
fix(client): show source code link when localhost exists (#54087)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { CompletedChallenge } from '../redux/prop-types';
|
||||
import { challengeTypes } from '../../../shared/config/challenge-types';
|
||||
import { maybeUrlRE } from '.';
|
||||
import { hasProtocolRE } from '.';
|
||||
|
||||
type DisplayType =
|
||||
| 'none'
|
||||
@@ -26,7 +26,7 @@ export const getSolutionDisplayType = ({
|
||||
if (!solution) return 'none';
|
||||
// Some of the user records still have JavaScript project solutions stored as
|
||||
// solution strings
|
||||
if (!maybeUrlRE.test(solution)) return 'showUserCode';
|
||||
if (maybeUrlRE.test(githubLink ?? '')) return 'showProjectAndGithubLinks';
|
||||
if (!hasProtocolRE.test(solution)) return 'showUserCode';
|
||||
if (hasProtocolRE.test(githubLink ?? '')) return 'showProjectAndGithubLinks';
|
||||
return 'showProjectLink';
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user