feat: update Ask for help (#40114)

* feat: get helpCategory from frontmatter

* DEBUG: sets all the projects to JavaScript

This is just so the tests pass, it'll need to go.

* fix: updated helpCategoryMap categories

* fix: added Python to helpCategory frontmatter key

Co-authored-by: Randell Dawson <rdawson@onepathtech.com>
This commit is contained in:
Oliver Eyton-Williams
2020-10-30 20:10:34 +01:00
committed by GitHub
parent 7857dc53f4
commit e4a9b2988c
12 changed files with 145 additions and 124 deletions

View File

@@ -7,7 +7,6 @@ import {
challengeMetaSelector
} from '../redux';
import { tap, mapTo } from 'rxjs/operators';
import { helpCategory } from '../../../../utils/challengeTypes';
import { forumLocation } from '../../../../../config/env.json';
function filesToMarkdown(files = {}) {
@@ -29,7 +28,9 @@ function createQuestionEpic(action$, state$, { window }) {
tap(() => {
const state = state$.value;
const files = challengeFilesSelector(state);
const { block, title: challengeTitle } = challengeMetaSelector(state);
const { title: challengeTitle, helpCategory } = challengeMetaSelector(
state
);
const {
navigator: { userAgent },
location: { href }
@@ -69,13 +70,13 @@ function createQuestionEpic(action$, state$, { window }) {
\`\`\`
Replace these two sentences with your copied code.
Please leave the \`\`\` line above and the \`\`\` line below,
Please leave the \`\`\` line above and the \`\`\` line below,
because they allow your code to properly format in the post.
\`\`\`\n${endingText}`
);
const category = window.encodeURIComponent(helpCategory[block] || 'Help');
const category = window.encodeURIComponent(helpCategory || 'Help');
const studentCode = window.encodeURIComponent(textMessage);
const altStudentCode = window.encodeURIComponent(altTextMessage);