Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Upcoming length adjustment feature flag #3651

Merged
merged 13 commits into from
Oct 18, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ export function ExperimentalFeatures() {
>
<Trans>Rule action templating</Trans>
</FeatureToggle>
<FeatureToggle
flag="upcomingLengthAdjustment"
// feedbackLink="https://github.com/actualbudget/actual/issues/3606" TODO: Create feedback issue
SamBobBarnes marked this conversation as resolved.
Show resolved Hide resolved
>
<Trans>Scheduled transaction upcoming length adjustment</Trans>
</FeatureToggle>
</View>
) : (
<Link
Expand Down
5 changes: 5 additions & 0 deletions packages/desktop-client/src/components/settings/Upcoming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Column } from 'glamor/jsxstyle';

import { type SyncedPrefs } from 'loot-core/types/prefs';

import { useFeatureFlag } from '../../hooks/useFeatureFlag';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { type CSSProperties, theme } from '../../style';
import { Button } from '../common/Button2';
Expand Down Expand Up @@ -37,9 +38,13 @@ export function UpcomingLengthSettings() {
},
};

const enabled = useFeatureFlag('upcomingLengthAdjustment');

const location = useLocation();
const [expanded, setExpanded] = useState(location.hash === '#upcomingLength');

if (!enabled) return null;

return expanded ? (
<Setting
primaryAction={
Expand Down
1 change: 1 addition & 0 deletions packages/desktop-client/src/hooks/useFeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const DEFAULT_FEATURE_FLAG_STATE: Record<FeatureFlag, boolean> = {
spendingReport: false,
dashboards: false,
actionTemplating: false,
upcomingLengthAdjustment: false,
};

export function useFeatureFlag(name: FeatureFlag): boolean {
Expand Down
3 changes: 2 additions & 1 deletion packages/loot-core/src/types/prefs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export type FeatureFlag =
| 'reportBudget'
| 'goalTemplatesEnabled'
| 'spendingReport'
| 'actionTemplating';
| 'actionTemplating'
| 'upcomingLengthAdjustment';
SamBobBarnes marked this conversation as resolved.
Show resolved Hide resolved

/**
* Cross-device preferences. These sync across devices when they are changed.
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3651.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [ SamBobBarnes ]
---

Add feature flag for upcoming length adjustment setting.
Loading