Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
lelemm and coderabbitai[bot] authored Nov 12, 2024
1 parent 1f6a772 commit ce74088
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export function SummaryNumber({
{/* Visible element */}
<View
ref={mergedRef as Ref<HTMLDivElement>}
role="text"
aria-label={`${value < 0 ? 'Negative' : 'Positive'} amount: ${amountToCurrency(Math.abs(value))}${suffix}`}
style={{
alignItems: 'center',
height: '100%',
Expand All @@ -80,7 +82,7 @@ export function SummaryNumber({
color: value < 0 ? chartTheme.colors.red : chartTheme.colors.blue,
}}
>
<span>
<span aria-hidden="true">
{amountToCurrency(Math.abs(value))}
{suffix}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ function SummaryInner({ widget }: SummaryInnerProps) {
onDelete: onDeleteFilter,
onUpdate: onUpdateFilter,
onConditionsOpChange,
} = useFilters(widget?.meta?.conditions, widget?.meta?.conditionsOp);
} = useFilters(
widget?.meta?.conditions ?? [], widget?.meta?.conditionsOp ?? 'and');

Check warning on line 79 in packages/desktop-client/src/components/reports/reports/Summary.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `·widget?.meta?.conditionsOp·??·'and'` with `⏎····widget?.meta?.conditionsOp·??·'and',⏎··`

const [content, setContent] = useState<SummaryContent>(
widget?.meta?.content
Expand Down
14 changes: 10 additions & 4 deletions packages/loot-core/src/types/models/dashboard.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ export type SummaryWidget = AbstractWidget<
} | null
>;

export type SummaryContent = {
type: 'sum' | 'avgPerMonth' | 'avgPerTransact' | 'percentage';
divisorConditions?: RuleConditionEntity[];
divisorConditionsOp?: 'and' | 'or';
export type BaseSummaryContent = {
type: 'sum' | 'avgPerMonth' | 'avgPerTransact';
};

export type PercentageSummaryContent = {
type: 'percentage';
divisorConditions: RuleConditionEntity[];
divisorConditionsOp: 'and' | 'or';
divisorIncludeDateRange?: boolean;
};

export type SummaryContent = BaseSummaryContent | PercentageSummaryContent;

0 comments on commit ce74088

Please sign in to comment.