Skip to content
Snippets Groups Projects
Unverified Commit d6afc85a authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:sparkles: adding feedback links besides the feature flags (#3283)

parent ee21155d
No related branches found
No related tags found
No related merge requests found
import { type ReactNode, useState } from 'react'; import { type ReactNode, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import type { FeatureFlag } from 'loot-core/src/types/prefs'; import type { FeatureFlag } from 'loot-core/src/types/prefs';
...@@ -17,11 +18,13 @@ type FeatureToggleProps = { ...@@ -17,11 +18,13 @@ type FeatureToggleProps = {
disableToggle?: boolean; disableToggle?: boolean;
error?: ReactNode; error?: ReactNode;
children: ReactNode; children: ReactNode;
feedbackLink?: string;
}; };
function FeatureToggle({ function FeatureToggle({
flag: flagName, flag: flagName,
disableToggle = false, disableToggle = false,
feedbackLink,
error, error,
children, children,
}: FeatureToggleProps) { }: FeatureToggleProps) {
...@@ -40,7 +43,15 @@ function FeatureToggle({ ...@@ -40,7 +43,15 @@ function FeatureToggle({
<View <View
style={{ color: disableToggle ? theme.pageTextSubdued : 'inherit' }} style={{ color: disableToggle ? theme.pageTextSubdued : 'inherit' }}
> >
{children} <View style={{ flexDirection: 'row', alignItems: 'center', gap: 5 }}>
{children}
{feedbackLink && (
<Link variant="external" to={feedbackLink}>
<Trans>(give feedback)</Trans>
</Link>
)}
</View>
{disableToggle && ( {disableToggle && (
<Text <Text
style={{ style={{
...@@ -57,6 +68,7 @@ function FeatureToggle({ ...@@ -57,6 +68,7 @@ function FeatureToggle({
} }
function ReportBudgetFeature() { function ReportBudgetFeature() {
const { t } = useTranslation();
const [budgetType = 'rollover'] = useSyncedPref('budgetType'); const [budgetType = 'rollover'] = useSyncedPref('budgetType');
const enabled = useFeatureFlag('reportBudget'); const enabled = useFeatureFlag('reportBudget');
const blockToggleOff = budgetType === 'report' && enabled; const blockToggleOff = budgetType === 'report' && enabled;
...@@ -64,9 +76,10 @@ function ReportBudgetFeature() { ...@@ -64,9 +76,10 @@ function ReportBudgetFeature() {
<FeatureToggle <FeatureToggle
flag="reportBudget" flag="reportBudget"
disableToggle={blockToggleOff} disableToggle={blockToggleOff}
error="Switch to a rollover budget before turning off this feature" error={t('Switch to a rollover budget before turning off this feature')}
feedbackLink="https://github.com/actualbudget/actual/issues/2999"
> >
Budget mode toggle <Trans>Budget mode toggle</Trans>
</FeatureToggle> </FeatureToggle>
); );
} }
...@@ -79,18 +92,29 @@ export function ExperimentalFeatures() { ...@@ -79,18 +92,29 @@ export function ExperimentalFeatures() {
primaryAction={ primaryAction={
expanded ? ( expanded ? (
<View style={{ gap: '1em' }}> <View style={{ gap: '1em' }}>
<FeatureToggle flag="spendingReport"> <FeatureToggle
Monthly spending report flag="spendingReport"
feedbackLink="https://github.com/actualbudget/actual/issues/2820"
>
<Trans>Monthly spending report</Trans>
</FeatureToggle> </FeatureToggle>
<ReportBudgetFeature /> <ReportBudgetFeature />
<FeatureToggle flag="goalTemplatesEnabled"> <FeatureToggle flag="goalTemplatesEnabled">
Goal templates <Trans>Goal templates</Trans>
</FeatureToggle>
<FeatureToggle
flag="simpleFinSync"
feedbackLink="https://github.com/actualbudget/actual/issues/2272"
>
<Trans>SimpleFIN sync</Trans>
</FeatureToggle> </FeatureToggle>
<FeatureToggle flag="simpleFinSync">SimpleFIN sync</FeatureToggle> <FeatureToggle
<FeatureToggle flag="dashboards"> flag="dashboards"
Customizable reports page (dashboards) feedbackLink="https://github.com/actualbudget/actual/issues/3282"
>
<Trans>Customizable reports page (dashboards)</Trans>
</FeatureToggle> </FeatureToggle>
</View> </View>
) : ( ) : (
...@@ -104,16 +128,18 @@ export function ExperimentalFeatures() { ...@@ -104,16 +128,18 @@ export function ExperimentalFeatures() {
color: theme.pageTextPositive, color: theme.pageTextPositive,
}} }}
> >
I understand the risks, show experimental features <Trans>I understand the risks, show experimental features</Trans>
</Link> </Link>
) )
} }
> >
<Text> <Text>
<strong>Experimental features.</strong> These features are not fully <Trans>
tested and may not work as expected. THEY MAY CAUSE IRRECOVERABLE DATA <strong>Experimental features.</strong> These features are not fully
LOSS. They may do nothing at all. Only enable them if you know what you tested and may not work as expected. THEY MAY CAUSE IRRECOVERABLE DATA
are doing. LOSS. They may do nothing at all. Only enable them if you know what
you are doing.
</Trans>
</Text> </Text>
</Setting> </Setting>
); );
......
---
category: Enhancements
authors: [MatissJanis]
---
Added feedback links besides the experimental feature flags.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment