feat: add env variable to hide team type setting.

This commit is contained in:
SaadYousaf
2021-11-22 14:50:37 +05:00
committed by Saad Yousaf
parent 10b98030b8
commit 0852020139
5 changed files with 8 additions and 0 deletions

1
.env
View File

@@ -24,3 +24,4 @@ SUPPORT_EMAIL=''
SUPPORT_URL=''
USER_INFO_COOKIE_NAME=''
ENABLE_PROGRESS_GRAPH_SETTINGS=false
ENABLE_TEAM_TYPE_SETTING=false

View File

@@ -26,3 +26,4 @@ SUPPORT_EMAIL='support@example.com'
SUPPORT_URL='https://support.edx.org'
USER_INFO_COOKIE_NAME='edx-user-info'
ENABLE_PROGRESS_GRAPH_SETTINGS=false
ENABLE_TEAM_TYPE_SETTING=false

View File

@@ -25,3 +25,4 @@ SUPPORT_EMAIL='support@example.com'
SUPPORT_URL='https://support.edx.org'
USER_INFO_COOKIE_NAME='edx-user-info'
ENABLE_PROGRESS_GRAPH_SETTINGS=false
ENABLE_TEAM_TYPE_SETTING=false

View File

@@ -49,6 +49,7 @@ initialize({
LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,
CALCULATOR_HELP_URL: process.env.CALCULATOR_HELP_URL || null,
ENABLE_PROGRESS_GRAPH_SETTINGS: process.env.ENABLE_PROGRESS_GRAPH_SETTINGS || 'false',
ENABLE_TEAM_TYPE_SETTING: process.env.ENABLE_TEAM_TYPE_SETTING === 'true',
}, 'CourseAuthoringConfig');
},
},

View File

@@ -2,6 +2,7 @@ import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
import { Button, Form, TransitionReplace } from '@edx/paragon';
import PropTypes from 'prop-types';
import React, { useState } from 'react';
import { getConfig } from '@edx/frontend-platform';
import { GroupTypes, TeamSizes } from '../../data/constants';
import CollapsableEditor from '../../generic/CollapsableEditor';
@@ -31,6 +32,7 @@ function GroupEditor({
const [isOpen, setOpen] = useState(group.id === null);
const initiateDeletion = () => setDeleting(true);
const cancelDeletion = () => setDeleting(false);
const showTeamTypeSetting = getConfig().ENABLE_TEAM_TYPE_SETTING;
const handleToggle = (open) => setOpen(Boolean(errors.name || errors.maxTeamSize || errors.description) || open);
@@ -95,6 +97,7 @@ function GroupEditor({
style={{ minHeight: '2.5rem' }}
className={formGroupClasses}
/>
{showTeamTypeSetting && (
<Form.Group className={formGroupClasses}>
<Form.Label className="h4 my-3">
{intl.formatMessage(messages.groupFormTypeLabel)}
@@ -119,6 +122,7 @@ function GroupEditor({
))}
</Form.RadioSet>
</Form.Group>
)}
<FormikControl
type="number"
name={`${fieldNameCommonBase}.maxTeamSize`}