Skip to content

Commit

Permalink
Fix privacy filter (#3472)
Browse files Browse the repository at this point in the history
* Fix privacy filter

* Release notes

* Coderabbit suggestion

* VRT

* VRT

* Revert VRT

* VRT

* VRT

* VRT

* VRT

* Delete VRT

* VRT

* Revert VRT
  • Loading branch information
joel-jeremy authored Sep 23, 2024
1 parent 90e2fe6 commit d1ecb3d
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 41 deletions.
28 changes: 13 additions & 15 deletions packages/desktop-client/src/components/accounts/Balance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,19 @@ export function Balances({
>
<CellValue binding={{ ...balanceQuery, value: 0 }} type="financial">
{props => (
<PrivacyFilter blurIntensity={5}>
<CellValueText
{...props}
style={{
fontSize: 22,
fontWeight: 400,
color:
props.value < 0
? theme.errorText
: props.value > 0
? theme.noticeTextLight
: theme.pageTextSubdued,
}}
/>
</PrivacyFilter>
<CellValueText
{...props}
style={{
fontSize: 22,
fontWeight: 400,
color:
props.value < 0
? theme.errorText
: props.value > 0
? theme.noticeTextLight
: theme.pageTextSubdued,
}}
/>
)}
</CellValue>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';

import { css } from 'glamor';

import { useFeatureFlag } from '../../hooks/useFeatureFlag';
import { SvgArrowThinRight } from '../../icons/v1';
import { type CSSProperties, theme, styles } from '../../style';
Expand Down Expand Up @@ -177,16 +179,18 @@ export function BalanceWithCarryover({
type={type}
name={name}
value={balanceValue}
style={{
...getBalanceStyle(balanceValue),
overflow: 'hidden',
textOverflow: 'ellipsis',
textAlign: 'right',
...(!disabled && {
cursor: 'pointer',
className={String(
css({
...getBalanceStyle(balanceValue),
overflow: 'hidden',
textOverflow: 'ellipsis',
textAlign: 'right',
...(!disabled && {
cursor: 'pointer',
}),
':hover': { textDecoration: 'underline' },
}),
':hover': { textDecoration: 'underline' },
}}
)}
/>
</Tooltip>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React, { type ComponentProps, memo, useRef, useState } from 'react';

import { css } from 'glamor';

import { envelopeBudget } from 'loot-core/src/client/queries';
import { evalArithmetic } from 'loot-core/src/shared/arithmetic';
import * as monthUtils from 'loot-core/src/shared/months';
Expand Down Expand Up @@ -359,11 +361,13 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
{props => (
<CellValueText
{...props}
style={{
cursor: 'pointer',
':hover': { textDecoration: 'underline' },
...makeAmountGrey(props.value),
}}
className={String(
css({
cursor: 'pointer',
':hover': { textDecoration: 'underline' },
...makeAmountGrey(props.value),
}),
)}
/>
)}
</EnvelopeCellValue>
Expand Down Expand Up @@ -472,10 +476,12 @@ export function IncomeCategoryMonth({
{props => (
<CellValueText
{...props}
style={{
cursor: 'pointer',
':hover': { textDecoration: 'underline' },
}}
className={String(
css({
cursor: 'pointer',
':hover': { textDecoration: 'underline' },
}),
)}
/>
)}
</EnvelopeCellValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import React, { type ComponentProps, memo, useRef, useState } from 'react';
import { Trans } from 'react-i18next';

import { css } from 'glamor';

import { trackingBudget } from 'loot-core/src/client/queries';
import { evalArithmetic } from 'loot-core/src/shared/arithmetic';
import * as monthUtils from 'loot-core/src/shared/months';
Expand Down Expand Up @@ -370,13 +372,15 @@ export const CategoryMonth = memo(function CategoryMonth({
{props => (
<CellValueText
{...props}
style={{
cursor: 'pointer',
':hover': {
textDecoration: 'underline',
},
...makeAmountGrey(props.value),
}}
className={String(
css({
cursor: 'pointer',
':hover': {
textDecoration: 'underline',
},
...makeAmountGrey(props.value),
}),
)}
/>
)}
</TrackingCellValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { type ComponentPropsWithoutRef, type ReactNode } from 'react';

import { type CSSProperties, styles } from '../../style';
import { Text } from '../common/Text';
import { PrivacyFilter } from '../PrivacyFilter';

import { type FormatType, useFormat } from './useFormat';
import { useSheetName } from './useSheetName';
Expand Down Expand Up @@ -51,6 +52,8 @@ export function CellValue<
);
}

const PRIVACY_FILTER_TYPES = ['financial', 'financial-with-sign'];

type CellValueTextProps<
SheetName extends SheetNames,
FieldName extends SheetFields<SheetName>,
Expand Down Expand Up @@ -87,7 +90,9 @@ export function CellValueText<
data-cellname={name}
{...props}
>
{formatter ? formatter(value, type) : format(value, type)}
<PrivacyFilter activationFilters={[PRIVACY_FILTER_TYPES.includes(type)]}>
{formatter ? formatter(value, type) : format(value, type)}
</PrivacyFilter>
</Text>
);
}
6 changes: 6 additions & 0 deletions upcoming-release-notes/3472.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [joel-jeremy]
---

Fix privacy filters not activating

0 comments on commit d1ecb3d

Please sign in to comment.