feat(settings): Expand Settings page functionality (#16664)
* 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
This commit is contained in:
committed by
Quincy Larson
parent
9f034f4f79
commit
24ef69cf7a
32
common/app/routes/Settings/utils/buildUserProjectsMap.js
Normal file
32
common/app/routes/Settings/utils/buildUserProjectsMap.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
};
|
||||
}, {})
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user