Skip to content

Commit

Permalink
Merge branch 'master' into matiss/electron-app
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 7, 2024
2 parents 786561e + e0d82fd commit 34bcaf2
Show file tree
Hide file tree
Showing 765 changed files with 3,384 additions and 3,777 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ module.exports = {
'prefer-const': 'warn',
'prefer-spread': 'off',
'@typescript-eslint/no-empty-function': 'off',
'import/no-default-export': 'warn',
},
overrides: [
{
Expand Down Expand Up @@ -238,6 +239,15 @@ module.exports = {
'no-restricted-imports': ['off', { patterns: restrictedImportColors }],
},
},
{
files: [
'./packages/api/migrations/*',
'./packages/loot-core/migrations/*',
],
rules: {
'import/no-default-export': 'off',
},
},
],
settings: {
'import/resolver': {
Expand Down
2 changes: 1 addition & 1 deletion packages/api/app/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ class Query {
}
}

export default function q(table) {
export function q(table) {
return new Query({ table });
}
2 changes: 1 addition & 1 deletion packages/api/methods.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as injected from './injected';

export { default as q } from './app/query';
export { q } from './app/query';

function send(name, args) {
return injected.send(name, args);
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"watch": "cross-env BROWSER=none yarn start",
"build": "cross-env INLINE_RUNTIME_CHUNK=false craco build",
"build:browser": "cross-env ./bin/build-browser",
"generate:icons": "rm src/icons/*/*.tsx; cd src/icons && svgr --typescript --expand-props start -d . .",
"generate:icons": "rm src/icons/*/*.tsx; cd src/icons && svgr --template template.ts --index-template index-template.ts --typescript --expand-props start -d . .",
"test": "craco test",
"e2e": "npx playwright test --browser=chromium",
"vrt": "cross-env VRT=true npx playwright test --browser=chromium"
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ expect.extend({
},
});

// eslint-disable-next-line import/no-unused-modules
// eslint-disable-next-line import/no-unused-modules, import/no-default-export
export default defineConfig({
timeout: 20000, // 20 seconds
retries: 1,
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop-client/src/components/AnimatedRefresh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from 'react';

import { keyframes } from 'glamor';

import Refresh from '../icons/v1/Refresh';
import { SvgRefresh } from '../icons/v1';
import { type CSSProperties } from '../style';

import View from './common/View';
import { View } from './common/View';

const spin = keyframes({
'0%': { transform: 'rotateZ(0deg)' },
Expand All @@ -19,7 +19,7 @@ type AnimatedRefreshProps = {
height?: number;
};

export default function AnimatedRefresh({
export function AnimatedRefresh({
animating,
iconStyle,
width,
Expand All @@ -29,7 +29,7 @@ export default function AnimatedRefresh({
<View
style={{ animation: animating ? `${spin} 1s infinite linear` : null }}
>
<Refresh
<SvgRefresh
width={width ? width : 14}
height={height ? height : 14}
style={iconStyle}
Expand Down
30 changes: 14 additions & 16 deletions packages/desktop-client/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ import {
import { type GlobalPrefs } from 'loot-core/src/types/prefs';

import { useActions } from '../hooks/useActions';
import installPolyfills from '../polyfills';
import { installPolyfills } from '../polyfills';
import { ResponsiveProvider } from '../ResponsiveProvider';
import { styles, hasHiddenScrollbars, ThemeStyle } from '../style';

import AppBackground from './AppBackground';
import View from './common/View';
import DevelopmentTopBar from './DevelopmentTopBar';
import FatalError from './FatalError';
import FinancesApp from './FinancesApp';
import ManagementApp from './manager/ManagementApp';
import MobileWebMessage from './MobileWebMessage';
import UpdateNotification from './UpdateNotification';
import { AppBackground } from './AppBackground';
import { View } from './common/View';
import { DevelopmentTopBar } from './DevelopmentTopBar';
import { FatalError } from './FatalError';
import { FinancesApp } from './FinancesApp';
import { ManagementApp } from './manager/ManagementApp';
import { MobileWebMessage } from './MobileWebMessage';
import { UpdateNotification } from './UpdateNotification';

type AppProps = {
type AppInnerProps = {
budgetId: string;
cloudFileId: string;
loadingText: string;
Expand All @@ -40,14 +40,14 @@ type AppProps = {
loadGlobalPrefs: () => Promise<GlobalPrefs>;
};

function App({
function AppInner({
budgetId,
cloudFileId,
loadingText,
loadBudget,
closeBudget,
loadGlobalPrefs,
}: AppProps) {
}: AppInnerProps) {
const [initializing, setInitializing] = useState(true);
const { showBoundary: showErrorBoundary } = useErrorBoundary();

Expand Down Expand Up @@ -121,7 +121,7 @@ function ErrorFallback({ error }: FallbackProps) {
);
}

function AppWrapper() {
export function App() {
const budgetId = useSelector(
state => state.prefs.local && state.prefs.local.id,
);
Expand Down Expand Up @@ -178,7 +178,7 @@ function AppWrapper() {
{process.env.REACT_APP_REVIEW_ID && !Platform.isPlaywright && (
<DevelopmentTopBar />
)}
<App
<AppInner
budgetId={budgetId}
cloudFileId={cloudFileId}
loadingText={loadingText}
Expand All @@ -193,5 +193,3 @@ function AppWrapper() {
</ResponsiveProvider>
);
}

export default AppWrapper;
15 changes: 8 additions & 7 deletions packages/desktop-client/src/components/AppBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ import React from 'react';

import { css } from 'glamor';

import AnimatedLoading from '../icons/AnimatedLoading';
import { AnimatedLoading } from '../icons/AnimatedLoading';
import { theme } from '../style';

import Background from './Background';
import Block from './common/Block';
import View from './common/View';
import { Background } from './Background';
import { Block } from './common/Block';
import { View } from './common/View';

type AppBackgroundProps = {
initializing?: boolean;
loadingText?: string;
};

function AppBackground({ initializing, loadingText }: AppBackgroundProps) {
export function AppBackground({
initializing,
loadingText,
}: AppBackgroundProps) {
return (
<>
<Background />
Expand All @@ -41,5 +44,3 @@ function AppBackground({ initializing, loadingText }: AppBackgroundProps) {
</>
);
}

export default AppBackground;
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/Background.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { theme } from '../style';

import { LoadComponent } from './util/LoadComponent';

export default function Background() {
export function Background() {
return (
<div
style={{
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop-client/src/components/BankSyncStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { useTransition, animated } from 'react-spring';

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

import AnimatedRefresh from './AnimatedRefresh';
import Text from './common/Text';
import View from './common/View';
import { AnimatedRefresh } from './AnimatedRefresh';
import { Text } from './common/Text';
import { View } from './common/View';

export default function BankSyncStatus() {
export function BankSyncStatus() {
const accountsSyncing = useSelector(state => state.account.accountsSyncing);

const name = accountsSyncing
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/DevelopmentTopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { theme } from '../style';

import ExternalLink from './common/ExternalLink';
import View from './common/View';
import { ExternalLink } from './common/ExternalLink';
import { View } from './common/View';

export default function DevelopmentTopBar() {
export function DevelopmentTopBar() {
return (
<View
style={{
Expand Down
22 changes: 10 additions & 12 deletions packages/desktop-client/src/components/FatalError.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React, { useState } from 'react';

import Block from './common/Block';
import Button from './common/Button';
import ExternalLink from './common/ExternalLink';
import LinkButton from './common/LinkButton';
import Modal from './common/Modal';
import Paragraph from './common/Paragraph';
import Stack from './common/Stack';
import Text from './common/Text';
import View from './common/View';
import { Block } from './common/Block';
import { Button } from './common/Button';
import { ExternalLink } from './common/ExternalLink';
import { LinkButton } from './common/LinkButton';
import { Modal } from './common/Modal';
import { Paragraph } from './common/Paragraph';
import { Stack } from './common/Stack';
import { Text } from './common/Text';
import { View } from './common/View';
import { Checkbox } from './forms';

type AppError = Error & {
Expand Down Expand Up @@ -151,7 +151,7 @@ function SharedArrayBufferOverride() {
);
}

function FatalError({ buttonText, error }: FatalErrorProps) {
export function FatalError({ buttonText, error }: FatalErrorProps) {
const [showError, setShowError] = useState(false);

const showSimpleRender = 'type' in error && error.type === 'app-init-failure';
Expand Down Expand Up @@ -185,5 +185,3 @@ function FatalError({ buttonText, error }: FatalErrorProps) {
</Modal>
);
}

export default FatalError;
30 changes: 15 additions & 15 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import hotkeys from 'hotkeys-js';
import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts';
import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees';
import { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider';
import checkForUpdateNotification from 'loot-core/src/client/update-notification';
import { checkForUpdateNotification } from 'loot-core/src/client/update-notification';
import * as undo from 'loot-core/src/platform/client/undo';

import { useActions } from '../hooks/useActions';
Expand All @@ -25,21 +25,21 @@ import { theme } from '../style';
import { ExposeNavigate } from '../util/router-tools';
import { getIsOutdated, getLatestVersion } from '../util/versions';

import BankSyncStatus from './BankSyncStatus';
import { BankSyncStatus } from './BankSyncStatus';
import { BudgetMonthCountProvider } from './budget/BudgetMonthCountContext';
import View from './common/View';
import GlobalKeys from './GlobalKeys';
import { View } from './common/View';
import { GlobalKeys } from './GlobalKeys';
import { ManageRulesPage } from './ManageRulesPage';
import MobileNavTabs from './mobile/MobileNavTabs';
import Modals from './Modals';
import Notifications from './Notifications';
import { MobileNavTabs } from './mobile/MobileNavTabs';
import { Modals } from './Modals';
import { Notifications } from './Notifications';
import { ManagePayeesPage } from './payees/ManagePayeesPage';
import Reports from './reports';
import { Reports } from './reports';
import { NarrowAlternate, WideComponent } from './responsive';
import ScrollProvider from './ScrollProvider';
import Settings from './settings';
import FloatableSidebar, { SidebarProvider } from './sidebar';
import Titlebar, { TitlebarProvider } from './Titlebar';
import { ScrollProvider } from './ScrollProvider';
import { Settings } from './settings';
import { FloatableSidebar, SidebarProvider } from './sidebar';
import { Titlebar, TitlebarProvider } from './Titlebar';
import { TransactionEdit } from './transactions/MobileTransaction';

function NarrowNotSupported({
Expand Down Expand Up @@ -92,7 +92,7 @@ function RouterBehaviors({ getAccounts }) {
return null;
}

function FinancesApp() {
function FinancesAppWithoutContext() {
const actions = useActions();
useEffect(() => {
// The default key handler scope
Expand Down Expand Up @@ -256,8 +256,8 @@ function FinancesApp() {
);
}

export default function FinancesAppWithContext() {
const app = useMemo(() => <FinancesApp />, []);
export function FinancesApp() {
const app = useMemo(() => <FinancesAppWithoutContext />, []);

return (
<SpreadsheetProvider>
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/FixedSizeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import {

import memoizeOne from 'memoize-one';

import useResizeObserver from '../hooks/useResizeObserver';
import { useResizeObserver } from '../hooks/useResizeObserver';
import { type CSSProperties } from '../style';

import View from './common/View';
import { View } from './common/View';

const IS_SCROLLING_DEBOUNCE_INTERVAL = 150;

Expand Down Expand Up @@ -73,7 +73,7 @@ type FixedSizeListState = {
scrollUpdateWasRequested: boolean;
};

export default class FixedSizeList extends PureComponent<
export class FixedSizeList extends PureComponent<
FixedSizeListProps,
FixedSizeListState
> {
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/GlobalKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useEffect } from 'react';

import * as Platform from 'loot-core/src/client/platform';

import useNavigate from '../hooks/useNavigate';
import { useNavigate } from '../hooks/useNavigate';

export default function GlobalKeys() {
export function GlobalKeys() {
const navigate = useNavigate();
useEffect(() => {
const handleKeys = e => {
Expand Down
10 changes: 5 additions & 5 deletions packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { useSelector } from 'react-redux';
import { useActions } from '../hooks/useActions';
import { theme, styles, type CSSProperties } from '../style';

import Button from './common/Button';
import Menu from './common/Menu';
import Text from './common/Text';
import View from './common/View';
import { Button } from './common/Button';
import { Menu } from './common/Menu';
import { Text } from './common/Text';
import { View } from './common/View';
import { useServerURL } from './ServerContext';
import { Tooltip } from './tooltips';

Expand All @@ -16,7 +16,7 @@ type LoggedInUserProps = {
style?: CSSProperties;
color?: string;
};
export default function LoggedInUser({
export function LoggedInUser({
hideIfNoServer,
style,
color,
Expand Down
Loading

0 comments on commit 34bcaf2

Please sign in to comment.