Skip to content

Commit

Permalink
feat: added feature toggle logic for counselling relation
Browse files Browse the repository at this point in the history
  • Loading branch information
web-mi committed Feb 27, 2024
1 parent 8bc4c2c commit f2e7e7c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ interface OtherFunctionsSettingsArgs {
hideTopics?: boolean;
hideStatistics?: boolean;
hideGroupChatToggle?: boolean;
hideCounsellingRelationToggle?: boolean;
}

export const OtherFunctionsSettings = ({
tenantId,
hideTopics,
hideStatistics,
hideGroupChatToggle,
hideCounsellingRelationToggle,
}: OtherFunctionsSettingsArgs) => {
const { t } = useTranslation();
const { settings } = useAppConfigContext();
Expand Down Expand Up @@ -69,6 +71,19 @@ export const OtherFunctionsSettings = ({
<p className={styles.checkInfo}>{t('tenants.appSettings.otherFunctions.groupChat.description')}</p>
</div>
)}
{!hideCounsellingRelationToggle && (
<div className={styles.checkGroup}>
<FormSwitchField
labelKey="tenants.appSettings.otherFunctions.counsellingRelations.title"
name={['settings', 'featureCounsellingRelationsEnabled']}
inline
disableLabels
/>
<p className={styles.checkInfo}>
{t('tenants.appSettings.otherFunctions.counsellingRelations.description')}
</p>
</div>
)}
</CardEditable>
);
};
4 changes: 4 additions & 0 deletions src/context/FeatureContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const FeatureProvider = ({ children, tenantData, publicTenantData }: FeatureProv
name: FeatureFlag.GroupChatV2,
active: !!publicTenantData?.settings.featureGroupChatV2Enabled,
},
{
name: FeatureFlag.CounsellingRelations,
active: !!publicTenantData?.settings.featureCounsellingRelationsEnabled,
},
{
name: FeatureFlag.CentralDataProtectionTemplate,
active: !!publicTenantData?.settings.featureCentralDataProtectionTemplateEnabled,
Expand Down
1 change: 1 addition & 0 deletions src/enums/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export enum FeatureFlag {
TopicsInRegistration = 'topicsInRegistration',
ConsultingTypesForAgencies = 'consultingTypesForAgencies',
GroupChatV2 = 'featureGroupChatV2Enabled',
CounsellingRelations = 'featureCounsellingRelationsEnabled',
CentralDataProtectionTemplate = 'featureCentralDataProtectionTemplateEnabled',
}
2 changes: 2 additions & 0 deletions src/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@
"tenants.appSettings.otherFunctions.statistics.description": "So können Administratoren und Berater die anonymisierten Registrierungsdaten aller Ratsuchenden exportieren",
"tenants.appSettings.otherFunctions.groupChat.title": "Gruppen Chat erlauben",
"tenants.appSettings.otherFunctions.groupChat.description": "Administratoren können Beratern erlauben, Gruppenchats zu erstellen.",
"tenants.appSettings.otherFunctions.counsellingRelations.title": "Beratungsgrund nutzen",
"tenants.appSettings.otherFunctions.counsellingRelations.description": "Aktivieren Sie diese Funktionalität, um den Beratungsgrund wie z.B. Beratung für eine/n Angehörige/n bei der Registrierung zur Auswahl anzubieten.",
"tenants.typeOfLanguage.title": "Ansprache",
"tenants.typeOfLanguage.radio.description": "Sollen die Nutzer eine formelle oder informelle Ansprache vom System bekommen?",
"tenants.typeOfLanguage.radio.formal": "formelle",
Expand Down
6 changes: 5 additions & 1 deletion src/pages/Tenants/Edit/AppSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export const TenantAppSettings = () => {
{hasRole(UserRole.TenantAdmin) && (
<Col span={12} sm={6}>
<CommunicationSettings tenantId={id} />
<OtherFunctionsSettings tenantId={id} hideTopics={settings.multitenancyWithSingleDomainEnabled} />
<OtherFunctionsSettings
tenantId={id}
hideTopics={settings.multitenancyWithSingleDomainEnabled}
hideCounsellingRelationToggle={settings.multitenancyWithSingleDomainEnabled}
/>
</Col>
)}
</Row>
Expand Down
1 change: 1 addition & 0 deletions src/types/tenant.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface BasicTenantData {
topicsInRegistrationEnabled?: boolean | null;
featureStatisticsEnabled?: boolean;
featureGroupChatV2Enabled?: boolean;
featureCounsellingRelationsEnabled?: boolean;
featureCentralDataProtectionTemplateEnabled?: boolean;
};
}
Expand Down

0 comments on commit f2e7e7c

Please sign in to comment.