Skip to content

Commit

Permalink
Merge branch 'master' into api-hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
ioslife authored Dec 14, 2023
2 parents 55b1771 + e11b657 commit ec6962a
Show file tree
Hide file tree
Showing 82 changed files with 738 additions and 320 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,38 @@ jobs:
name: desktop-client-test-results
path: packages/desktop-client/test-results/
retention-days: 30
- uses: actions-ecosystem/action-add-labels@v1
if: failure()
with:
labels: ':red_circle: VRT failing'
- uses: actions-ecosystem/action-remove-labels@v1
if: success()
with:
labels: ':red_circle: VRT failing'
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: VRT
- name: Create comment if failed
if: failure()
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:wave: Looks like VRT (visual regression tests) are failing in this PR. This indicates a problem in the app. It could be either a bug in this PR or a visual change introduced by changing something.
To fix this: please follow [these instructions](https://github.com/actualbudget/actual/blob/master/packages/desktop-client/README.md#visual-regression) and review the output of the failing CI job to see the generated screenshots.
We look forward to reviewing this PR once all the CI jobs have passed successfully!
edit-mode: replace
- name: Update comment when CI job passes
if: success() && steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: The VRT tests have passed! Thank you!
edit-mode: replace
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@types/react-dom": "^18.2.1",
"@types/react-modal": "^3.16.0",
"@types/react-redux": "^7.1.25",
"@types/react-router-dom": "^5.3.3",
"@types/uuid": "^9.0.2",
"@types/webpack-bundle-analyzer": "^4.6.0",
"@use-gesture/react": "^10.3.0",
Expand Down
44 changes: 33 additions & 11 deletions packages/desktop-client/src/components/ThemeSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React from 'react';
import React, { useState } from 'react';

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

import { useActions } from '../hooks/useActions';
import MoonStars from '../icons/v2/MoonStars';
import Sun from '../icons/v2/Sun';
import System from '../icons/v2/System';
import { useResponsive } from '../ResponsiveProvider';
import { type CSSProperties, useTheme } from '../style';
import { type CSSProperties, themeOptions, useTheme } from '../style';

import Button from './common/Button';
import Menu from './common/Menu';
import { Tooltip } from './tooltips';

type ThemeSelectorProps = {
style?: CSSProperties;
Expand All @@ -15,24 +20,41 @@ type ThemeSelectorProps = {
export function ThemeSelector({ style }: ThemeSelectorProps) {
const theme = useTheme();
const { saveGlobalPrefs } = useActions();
const [menuOpen, setMenuOpen] = useState(false);

const { isNarrowWidth } = useResponsive();

const themeIcons = { light: Sun, dark: MoonStars, auto: System } as const;

async function onMenuSelect(newTheme: string) {
setMenuOpen(false);

saveGlobalPrefs({
theme: newTheme as Theme,
});
}

const Icon = themeIcons?.[theme] || Sun;

return isNarrowWidth ? null : (
<Button
type="bare"
aria-label="Switch theme"
onClick={() => {
saveGlobalPrefs({
theme: theme === 'dark' ? 'light' : 'dark',
});
}}
onClick={() => setMenuOpen(true)}
style={style}
>
{theme === 'light' ? (
<MoonStars style={{ width: 15, height: 15, color: 'inherit' }} />
) : (
<Sun style={{ width: 15, height: 15, color: 'inherit' }} />
<Icon style={{ width: 13, height: 13, color: 'inherit' }} />
{menuOpen && (
<Tooltip
position="bottom-right"
style={{ padding: 0 }}
onClose={() => setMenuOpen(false)}
>
<Menu
onMenuSelect={onMenuSelect}
items={themeOptions.map(([name, text]) => ({ name, text }))}
/>
</Tooltip>
)}
</Button>
);
Expand Down
3 changes: 2 additions & 1 deletion packages/desktop-client/src/components/common/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type ModalProps = {
isHidden?: boolean;
children: ReactNode | (() => ReactNode);
size?: { width?: number; height?: number };
padding?: number;
padding?: CSSProperties['padding'];
showHeader?: boolean;
showTitle?: boolean;
showClose?: boolean;
Expand Down Expand Up @@ -93,6 +93,7 @@ const Modal = ({
backgroundColor: 'transparent',
padding: 0,
pointerEvents: 'auto',
margin: '0 10px',
...contentStyle,
},
overlay: {
Expand Down
3 changes: 3 additions & 0 deletions packages/desktop-client/src/components/common/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type SelectProps<Value extends string> = {
style?: CSSProperties;
wrapperStyle?: CSSProperties;
line?: number;
disabled?: boolean;
disabledKeys?: Value[];
};

Expand Down Expand Up @@ -46,6 +47,7 @@ export default function Select<Value extends string>({
style,
wrapperStyle,
line,
disabled,
disabledKeys = [],
}: SelectProps<Value>) {
const arrowSize = 7;
Expand All @@ -55,6 +57,7 @@ export default function Select<Value extends string>({
<ListboxInput
value={value}
onChange={onChange}
disabled={disabled}
style={{
color: bare ? 'inherit' : theme.formInputText,
backgroundColor: bare ? 'transparent' : theme.cardBackground,
Expand Down
17 changes: 11 additions & 6 deletions packages/desktop-client/src/components/reports/ChooseGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ type ChooseGraphProps = {
setScrollWidth: (value: number) => void;
months: Month[];
};
export function ChooseGraph({

function ChooseGraph({
data,
mode,
graphType,
Expand All @@ -37,6 +38,8 @@ export function ChooseGraph({
setScrollWidth,
months,
}: ChooseGraphProps) {
const balanceTypeOp = ReportOptions.balanceTypeMap.get(balanceType);

const saveScrollWidth = value => {
setScrollWidth(!value ? 0 : value);
};
Expand All @@ -55,7 +58,7 @@ export function ChooseGraph({
<AreaGraph
style={{ flexGrow: 1 }}
data={data}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
balanceTypeOp={balanceTypeOp}
/>
);
}
Expand All @@ -65,7 +68,7 @@ export function ChooseGraph({
style={{ flexGrow: 1 }}
data={data}
groupBy={groupBy}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
balanceTypeOp={balanceTypeOp}
/>
);
}
Expand All @@ -78,7 +81,7 @@ export function ChooseGraph({
style={{ flexGrow: 1 }}
data={data}
groupBy={groupBy}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
balanceTypeOp={balanceTypeOp}
/>
);
}
Expand Down Expand Up @@ -106,7 +109,7 @@ export function ChooseGraph({
data={data}
empty={showEmpty}
monthsCount={months.length}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
balanceTypeOp={balanceTypeOp}
mode={mode}
groupBy={groupBy}
/>
Expand All @@ -117,10 +120,12 @@ export function ChooseGraph({
scrollWidth={scrollWidth}
data={data}
mode={mode}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
balanceTypeOp={balanceTypeOp}
monthsCount={months.length}
/>
</View>
);
}
}

export default ChooseGraph;
39 changes: 39 additions & 0 deletions packages/desktop-client/src/components/reports/ModeButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React, { type MouseEventHandler, type ReactNode } from 'react';

import { type CSSProperties, theme } from '../../style';
import Button from '../common/Button';

type ModeButtonProps = {
selected: boolean;
children: ReactNode;
style: CSSProperties;
onSelect: MouseEventHandler<HTMLButtonElement>;
};

function ModeButton({ selected, children, style, onSelect }: ModeButtonProps) {
return (
<Button
type="bare"
style={{
padding: '5px 10px',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...(selected && {
backgroundColor: theme.buttonPrimaryBackground,
color: theme.buttonPrimaryText,
':hover': {
backgroundColor: theme.buttonPrimaryBackgroundHover,
color: theme.buttonPrimaryTextHover,
},
}),
...style,
}}
onClick={onSelect}
>
{children}
</Button>
);
}

export default ModeButton;
70 changes: 70 additions & 0 deletions packages/desktop-client/src/components/reports/ReportLegend.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import React from 'react';

import { theme, styles } from '../../style';
import Text from '../common/Text';
import View from '../common/View';

type ReportLegendProps = {
legend: Array<{ name: string; color: string }>;
groupBy: string;
};

function ReportLegend({ legend, groupBy }: ReportLegendProps) {
return (
<View
style={{
backgroundColor: theme.pageBackground,
alignItems: 'center',
flex: 1,
overflowY: 'auto',
}}
>
<Text
style={{
...styles.largeText,
alignItems: 'center',
marginBottom: 2,
fontWeight: 400,
paddingTop: 10,
}}
>
{groupBy}
</Text>
<View>
{legend.map(item => {
return (
<View
key={item.name}
style={{
padding: 10,
flexDirection: 'row',
alignItems: 'center',
}}
>
<View
style={{
marginRight: 5,
borderRadius: 1000,
width: 14,
height: 14,
backgroundColor: item.color,
}}
/>
<Text
style={{
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
flexShrink: 0,
}}
>
{item.name}
</Text>
</View>
);
})}
</View>
</View>
);
}

export default ReportLegend;
28 changes: 1 addition & 27 deletions packages/desktop-client/src/components/reports/ReportSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import * as monthUtils from 'loot-core/src/shared/months';

import { theme } from '../../style';
import Button from '../common/Button';
import Select from '../common/Select';
import Text from '../common/Text';
import View from '../common/View';
Expand All @@ -17,34 +16,9 @@ import {
getFullRange,
validateRange,
} from './Header';
import ModeButton from './ModeButton';
import { ReportOptions } from './ReportOptions';

function ModeButton({ selected, children, style, onSelect }) {
return (
<Button
type="bare"
style={{
padding: '5px 10px',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...(selected && {
backgroundColor: theme.buttonPrimaryBackground,
color: theme.buttonPrimaryText,
':hover': {
backgroundColor: theme.buttonPrimaryBackgroundHover,
color: theme.buttonPrimaryTextHover,
},
}),
...style,
}}
onClick={onSelect}
>
{children}
</Button>
);
}

export function ReportSidebar({
startDate,
endDate,
Expand Down
Loading

0 comments on commit ec6962a

Please sign in to comment.