Skip to content

Commit

Permalink
Merge branch 'master' into report-options-i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ammassey authored Dec 11, 2024
2 parents 8373a7c + 62d8358 commit c931026
Show file tree
Hide file tree
Showing 216 changed files with 1,213 additions and 314 deletions.
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.
6 changes: 3 additions & 3 deletions packages/desktop-client/e2e/accounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ test.describe('Accounts', () => {
await expect(page).toMatchThemeScreenshots();
});

test.describe('Budgeted Accounts', () => {
test.describe('On Budget Accounts', () => {
// Reset filters
test.afterEach(async () => {
await accountPage.removeFilter(0);
});

test('creates a transfer from two existing transactions', async () => {
accountPage = await navigation.goToAccountPage('For budget');
accountPage = await navigation.goToAccountPage('On budget');
await accountPage.waitFor();

await expect(accountPage.accountName).toHaveText('Budgeted Accounts');
await expect(accountPage.accountName).toHaveText('On Budget Accounts');

await accountPage.filterByNote('Test Acc Transfer');

Expand Down
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.
4 changes: 2 additions & 2 deletions packages/desktop-client/e2e/budget.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ test.describe('Budget', () => {
test('renders the summary information: available funds, overspent, budgeted and for next month', async () => {
const summary = budgetPage.budgetSummary.first();

await expect(summary.getByText('Available Funds')).toBeVisible({
await expect(summary.getByText('Available funds')).toBeVisible({
timeout: 10000,
});
await expect(summary.getByText(/^Overspent in /)).toBeVisible();
await expect(summary.getByText('Budgeted')).toBeVisible();
await expect(summary.getByText('For Next Month')).toBeVisible();
await expect(summary.getByText('For next month')).toBeVisible();
await expect(page).toMatchThemeScreenshots();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/e2e/page-models/mobile-budget-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class MobileBudgetPage {
name: 'Saved',
});
this.projectedSavingsButton = this.budgetTableHeader.getByRole('button', {
name: 'Projected Savings',
name: 'Projected savings',
});
this.overspentButton = this.budgetTableHeader.getByRole('button', {
name: 'Overspent',
Expand Down Expand Up @@ -294,7 +294,7 @@ export class MobileBudgetPage {
}

throw new Error(
'None of “Saved”, “Projected Savings”, or “Overspent” buttons could be located on the page',
'None of “Saved”, “Projected savings”, or “Overspent” buttons could be located on the page',
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/e2e/page-models/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class Navigation {
await this.page.getByLabel('Balance:').fill(String(data.balance));

if (data.offBudget) {
await this.page.getByLabel('Off-budget').click();
await this.page.getByLabel('Off budget').click();
}

await this.page
Expand Down
26 changes: 16 additions & 10 deletions packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @ts-strict-ignore
import React, { useState, useEffect, useRef, type CSSProperties } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { useDispatch, useSelector } from 'react-redux';

import { closeBudget, getUserData, signOut } from 'loot-core/client/actions';
import { type State } from 'loot-core/src/client/state-types';

import { useActions } from '../hooks/useActions';
import { useNavigate } from '../hooks/useNavigate';
import { theme, styles } from '../style';

Expand All @@ -27,22 +27,28 @@ export function LoggedInUser({
color,
}: LoggedInUserProps) {
const { t } = useTranslation();

const dispatch = useDispatch();
const navigate = useNavigate();
const userData = useSelector((state: State) => state.user.data);
const { getUserData, signOut, closeBudget } = useActions();
const [loading, setLoading] = useState(true);
const [menuOpen, setMenuOpen] = useState(false);
const serverUrl = useServerURL();
const triggerRef = useRef(null);

useEffect(() => {
getUserData().then(() => setLoading(false));
async function init() {
await dispatch(getUserData());
}

init().then(() => setLoading(false));
}, []);

const navigate = useNavigate();
async function onCloseBudget() {
await dispatch(closeBudget());
}

async function onChangePassword() {
await closeBudget();
await onCloseBudget();
navigate('/change-password');
}

Expand All @@ -54,14 +60,14 @@ export function LoggedInUser({
onChangePassword();
break;
case 'sign-in':
await closeBudget();
await onCloseBudget();
navigate('/login');
break;
case 'sign-out':
signOut();
dispatch(signOut());
break;
case 'config-server':
await closeBudget();
await onCloseBudget();
navigate('/config-server');
break;
default:
Expand Down
11 changes: 11 additions & 0 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { KeyboardShortcutModal } from './modals/KeyboardShortcutModal';
import { LoadBackupModal } from './modals/LoadBackupModal';
import { ConfirmChangeDocumentDirModal } from './modals/manager/ConfirmChangeDocumentDir';
import { DeleteFileModal } from './modals/manager/DeleteFileModal';
import { DuplicateFileModal } from './modals/manager/DuplicateFileModal';
import { FilesSettingsModal } from './modals/manager/FilesSettingsModal';
import { ImportActualModal } from './modals/manager/ImportActualModal';
import { ImportModal } from './modals/manager/ImportModal';
Expand Down Expand Up @@ -586,6 +587,16 @@ export function Modals() {
return <BudgetListModal key={name} />;
case 'delete-budget':
return <DeleteFileModal key={name} file={options.file} />;
case 'duplicate-budget':
return (
<DuplicateFileModal
key={name}
file={options.file}
managePage={options?.managePage}
loadBudget={options?.loadBudget}
onComplete={options?.onComplete}
/>
);
case 'import':
return <ImportModal key={name} />;
case 'files-settings':
Expand Down
14 changes: 8 additions & 6 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState, useEffect, type CSSProperties } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { useDispatch } from 'react-redux';
import { Routes, Route, useLocation } from 'react-router-dom';

import { css } from '@emotion/css';
import { t } from 'i18next';

import { sync } from 'loot-core/client/actions';
import * as Platform from 'loot-core/src/client/platform';
import * as queries from 'loot-core/src/client/queries';
import { listen } from 'loot-core/src/platform/client/fetch';
Expand All @@ -13,7 +15,6 @@ import {
isElectron,
} from 'loot-core/src/shared/environment';

import { useActions } from '../hooks/useActions';
import { useGlobalPref } from '../hooks/useGlobalPref';
import { useMetadataPref } from '../hooks/useMetadataPref';
import { useNavigate } from '../hooks/useNavigate';
Expand Down Expand Up @@ -108,8 +109,7 @@ type SyncButtonProps = {
};
function SyncButton({ style, isMobile = false }: SyncButtonProps) {
const [cloudFileId] = useMetadataPref('cloudFileId');
const { sync } = useActions();

const dispatch = useDispatch();
const [syncing, setSyncing] = useState(false);
const [syncState, setSyncState] = useState<
null | 'offline' | 'local' | 'disabled' | 'error'
Expand Down Expand Up @@ -193,15 +193,17 @@ function SyncButton({ style, isMobile = false }: SyncButtonProps) {
marginRight: 5,
};

const onSync = () => dispatch(sync());

useHotkeys(
'ctrl+s, cmd+s, meta+s',
sync,
onSync,
{
enableOnFormTags: true,
preventDefault: true,
scopes: ['app'],
},
[sync],
[onSync],
);

return (
Expand All @@ -223,7 +225,7 @@ function SyncButton({ style, isMobile = false }: SyncButtonProps) {
'&[data-hovered]': hoveredStyle,
'&[data-pressed]': activeStyle,
})}
onPress={sync}
onPress={onSync}
>
{isMobile ? (
syncState === 'error' ? (
Expand Down
21 changes: 13 additions & 8 deletions packages/desktop-client/src/components/UpdateNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { useSelector, useDispatch } from 'react-redux';

import { setAppState, updateApp } from 'loot-core/client/actions';
import { type State } from 'loot-core/src/client/state-types';

import { useActions } from '../hooks/useActions';
import { SvgClose } from '../icons/v1';
import { theme } from '../style';

Expand All @@ -20,7 +20,10 @@ export function UpdateNotification() {
(state: State) => state.app.showUpdateNotification,
);

const { updateApp, setAppState } = useActions();
const dispatch = useDispatch();
const onRestart = () => {
dispatch(updateApp());
};

if (updateInfo && showUpdateNotification) {
const notes = updateInfo.releaseNotes;
Expand Down Expand Up @@ -51,7 +54,7 @@ export function UpdateNotification() {
<Text>
<Link
variant="text"
onClick={updateApp}
onClick={onRestart}
style={{
color: theme.buttonPrimaryText,
textDecoration: 'underline',
Expand Down Expand Up @@ -81,10 +84,12 @@ export function UpdateNotification() {
style={{ display: 'inline', padding: '1px 7px 2px 7px' }}
onPress={() => {
// Set a flag to never show an update notification again for this session
setAppState({
updateInfo: null,
showUpdateNotification: false,
});
dispatch(
setAppState({
updateInfo: null,
showUpdateNotification: false,
}),
);
}}
>
<SvgClose
Expand Down
10 changes: 5 additions & 5 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function getField(field?: string) {
}

type AccountInternalProps = {
accountId?: AccountEntity['id'] | 'budgeted' | 'offbudget' | 'uncategorized';
accountId?: AccountEntity['id'] | 'onbudget' | 'offbudget' | 'uncategorized';
filterConditions: RuleConditionEntity[];
showBalances?: boolean;
setShowBalances: (newValue: boolean) => void;
Expand Down Expand Up @@ -841,8 +841,8 @@ class AccountInternal extends PureComponent<
}

if (!account) {
if (id === 'budgeted') {
return t('Budgeted Accounts');
if (id === 'onbudget') {
return t('On Budget Accounts');
} else if (id === 'offbudget') {
return t('Off Budget Accounts');
} else if (id === 'uncategorized') {
Expand Down Expand Up @@ -1662,7 +1662,7 @@ class AccountInternal extends PureComponent<

const isNameEditable =
accountId &&
accountId !== 'budgeted' &&
accountId !== 'onbudget' &&
accountId !== 'offbudget' &&
accountId !== 'uncategorized';

Expand Down Expand Up @@ -1767,7 +1767,7 @@ class AccountInternal extends PureComponent<
showAccount={
!accountId ||
accountId === 'offbudget' ||
accountId === 'budgeted' ||
accountId === 'onbudget' ||
accountId === 'uncategorized'
}
isAdding={this.state.isAdding}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ function AccountList({
item.closed
? t('Closed Accounts')
: item.offbudget
? t('Off Budget')
: t('For Budget')
? t('Off budget')
: t('On budget')
}`;

lastItem = item;
Expand Down
Loading

0 comments on commit c931026

Please sign in to comment.