* fix(layout): Fix Settings layout in firefox * chore(availableForHire): Remove available for hire setting * feat(helpers): Use helper components for Settings layout * fix(map): Fix undefined lang requested * feat(settings): Expand Settings page functionality * chore(pledge): Remove pledge from Settings * fix(about): Adjust AboutSettings layout * fix(portfolio): Improve PortfolioSettings layout * fix(email): Improve EmailSettings layout * fix(settings): Align save buttons with form fields * fix(AHP): Format AHP * fix(DangerZone): Adjust DangerZone layout * fix(projectSettings): Change Button Copy * fix(CertSettings): Fix certificate claim logic * chore(lint): Lint
33 lines
915 B
JavaScript
33 lines
915 B
JavaScript
import { dasherize } from '../../../../../server/utils/index';
|
|
|
|
export const jsProjectSuperBlock = 'javascript-algorithms-and-data-structures';
|
|
|
|
export function buildUserProjectsMap(projectBlock, challengeMap) {
|
|
const {
|
|
challengeNameIdMap,
|
|
challenges,
|
|
superBlock
|
|
} = projectBlock;
|
|
return {
|
|
[superBlock]: challenges.reduce((solutions, current) => {
|
|
const dashedName = dasherize(current)
|
|
.replace('java-script', 'javascript')
|
|
.replace('metric-imperial', 'metricimperial');
|
|
const completed = challengeMap[challengeNameIdMap[dashedName]];
|
|
let solution = '';
|
|
if (superBlock === jsProjectSuperBlock) {
|
|
solution = {};
|
|
}
|
|
if (completed) {
|
|
solution = 'solution' in completed ?
|
|
completed.solution :
|
|
completed.files;
|
|
}
|
|
return {
|
|
...solutions,
|
|
[current]: solution
|
|
};
|
|
}, {})
|
|
};
|
|
}
|