Skip to content

A local-first personal finance app

Consolidate Link props (#2558)

Neild6de90a29611
diff --git a/.eslintrc.js b/.eslintrc.js
index 6762550f27..9653190ca8 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -146,10 +146,9 @@ module.exports = {
'Using default React import is discouraged, please use named exports directly instead.',
},
{
- // forbid <a> in favor of <LinkButton> or <ExternalLink>
+ // forbid <a> in favor of <Link>
selector: 'JSXOpeningElement[name.name="a"]',
- message:
- 'Using <a> is discouraged, please use <LinkButton> or <ExternalLink> instead.',
+ message: 'Using <a> is discouraged, please use <Link> instead.',
},
],
'no-restricted-imports': [
diff --git a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png
index da70b55ce6..a2e2fc3f1b 100644
Binary files a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png and b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png
index 30a6643451..6240ae33bc 100644
Binary files a/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png and b/packages/desktop-client/e2e/accounts.test.js-snapshots/Accounts-closes-an-account-2-chromium-linux.png differ
diff --git a/packages/desktop-client/src/components/DevelopmentTopBar.tsx b/packages/desktop-client/src/components/DevelopmentTopBar.tsx
index 768422df11..c92375a402 100644
--- a/packages/desktop-client/src/components/DevelopmentTopBar.tsx
+++ b/packages/desktop-client/src/components/DevelopmentTopBar.tsx
@@ -1,6 +1,6 @@
import { theme } from '../style';
-import { ExternalLink } from './common/ExternalLink';
+import { Link } from './common/Link';
import { View } from './common/View';
export function DevelopmentTopBar() {
@@ -20,12 +20,13 @@ export function DevelopmentTopBar() {
>
<View>This is a demo build of Actual.</View>
<View>
- <ExternalLink
+ <Link
+ variant="external"
linkColor="purple"
to={`https://github.com/actualbudget/actual/pull/${process.env.REACT_APP_REVIEW_ID}`}
>
Open the PR: #{process.env.REACT_APP_REVIEW_ID}
- </ExternalLink>
+ </Link>
</View>
</View>
);
diff --git a/packages/desktop-client/src/components/FatalError.tsx b/packages/desktop-client/src/components/FatalError.tsx
index 9b96ba0fe5..6613cd536a 100644
--- a/packages/desktop-client/src/components/FatalError.tsx
+++ b/packages/desktop-client/src/components/FatalError.tsx
@@ -3,8 +3,7 @@ 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 { Link } from './common/Link';
import { Modal } from './common/Modal';
import { Paragraph } from './common/Paragraph';
import { Stack } from './common/Stack';
@@ -50,12 +49,13 @@ function RenderSimple({ error }: RenderSimpleProps) {
function properly. If you’re seeing this error, either your browser does
not support <code>SharedArrayBuffer</code>, or your server is not
sending the appropriate headers, or you are not using HTTPS. See{' '}
- <ExternalLink
+ <Link
+ variant="external"
linkColor="muted"
to="https://actualbudget.org/docs/troubleshooting/shared-array-buffer"
>
our troubleshooting documentation
- </ExternalLink>{' '}
+ </Link>{' '}
to learn more. <SharedArrayBufferOverride />
</Text>
);
@@ -67,12 +67,13 @@ function RenderSimple({ error }: RenderSimpleProps) {
<Text>
There was a problem loading the app in this browser version. If this
continues to be a problem, you can{' '}
- <ExternalLink
+ <Link
+ variant="external"
linkColor="muted"
to="https://github.com/actualbudget/releases"
>
download the desktop app
- </ExternalLink>
+ </Link>
.
</Text>
);
@@ -89,9 +90,13 @@ function RenderSimple({ error }: RenderSimpleProps) {
<Text>{msg}</Text>
<Text>
Please get{' '}
- <ExternalLink linkColor="muted" to="https://actualbudget.org/contact">
+ <Link
+ variant="external"
+ linkColor="muted"
+ to="https://actualbudget.org/contact"
+ >
in touch
- </ExternalLink>{' '}
+ </Link>{' '}
for support
</Text>
</Stack>
@@ -104,9 +109,9 @@ function RenderUIError() {
<Paragraph>There was an unrecoverable error in the UI. Sorry!</Paragraph>
<Paragraph>
If this error persists, please get{' '}
- <ExternalLink to="https://actualbudget.org/contact">
+ <Link variant="external" to="https://actualbudget.org/contact">
in touch
- </ExternalLink>{' '}
+ </Link>{' '}
so it can be investigated.
</Paragraph>
</>
@@ -146,9 +151,13 @@ function SharedArrayBufferOverride() {
</Button>
</>
) : (
- <LinkButton onClick={() => setExpanded(true)} style={{ marginLeft: 5 }}>
+ <Link
+ variant="text"
+ onClick={() => setExpanded(true)}
+ style={{ marginLeft: 5 }}
+ >
Advanced options
- </LinkButton>
+ </Link>
);
}
@@ -171,7 +180,9 @@ export function FatalError({ buttonText, error }: FatalErrorProps) {
</Button>
</Paragraph>
<Paragraph isLast={true} style={{ fontSize: 11 }}>
- <LinkButton onClick={() => setShowError(true)}>Show Error</LinkButton>
+ <Link variant="text" onClick={() => setShowError(true)}>
+ Show Error
+ </Link>
{showError && (
<Block
style={{
diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx
index 2459fcb44a..d48c6a0804 100644
--- a/packages/desktop-client/src/components/ManageRules.tsx
+++ b/packages/desktop-client/src/components/ManageRules.tsx
@@ -24,7 +24,7 @@ import { useSelected, SelectedProvider } from '../hooks/useSelected';
import { theme } from '../style';
import { Button } from './common/Button';
-import { ExternalLink } from './common/ExternalLink';
+import { Link } from './common/Link';
import { Search } from './common/Search';
import { Stack } from './common/Stack';
import { Text } from './common/Text';
@@ -267,12 +267,13 @@ function ManageRulesContent({
>
<Text>
Rules are always run in the order that you see them.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/budgeting/rules/"
linkColor="muted"
>
Learn more
- </ExternalLink>
+ </Link>
</Text>
</View>
<View style={{ flex: 1 }} />
diff --git a/packages/desktop-client/src/components/Notifications.tsx b/packages/desktop-client/src/components/Notifications.tsx
index 290b3ae7c9..6acb901fc2 100644
--- a/packages/desktop-client/src/components/Notifications.tsx
+++ b/packages/desktop-client/src/components/Notifications.tsx
@@ -16,8 +16,7 @@ import { SvgDelete } from '../icons/v0';
import { styles, theme, type CSSProperties } from '../style';
import { Button, ButtonWithLoading } from './common/Button';
-import { ExternalLink } from './common/ExternalLink';
-import { LinkButton } from './common/LinkButton';
+import { Link } from './common/Link';
import { Stack } from './common/Stack';
import { Text } from './common/Text';
import { View } from './common/View';
@@ -43,7 +42,8 @@ function compileMessage(
if (href[0] === '#') {
const actionName = href.slice(1);
return (
- <LinkButton
+ <Link
+ variant="text"
key={idx}
onClick={async e => {
e.preventDefault();
@@ -55,14 +55,19 @@ function compileMessage(
}}
>
{text}
- </LinkButton>
+ </Link>
);
}
return (
- <ExternalLink linkColor="purple" key={idx} to={match[2]}>
+ <Link
+ variant="external"
+ linkColor="purple"
+ key={idx}
+ to={match[2]}
+ >
{match[1]}
- </ExternalLink>
+ </Link>
);
}
return <Text key={idx}>{part}</Text>;
diff --git a/packages/desktop-client/src/components/Titlebar.tsx b/packages/desktop-client/src/components/Titlebar.tsx
index ad7e20ef6a..1d91cbc247 100644
--- a/packages/desktop-client/src/components/Titlebar.tsx
+++ b/packages/desktop-client/src/components/Titlebar.tsx
@@ -33,7 +33,6 @@ import { AccountSyncCheck } from './accounts/AccountSyncCheck';
import { AnimatedRefresh } from './AnimatedRefresh';
import { MonthCountSelector } from './budget/MonthCountSelector';
import { Button, ButtonWithLoading } from './common/Button';
-import { ExternalLink } from './common/ExternalLink';
import { Link } from './common/Link';
import { Paragraph } from './common/Paragraph';
import { Text } from './common/Text';
@@ -364,12 +363,13 @@ function BudgetTitlebar() {
</ButtonWithLoading>
</Paragraph>
<Paragraph isLast={true}>
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/experimental/report-budget"
linkColor="muted"
>
How do these types of budgeting work?
- </ExternalLink>
+ </Link>
</Paragraph>
</Tooltip>
)}
diff --git a/packages/desktop-client/src/components/UpdateNotification.tsx b/packages/desktop-client/src/components/UpdateNotification.tsx
index f705250288..2ce4831e24 100644
--- a/packages/desktop-client/src/components/UpdateNotification.tsx
+++ b/packages/desktop-client/src/components/UpdateNotification.tsx
@@ -8,7 +8,7 @@ import { SvgClose } from '../icons/v1';
import { theme } from '../style';
import { Button } from './common/Button';
-import { LinkButton } from './common/LinkButton';
+import { Link } from './common/Link';
import { Text } from './common/Text';
import { View } from './common/View';
@@ -45,7 +45,8 @@ export function UpdateNotification() {
<View style={{ flex: 1 }} />
<View style={{ marginTop: -1 }}>
<Text>
- <LinkButton
+ <Link
+ variant="text"
onClick={updateApp}
style={{
color: theme.buttonPrimaryText,
@@ -53,9 +54,10 @@ export function UpdateNotification() {
}}
>
Restart
- </LinkButton>{' '}
+ </Link>{' '}
(
- <LinkButton
+ <Link
+ variant="text"
style={{
color: theme.buttonPrimaryText,
textDecoration: 'underline',
@@ -67,7 +69,7 @@ export function UpdateNotification() {
}
>
notes
- </LinkButton>
+ </Link>
)
<Button
type="bare"
diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx b/packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx
index 09180381df..f253a51f16 100644
--- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx
+++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.jsx
@@ -8,7 +8,7 @@ import { useActions } from '../../hooks/useActions';
import { SvgExclamationOutline } from '../../icons/v1';
import { theme } from '../../style';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { View } from '../common/View';
import { Tooltip } from '../tooltips';
@@ -41,9 +41,9 @@ function getErrorMessage(type, code) {
return (
<>
An internal error occurred. Try to login again, or get{' '}
- <ExternalLink to="https://actualbudget.org/contact/">
+ <Link variant="external" to="https://actualbudget.org/contact/">
in touch
- </ExternalLink>{' '}
+ </Link>{' '}
for support.
</>
);
diff --git a/packages/desktop-client/src/components/common/AnchorLink.tsx b/packages/desktop-client/src/components/common/AnchorLink.tsx
deleted file mode 100644
index ed596b00d2..0000000000
--- a/packages/desktop-client/src/components/common/AnchorLink.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { type ReactNode } from 'react';
-import { NavLink, useMatch } from 'react-router-dom';
-
-import { css } from 'glamor';
-
-import { type CustomReportEntity } from 'loot-core/src/types/models';
-
-import { type CSSProperties, styles } from '../../style';
-
-type AnchorLinkProps = {
- to: string;
- style?: CSSProperties;
- activeStyle?: CSSProperties;
- children?: ReactNode;
- report?: CustomReportEntity;
-};
-
-export function AnchorLink({
- to,
- style,
- activeStyle,
- children,
- report,
-}: AnchorLinkProps) {
- const match = useMatch({ path: to });
-
- return (
- <NavLink
- to={to}
- state={report ? { report } : {}}
- className={`${css([
- styles.smallText,
- style,
- match ? activeStyle : null,
- ])}`}
- >
- {children}
- </NavLink>
- );
-}
diff --git a/packages/desktop-client/src/components/common/Button.tsx b/packages/desktop-client/src/components/common/Button.tsx
index 1c738eb7fd..c7a4233975 100644
--- a/packages/desktop-client/src/components/common/Button.tsx
+++ b/packages/desktop-client/src/components/common/Button.tsx
@@ -22,13 +22,7 @@ type ButtonProps = HTMLProps<HTMLButtonElement> & {
as?: ElementType;
};
-type ButtonType =
- | 'normal'
- | 'primary'
- | 'bare'
- | 'link'
- | 'menu'
- | 'menuSelected';
+type ButtonType = 'normal' | 'primary' | 'bare' | 'menu' | 'menuSelected';
const backgroundColor: {
[key in ButtonType | `${ButtonType}Disabled`]?: string;
@@ -41,7 +35,6 @@ const backgroundColor: {
bareDisabled: theme.buttonBareDisabledBackground,
menu: theme.buttonMenuBackground,
menuSelected: theme.buttonMenuSelectedBackground,
- link: theme.buttonBareBackground,
};
const backgroundColorHover: Record<ButtonType, string> = {
@@ -50,7 +43,6 @@ const backgroundColorHover: Record<ButtonType, string> = {
bare: theme.buttonBareBackgroundHover,
menu: theme.buttonMenuBackgroundHover,
menuSelected: theme.buttonMenuSelectedBackgroundHover,
- link: theme.buttonBareBackground,
};
const borderColor: {
@@ -62,7 +54,6 @@ const borderColor: {
primaryDisabled: theme.buttonPrimaryDisabledBorder,
menu: theme.buttonMenuBorder,
menuSelected: theme.buttonMenuSelectedBorder,
- link: theme.buttonBareBackground,
};
const textColor: {
@@ -76,7 +67,6 @@ const textColor: {
bareDisabled: theme.buttonBareDisabledText,
menu: theme.buttonMenuText,
menuSelected: theme.buttonMenuSelectedText,
- link: theme.pageTextLink,
};
const textColorHover: {
@@ -89,18 +79,12 @@ const textColorHover: {
menuSelected: theme.buttonMenuSelectedTextHover,
};
-const linkButtonHoverStyles = {
- textDecoration: 'underline',
- boxShadow: 'none',
-};
-
const _getBorder = (
type: ButtonType,
typeWithDisabled: keyof typeof borderColor,
): string => {
switch (type) {
case 'bare':
- case 'link':
return 'none';
default:
@@ -112,8 +96,6 @@ const _getPadding = (type: ButtonType): string => {
switch (type) {
case 'bare':
return '5px';
- case 'link':
- return '0';
default:
return '5px 10px';
}
@@ -123,11 +105,6 @@ const _getActiveStyles = (type: ButtonType, bounce: boolean): CSSProperties => {
switch (type) {
case 'bare':
return { backgroundColor: theme.buttonBareBackgroundActive };
- case 'link':
- return {
- transform: 'none',
- boxShadow: 'none',
- };
default:
return {
transform: bounce ? 'translateY(1px)' : undefined,
@@ -166,7 +143,6 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
hoveredStyle = {
...(type !== 'bare' && styles.shadow),
- ...(type === 'link' && linkButtonHoverStyles),
backgroundColor: backgroundColorHover[type],
color: color || textColorHover[type],
...hoveredStyle,
@@ -184,7 +160,7 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
padding: _getPadding(type),
margin: 0,
overflow: 'hidden',
- display: type === 'link' ? 'inline' : 'flex',
+ display: 'flex',
borderRadius: 4,
backgroundColor: backgroundColor[typeWithDisabled],
border: _getBorder(type, typeWithDisabled),
diff --git a/packages/desktop-client/src/components/common/ButtonLink.tsx b/packages/desktop-client/src/components/common/ButtonLink.tsx
deleted file mode 100644
index fde95935d1..0000000000
--- a/packages/desktop-client/src/components/common/ButtonLink.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React, { type ComponentProps } from 'react';
-import { useMatch } from 'react-router-dom';
-
-import { useNavigate } from '../../hooks/useNavigate';
-import { type CSSProperties } from '../../style';
-
-import { Button } from './Button';
-
-type ButtonLinkProps = ComponentProps<typeof Button> & {
- to: string;
- activeStyle?: CSSProperties;
-};
-export function ButtonLink({
- to,
- style,
- activeStyle,
- ...props
-}: ButtonLinkProps) {
- const navigate = useNavigate();
- const match = useMatch({ path: to });
- return (
- <Button
- style={{
- ...style,
- ...(match ? activeStyle : {}),
- }}
- activeStyle={activeStyle}
- {...props}
- onClick={e => {
- props.onClick?.(e);
- navigate(to);
- }}
- />
- );
-}
diff --git a/packages/desktop-client/src/components/common/ExternalLink.tsx b/packages/desktop-client/src/components/common/ExternalLink.tsx
deleted file mode 100644
index 5dbb9c94ce..0000000000
--- a/packages/desktop-client/src/components/common/ExternalLink.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-import React, { type ReactNode, forwardRef } from 'react';
-
-import { theme } from '../../style';
-
-const externalLinkColors = {
- purple: theme.pageTextPositive,
- blue: theme.pageTextLink,
- muted: 'inherit',
-};
-type ExternalLinkProps = {
- children?: ReactNode;
- to: string;
- linkColor?: keyof typeof externalLinkColors;
-};
-
-export const ExternalLink = forwardRef<HTMLAnchorElement, ExternalLinkProps>(
- ({ children, to, linkColor = 'blue' }, ref) => (
- // we can’t use <ExternalLink /> here for obvious reasons
- // eslint-disable-next-line no-restricted-syntax
- <a
- ref={ref}
- href={to}
- target="_blank"
- rel="noopener noreferrer"
- style={{ color: externalLinkColors[linkColor] }}
- >
- {children}
- </a>
- ),
-);
-
-ExternalLink.displayName = 'ExternalLink';
diff --git a/packages/desktop-client/src/components/common/Link.tsx b/packages/desktop-client/src/components/common/Link.tsx
index 91364f1c10..d624bdaf68 100644
--- a/packages/desktop-client/src/components/common/Link.tsx
+++ b/packages/desktop-client/src/components/common/Link.tsx
@@ -1,44 +1,97 @@
import React, {
+ type MouseEventHandler,
type ComponentProps,
- type MouseEvent,
type ReactNode,
} from 'react';
import { NavLink, useMatch } from 'react-router-dom';
import { css } from 'glamor';
+import { type CustomReportEntity } from 'loot-core/types/models/reports';
+
import { useNavigate } from '../../hooks/useNavigate';
import { type CSSProperties, styles } from '../../style';
+import { theme } from '../../style/theme';
import { Button } from './Button';
+import { Text } from './Text';
+
+type TextLinkProps = {
+ style?: CSSProperties;
+ onClick?: MouseEventHandler;
+ children?: ReactNode;
+};
type ButtonLinkProps = ComponentProps<typeof Button> & {
- to: string;
+ to?: string;
activeStyle?: CSSProperties;
};
-type AnchorLinkProps = {
- to: string;
+type InternalLinkProps = {
+ to?: string;
style?: CSSProperties;
activeStyle?: CSSProperties;
children?: ReactNode;
+ report?: CustomReportEntity;
};
-const ButtonLink = ({
+const externalLinkColors = {
+ purple: theme.pageTextPositive,
+ blue: theme.pageTextLink,
+ muted: 'inherit',
+};
+
+type ExternalLinkProps = {
+ children?: ReactNode;
+ to?: string;
+ linkColor?: keyof typeof externalLinkColors;
+};
+
+const ExternalLink = ({
+ children,
to,
- style,
- activeStyle,
- onClick,
- ...props
-}: ButtonLinkProps) => {
- const navigate = useNavigate();
- const match = useMatch({ path: to });
+ linkColor = 'blue',
+}: ExternalLinkProps) => {
+ return (
+ // we can’t use <ExternalLink /> here for obvious reasons
+ // eslint-disable-next-line no-restricted-syntax
+ <a
+ href={to ?? ''}
+ target="_blank"
+ rel="noopener noreferrer"
+ style={{ color: externalLinkColors[linkColor] }}
+ >
+ {children}
+ </a>
+ );
+};
- const handleClick = (e: MouseEvent<HTMLButtonElement>) => {
- onClick?.(e);
- navigate(to);
- };
+const TextLink = ({ style, onClick, children, ...props }: TextLinkProps) => {
+ return (
+ <Text
+ style={{
+ backgroundColor: 'transparent',
+ display: 'inline',
+ border: 0,
+ cursor: 'pointer',
+ ':hover': {
+ textDecoration: 'underline',
+ boxShadow: 'none',
+ },
+ ...style,
+ }}
+ {...props}
+ onClick={onClick}
+ >
+ {children}
+ </Text>
+ );
+};
+const ButtonLink = ({ to, style, activeStyle, ...props }: ButtonLinkProps) => {
+ const navigate = useNavigate();
+ const path = to ?? '';
+ const match = useMatch({ path });
return (
<Button
style={{
@@ -47,17 +100,28 @@ const ButtonLink = ({
}}
activeStyle={activeStyle}
{...props}
- onClick={handleClick}
+ onClick={e => {
+ props.onClick?.(e);
+ navigate(path);
+ }}
/>
);
};
-const AnchorLink = ({ to, style, activeStyle, children }: AnchorLinkProps) => {
- const match = useMatch({ path: to });
+const InternalLink = ({
+ to,
+ style,
+ activeStyle,
+ children,
+ report,
+}: InternalLinkProps) => {
+ const path = to ?? '';
+ const match = useMatch({ path });
return (
<NavLink
- to={to}
+ to={path}
+ state={report ? { report } : {}}
className={`${css([
styles.smallText,
style,
@@ -73,16 +137,24 @@ type LinkProps =
| ({
variant: 'button';
} & ButtonLinkProps)
- | ({ variant?: 'anchor' } & AnchorLinkProps);
+ | ({ variant?: 'internal' } & InternalLinkProps)
+ | ({ variant?: 'external' } & ExternalLinkProps)
+ | ({ variant?: 'text' } & TextLinkProps);
-export function Link({ variant = 'anchor', ...props }: LinkProps) {
+export function Link({ variant = 'internal', ...props }: LinkProps) {
switch (variant) {
- case 'anchor':
- return <AnchorLink {...props} />;
+ case 'internal':
+ return <InternalLink {...props} />;
+
+ case 'external':
+ return <ExternalLink {...props} />;
case 'button':
return <ButtonLink {...props} />;
+ case 'text':
+ return <TextLink {...props} />;
+
default:
throw new Error(`Unrecognised link type: ${variant}`);
}
diff --git a/packages/desktop-client/src/components/common/LinkButton.tsx b/packages/desktop-client/src/components/common/LinkButton.tsx
deleted file mode 100644
index daec85d684..0000000000
--- a/packages/desktop-client/src/components/common/LinkButton.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import React, { type HTMLAttributes } from 'react';
-
-import { css } from 'glamor';
-
-import { styles, theme } from '../../style';
-
-type LinkProps = HTMLAttributes<HTMLButtonElement>;
-
-export function LinkButton({ style, children, ...nativeProps }: LinkProps) {
- return (
- <button
- type="button"
- className={`${css([
- {
- textDecoration: 'none',
- color: theme.pageTextLink,
- backgroundColor: 'transparent',
- display: 'inline',
- border: 0,
- cursor: 'pointer',
- padding: 0,
- font: 'inherit',
- ':hover': {
- textDecoration: 'underline',
- boxShadow: 'none',
- },
- ':focus': {
- boxShadow: 'none',
- },
- },
- styles.smallText,
- style,
- ])}`}
- {...nativeProps}
- >
- {children}
- </button>
- );
-}
diff --git a/packages/desktop-client/src/components/manager/ImportYNAB5.tsx b/packages/desktop-client/src/components/manager/ImportYNAB5.tsx
index 0a775c1fb2..da108febd9 100644
--- a/packages/desktop-client/src/components/manager/ImportYNAB5.tsx
+++ b/packages/desktop-client/src/components/manager/ImportYNAB5.tsx
@@ -7,7 +7,7 @@ import { importBudget } from 'loot-core/src/client/actions/budgets';
import { styles, theme } from '../../style';
import { Block } from '../common/Block';
import { ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { Modal, type ModalProps } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { View } from '../common/View';
@@ -64,9 +64,12 @@ export function ImportYNAB5({ modalProps }: ImportProps) {
style={{ alignItems: 'center', '& > div': { lineHeight: '1.7em' } }}
>
<Paragraph>
- <ExternalLink to="https://actualbudget.org/docs/migration/nynab">
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/migration/nynab"
+ >
Read here
- </ExternalLink>{' '}
+ </Link>{' '}
for instructions on how to migrate your data from YNAB. You need
to export your data as JSON, and that page explains how to do
that.
diff --git a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
index 9d13d9dd24..ce72529ec5 100644
--- a/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
+++ b/packages/desktop-client/src/components/manager/WelcomeScreen.tsx
@@ -3,7 +3,7 @@ import React from 'react';
import { useActions } from '../../hooks/useActions';
import { styles, theme } from '../../style';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
import { View } from '../common/View';
@@ -32,19 +32,21 @@ export function WelcomeScreen() {
</Paragraph>
<Paragraph>
Currently, Actual implements budgeting based on a{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/budgeting/"
linkColor="purple"
>
monthly envelope system
- </ExternalLink>
+ </Link>
. Consider taking our{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/tour/"
linkColor="purple"
>
guided tour
- </ExternalLink>{' '}
+ </Link>{' '}
to help you get your bearings, and check out the rest of the
documentation while you’re there to learn more about advanced topics.
</Paragraph>
diff --git a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
index 687c4bb2a0..aa74720807 100644
--- a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
+++ b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
@@ -8,7 +8,7 @@ import { send } from 'loot-core/src/platform/client/fetch';
import { theme } from '../../../style';
import { Button } from '../../common/Button';
-import { ExternalLink } from '../../common/ExternalLink';
+import { Link } from '../../common/Link';
import { Paragraph } from '../../common/Paragraph';
import { Text } from '../../common/Text';
import { View } from '../../common/View';
@@ -64,9 +64,9 @@ export function Bootstrap() {
<Paragraph isLast style={{ fontSize: 16, color: theme.pageTextDark }}>
Consider opening{' '}
- <ExternalLink to="https://actualbudget.org/docs/tour/">
+ <Link variant="external" to="https://actualbudget.org/docs/tour/">
our tour
- </ExternalLink>{' '}
+ </Link>{' '}
in a new tab for some guidance on what to do when you’ve set your
password.
</Paragraph>
diff --git a/packages/desktop-client/src/components/mobile/accounts/AccountDetails.jsx b/packages/desktop-client/src/components/mobile/accounts/AccountDetails.jsx
index be92e97ffa..ad653191a3 100644
--- a/packages/desktop-client/src/components/mobile/accounts/AccountDetails.jsx
+++ b/packages/desktop-client/src/components/mobile/accounts/AccountDetails.jsx
@@ -13,9 +13,9 @@ import { send } from 'loot-core/platform/client/fetch';
import { SvgAdd } from '../../../icons/v1';
import { SvgSearchAlternate } from '../../../icons/v2';
import { styles, theme } from '../../../style';
-import { ButtonLink } from '../../common/ButtonLink';
import { InputWithContent } from '../../common/InputWithContent';
import { Label } from '../../common/Label';
+import { Link } from '../../common/Link';
import { Text } from '../../common/Text';
import { View } from '../../common/View';
import { MobileBackButton } from '../../MobileBackButton';
@@ -174,7 +174,8 @@ export function AccountDetails({
}
headerLeftContent={<MobileBackButton />}
headerRightContent={
- <ButtonLink
+ <Link
+ variant="button"
to="transactions/new"
type="bare"
aria-label="Add Transaction"
@@ -190,7 +191,7 @@ export function AccountDetails({
activeStyle={{ background: 'transparent' }}
>
<SvgAdd width={20} height={20} />
- </ButtonLink>
+ </Link>
}
padding={0}
style={{
diff --git a/packages/desktop-client/src/components/modals/CloseAccountModal.tsx b/packages/desktop-client/src/components/modals/CloseAccountModal.tsx
index aa71110c21..fb9d8411f4 100644
--- a/packages/desktop-client/src/components/modals/CloseAccountModal.tsx
+++ b/packages/desktop-client/src/components/modals/CloseAccountModal.tsx
@@ -18,7 +18,7 @@ import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';
import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';
import { Button } from '../common/Button';
import { FormError } from '../common/FormError';
-import { LinkButton } from '../common/LinkButton';
+import { Link } from '../common/Link';
import { Modal } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
@@ -218,7 +218,8 @@ export function CloseAccountModal({
<View style={{ marginBottom: 15 }}>
<Text style={{ fontSize: 12 }}>
You can also{' '}
- <LinkButton
+ <Link
+ variant="text"
onClick={() => {
setLoading(true);
@@ -228,7 +229,7 @@ export function CloseAccountModal({
style={{ color: theme.errorText }}
>
force close
- </LinkButton>{' '}
+ </Link>{' '}
the account which will delete it and all its transactions
permanently. Doing so may change your budget unexpectedly
since money in it may vanish.
diff --git a/packages/desktop-client/src/components/modals/CreateAccount.tsx b/packages/desktop-client/src/components/modals/CreateAccount.tsx
index 994717e1be..ae035dae49 100644
--- a/packages/desktop-client/src/components/modals/CreateAccount.tsx
+++ b/packages/desktop-client/src/components/modals/CreateAccount.tsx
@@ -11,7 +11,7 @@ import { useSimpleFinStatus } from '../../hooks/useSimpleFinStatus';
import { type SyncServerStatus } from '../../hooks/useSyncServerStatus';
import { theme } from '../../style';
import { Button, ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { Modal } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
@@ -149,12 +149,13 @@ export function CreateAccount({
<Text>
<strong>Create a local account</strong> if you want to add
transactions manually. You can also{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/transactions/importing"
linkColor="muted"
>
import QIF/OFX/QFX files into a local account
- </ExternalLink>
+ </Link>
.
</Text>
</View>
@@ -226,12 +227,13 @@ export function CreateAccount({
</Button>
<Paragraph style={{ fontSize: 15 }}>
Connect to an Actual server to set up{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/advanced/bank-sync"
linkColor="muted"
>
automatic syncing.
- </ExternalLink>
+ </Link>
.
</Paragraph>
</>
diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
index 4bc9414cf1..1e9c5f74d5 100644
--- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx
@@ -9,9 +9,9 @@ import { getCreateKeyError } from 'loot-core/src/shared/errors';
import { type BoundActions } from '../../hooks/useActions';
import { theme } from '../../style';
import { ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { InitialFocus } from '../common/InitialFocus';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Modal, ModalButtons } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
@@ -75,12 +75,13 @@ export function CreateEncryptionKey({
will generate a key based on a password and use it to encrypt
from now on. <strong>This requires a sync reset</strong> and all
other devices will have to revert to this version of your data.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
linkColor="purple"
>
Learn more
- </ExternalLink>
+ </Link>
</Paragraph>
<Paragraph>
<ul
@@ -119,12 +120,13 @@ export function CreateEncryptionKey({
<strong>This requires a sync reset</strong> and all other
devices will have to revert to this version of your data. Actual
will take you through that process on those devices.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
linkColor="purple"
>
Learn more
- </ExternalLink>
+ </Link>
</Paragraph>
<Paragraph>
Key generation is randomized. The same password will create
diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx
index 010676c758..00dd36e108 100644
--- a/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx
+++ b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx
@@ -7,11 +7,11 @@ import { type BoundActions } from '../../hooks/useActions';
import { useNavigate } from '../../hooks/useNavigate';
import { theme } from '../../style';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { FormError } from '../common/FormError';
import { InitialFocus } from '../common/InitialFocus';
import { InlineField } from '../common/InlineField';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Modal, ModalButtons } from '../common/Modal';
import { Text } from '../common/Text';
import { View } from '../common/View';
@@ -124,12 +124,13 @@ export function CreateLocalAccount({
<Text>
This cannot be changed later. <br /> {'\n'}
See{' '}
- <ExternalLink
+ <Link
+ variant="external"
linkColor="muted"
to="https://actualbudget.org/docs/accounts/#off-budget-accounts"
>
Accounts Overview
- </ExternalLink>{' '}
+ </Link>{' '}
for more information.
</Text>
</div>
diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx b/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx
index 292e6c2cb3..236a5a32fc 100644
--- a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx
+++ b/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx
@@ -8,9 +8,9 @@ import { getTestKeyError } from 'loot-core/src/shared/errors';
import { type BoundActions } from '../../hooks/useActions';
import { theme } from '../../style';
import { Button, ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { InitialFocus } from '../common/InitialFocus';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Modal, ModalButtons } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
@@ -76,17 +76,23 @@ export function FixEncryptionKey({
This file was encrypted with a different key than you are
currently using. This probably means you changed your password.
Enter your current password to update your key.{' '}
- <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ >
Learn more
- </ExternalLink>
+ </Link>
</Paragraph>
) : (
<Paragraph>
We don’t have a key that encrypts or decrypts this file. Enter the
password for this file to create the key for encryption.{' '}
- <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
+ >
Learn more
- </ExternalLink>
+ </Link>
</Paragraph>
)}
<form
diff --git a/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx b/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx
index 3a5c699b49..5de7b9fde9 100644
--- a/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx
+++ b/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx
@@ -16,8 +16,7 @@ import { theme } from '../../style';
import { Error, Warning } from '../alerts';
import { Autocomplete } from '../autocomplete/Autocomplete';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
-import { LinkButton } from '../common/LinkButton';
+import { Link } from '../common/Link';
import { Menu } from '../common/Menu';
import { Modal } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
@@ -169,12 +168,13 @@ export function GoCardlessExternalMsg({
<Error>
Failed loading available banks: GoCardless access credentials might
be misconfigured. Please{' '}
- <LinkButton
+ <Link
+ variant="text"
onClick={onGoCardlessInit}
style={{ color: theme.formLabelText, display: 'inline' }}
>
set them up
- </LinkButton>{' '}
+ </Link>{' '}
again.
</Error>
) : (
@@ -205,9 +205,13 @@ export function GoCardlessExternalMsg({
service) read-only access to your entire account’s transaction
history. This service is not affiliated with Actual in any way. Make
sure you’ve read and understand GoCardless’s{' '}
- <ExternalLink to="https://gocardless.com/privacy/" linkColor="purple">
+ <Link
+ variant="external"
+ to="https://gocardless.com/privacy/"
+ linkColor="purple"
+ >
Privacy Policy
- </ExternalLink>{' '}
+ </Link>{' '}
before proceeding.
</Warning>
@@ -297,9 +301,9 @@ export function GoCardlessExternalMsg({
</View>
{waiting === 'browser' && (
- <LinkButton onClick={onJump} style={{ marginTop: 10 }}>
+ <Link variant="text" onClick={onJump} style={{ marginTop: 10 }}>
(Account linking not opening in a new tab? Click here)
- </LinkButton>
+ </Link>
)}
</View>
) : success ? (
diff --git a/packages/desktop-client/src/components/modals/GoCardlessInitialise.tsx b/packages/desktop-client/src/components/modals/GoCardlessInitialise.tsx
index a7b1ef7e84..8857962e0e 100644
--- a/packages/desktop-client/src/components/modals/GoCardlessInitialise.tsx
+++ b/packages/desktop-client/src/components/modals/GoCardlessInitialise.tsx
@@ -5,8 +5,8 @@ import { send } from 'loot-core/src/platform/client/fetch';
import { Error } from '../alerts';
import { ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Modal, ModalButtons } from '../common/Modal';
import type { ModalProps } from '../common/Modal';
import { Text } from '../common/Text';
@@ -58,12 +58,13 @@ export const GoCardlessInitialise = ({
In order to enable bank-sync via GoCardless (only for EU banks) you
will need to create access credentials. This can be done by creating
an account with{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/advanced/bank-sync/"
linkColor="purple"
>
GoCardless
- </ExternalLink>
+ </Link>
.
</Text>
diff --git a/packages/desktop-client/src/components/modals/SimpleFinInitialise.tsx b/packages/desktop-client/src/components/modals/SimpleFinInitialise.tsx
index 6398039b04..6eeff3281b 100644
--- a/packages/desktop-client/src/components/modals/SimpleFinInitialise.tsx
+++ b/packages/desktop-client/src/components/modals/SimpleFinInitialise.tsx
@@ -5,8 +5,8 @@ import { send } from 'loot-core/src/platform/client/fetch';
import { Error } from '../alerts';
import { ButtonWithLoading } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Modal, ModalButtons } from '../common/Modal';
import type { ModalProps } from '../common/Modal';
import { Text } from '../common/Text';
@@ -51,12 +51,13 @@ export const SimpleFinInitialise = ({
In order to enable bank-sync via SimpleFIN (only for North American
banks) you will need to create a token. This can be done by creating
an account with{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://beta-bridge.simplefin.org/"
linkColor="purple"
>
SimpleFIN
- </ExternalLink>
+ </Link>
.
</Text>
diff --git a/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx b/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx
index eb04d7e86f..2c9c66ef2c 100644
--- a/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx
+++ b/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx
@@ -3,7 +3,7 @@ import React from 'react';
import { useLocalPref } from '../../hooks/useLocalPref';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { Modal } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
import { Text } from '../common/Text';
@@ -46,12 +46,13 @@ export function SwitchBudgetType({
marginTop: 10,
}}
>
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/experimental/report-budget"
linkColor="muted"
>
How do these types of budgeting work?
- </ExternalLink>
+ </Link>
</Paragraph>
</>
)}
diff --git a/packages/desktop-client/src/components/reports/Header.jsx b/packages/desktop-client/src/components/reports/Header.jsx
index 2e9fa94a46..d0648dfc84 100644
--- a/packages/desktop-client/src/components/reports/Header.jsx
+++ b/packages/desktop-client/src/components/reports/Header.jsx
@@ -5,7 +5,7 @@ import * as monthUtils from 'loot-core/src/shared/months';
import { SvgArrowLeft } from '../../icons/v1';
import { styles } from '../../style';
import { Button } from '../common/Button';
-import { ButtonLink } from '../common/ButtonLink';
+import { Link } from '../common/Link';
import { Select } from '../common/Select';
import { View } from '../common/View';
import { AppliedFilters } from '../filters/AppliedFilters';
@@ -45,13 +45,14 @@ export function Header({
flexShrink: 0,
}}
>
- <ButtonLink
+ <Link
+ variant="button"
type="bare"
to="/reports"
style={{ marginBottom: '15', alignSelf: 'flex-start' }}
>
<SvgArrowLeft width={10} height={10} style={{ marginRight: 5 }} /> Back
- </ButtonLink>
+ </Link>
<View style={styles.veryLargeText}>{title}</View>
{path !== '/reports/custom' && (
diff --git a/packages/desktop-client/src/components/reports/Overview.jsx b/packages/desktop-client/src/components/reports/Overview.jsx
index 8100b30097..939421c305 100644
--- a/packages/desktop-client/src/components/reports/Overview.jsx
+++ b/packages/desktop-client/src/components/reports/Overview.jsx
@@ -5,8 +5,8 @@ import { useReports } from 'loot-core/src/client/data-hooks/reports';
import { useAccounts } from '../../hooks/useAccounts';
import { useFeatureFlag } from '../../hooks/useFeatureFlag';
import { styles } from '../../style';
-import { AnchorLink } from '../common/AnchorLink';
import { Button } from '../common/Button';
+import { Link } from '../common/Link';
import { Text } from '../common/Text';
import { View } from '../common/View';
@@ -36,11 +36,11 @@ export function Overview() {
marginTop: 10,
}}
>
- <AnchorLink to="/reports/custom" style={{ textDecoration: 'none' }}>
+ <Link to="/reports/custom" style={{ textDecoration: 'none' }}>
<Button type="primary">
<Text>Create new custom report</Text>
</Button>
- </AnchorLink>
+ </Link>
</View>
)}
<View
diff --git a/packages/desktop-client/src/components/reports/ReportCard.tsx b/packages/desktop-client/src/components/reports/ReportCard.tsx
index ad9fe83d18..41278b3942 100644
--- a/packages/desktop-client/src/components/reports/ReportCard.tsx
+++ b/packages/desktop-client/src/components/reports/ReportCard.tsx
@@ -3,7 +3,7 @@ import React, { type ReactNode } from 'react';
import { type CustomReportEntity } from 'loot-core/src/types/models';
import { type CSSProperties, theme } from '../../style';
-import { AnchorLink } from '../common/AnchorLink';
+import { Link } from '../common/Link';
import { View } from '../common/View';
type ReportCardProps = {
@@ -47,13 +47,13 @@ export function ReportCard({
if (to) {
return (
- <AnchorLink
+ <Link
to={to}
report={report}
style={{ textDecoration: 'none', ...containerProps }}
>
{content}
- </AnchorLink>
+ </Link>
);
}
return content;
diff --git a/packages/desktop-client/src/components/rules/Value.tsx b/packages/desktop-client/src/components/rules/Value.tsx
index d8b184b39d..3d26c5a0b4 100644
--- a/packages/desktop-client/src/components/rules/Value.tsx
+++ b/packages/desktop-client/src/components/rules/Value.tsx
@@ -12,7 +12,7 @@ import { useCategories } from '../../hooks/useCategories';
import { useDateFormat } from '../../hooks/useDateFormat';
import { usePayees } from '../../hooks/usePayees';
import { type CSSProperties, theme } from '../../style';
-import { LinkButton } from '../common/LinkButton';
+import { Link } from '../common/Link';
import { Text } from '../common/Text';
type ValueProps<T> = {
@@ -155,9 +155,9 @@ export function Value<T>({
{numHidden > 0 && (
<Text style={valueStyle}>
&nbsp;&nbsp;
- <LinkButton onClick={onExpand} style={valueStyle}>
+ <Link variant="text" onClick={onExpand} style={valueStyle}>
{numHidden} more items...
- </LinkButton>
+ </Link>
{!inline && <br />}
</Text>
)}
diff --git a/packages/desktop-client/src/components/settings/Encryption.tsx b/packages/desktop-client/src/components/settings/Encryption.tsx
index 97a7660ce2..ee76328f38 100644
--- a/packages/desktop-client/src/components/settings/Encryption.tsx
+++ b/packages/desktop-client/src/components/settings/Encryption.tsx
@@ -5,7 +5,7 @@ import { useActions } from '../../hooks/useActions';
import { useLocalPref } from '../../hooks/useLocalPref';
import { theme } from '../../style';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
+import { Link } from '../common/Link';
import { Text } from '../common/Text';
import { useServerURL } from '../ServerContext';
@@ -33,12 +33,13 @@ export function EncryptionSettings() {
Your data is encrypted with a key that only you have before sending it
it out to the cloud. Local data remains unencrypted so if you forget
your password you can re-encrypt it.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
linkColor="purple"
>
Learn more…
- </ExternalLink>
+ </Link>
</Text>
</Setting>
) : missingCryptoAPI ? (
@@ -48,12 +49,13 @@ export function EncryptionSettings() {
unencrypted connection to a remote server. You’ll need to enable HTTPS
on your server to use end-to-end encryption. This problem may also occur
if your browser is too old to work with Actual.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/config/https"
linkColor="purple"
>
Learn more…
- </ExternalLink>
+ </Link>
</Text>
</Setting>
) : serverURL ? (
@@ -70,12 +72,13 @@ export function EncryptionSettings() {
end-to-end encrypted which means the server owners have the ability to
read it. If you want, you can use an additional password to encrypt your
data on the server.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
linkColor="purple"
>
Learn more…
- </ExternalLink>
+ </Link>
</Text>
</Setting>
) : (
@@ -84,12 +87,13 @@ export function EncryptionSettings() {
<strong>End-to-end encryption</strong> is not available when running
without a server. Budget files are always kept unencrypted locally, and
encryption is only applied when sending data to a server.{' '}
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
linkColor="purple"
>
Learn more…
- </ExternalLink>
+ </Link>
</Text>
</Setting>
);
diff --git a/packages/desktop-client/src/components/settings/Experimental.tsx b/packages/desktop-client/src/components/settings/Experimental.tsx
index c7bcff182c..36da6b40c6 100644
--- a/packages/desktop-client/src/components/settings/Experimental.tsx
+++ b/packages/desktop-client/src/components/settings/Experimental.tsx
@@ -5,7 +5,7 @@ import type { FeatureFlag } from 'loot-core/src/types/prefs';
import { useFeatureFlag } from '../../hooks/useFeatureFlag';
import { useLocalPref } from '../../hooks/useLocalPref';
import { theme } from '../../style';
-import { LinkButton } from '../common/LinkButton';
+import { Link } from '../common/Link';
import { Text } from '../common/Text';
import { View } from '../common/View';
import { Checkbox } from '../forms';
@@ -90,7 +90,8 @@ export function ExperimentalFeatures() {
<FeatureToggle flag="splitsInRules">Splits in rules</FeatureToggle>
</View>
) : (
- <LinkButton
+ <Link
+ variant="text"
onClick={() => setExpanded(true)}
style={{
flexShrink: 0,
@@ -99,7 +100,7 @@ export function ExperimentalFeatures() {
}}
>
I understand the risks, show experimental features
- </LinkButton>
+ </Link>
)
}
>
diff --git a/packages/desktop-client/src/components/settings/UI.tsx b/packages/desktop-client/src/components/settings/UI.tsx
index ab09721b63..c5c8583021 100644
--- a/packages/desktop-client/src/components/settings/UI.tsx
+++ b/packages/desktop-client/src/components/settings/UI.tsx
@@ -5,7 +5,7 @@ import { css, media } from 'glamor';
import { type CSSProperties, theme } from '../../style';
import { tokens } from '../../tokens';
-import { Button } from '../common/Button';
+import { Link } from '../common/Link';
import { View } from '../common/View';
type SettingProps = {
@@ -76,9 +76,8 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
{children}
</View>
) : (
- <Button
- id="advanced"
- type="link"
+ <Link
+ variant="text"
onClick={() => setExpanded(true)}
style={{
flexShrink: 0,
@@ -88,6 +87,6 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
}}
>
Show advanced settings
- </Button>
+ </Link>
);
};
diff --git a/packages/desktop-client/src/components/settings/index.tsx b/packages/desktop-client/src/components/settings/index.tsx
index 800715b117..1137aa4e59 100644
--- a/packages/desktop-client/src/components/settings/index.tsx
+++ b/packages/desktop-client/src/components/settings/index.tsx
@@ -14,8 +14,8 @@ import { useResponsive } from '../../ResponsiveProvider';
import { theme } from '../../style';
import { tokens } from '../../tokens';
import { Button } from '../common/Button';
-import { ExternalLink } from '../common/ExternalLink';
import { Input } from '../common/Input';
+import { Link } from '../common/Link';
import { Text } from '../common/Text';
import { View } from '../common/View';
import { FormField, FormLabel } from '../forms';
@@ -60,24 +60,26 @@ function About() {
<Text>Client version: v{window.Actual?.ACTUAL_VERSION}</Text>
<Text>Server version: {version}</Text>
{isOutdated ? (
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/releases"
linkColor="purple"
>
New version available: {latestVersion}
- </ExternalLink>
+ </Link>
) : (
<Text style={{ color: theme.noticeText, fontWeight: 600 }}>
You’re up to date!
</Text>
)}
<Text>
- <ExternalLink
+ <Link
+ variant="external"
to="https://actualbudget.org/docs/releases"
linkColor="purple"
>
Release Notes
- </ExternalLink>
+ </Link>
</Text>
</View>
</Setting>
diff --git a/packages/desktop-client/src/components/sidebar/Account.tsx b/packages/desktop-client/src/components/sidebar/Account.tsx
index 2c232a73a1..0a1536727c 100644
--- a/packages/desktop-client/src/components/sidebar/Account.tsx
+++ b/packages/desktop-client/src/components/sidebar/Account.tsx
@@ -7,7 +7,7 @@ import { type AccountEntity } from 'loot-core/src/types/models';
import { styles, theme, type CSSProperties } from '../../style';
import { AlignedText } from '../common/AlignedText';
-import { AnchorLink } from '../common/AnchorLink';
+import { Link } from '../common/Link';
import { View } from '../common/View';
import {
useDraggable,
@@ -87,7 +87,7 @@ export function Account({
<View>
<DropHighlight pos={dropPos} />
<View innerRef={dragRef}>
- <AnchorLink
+ <Link
to={to}
style={{
...accountNameStyle,
@@ -143,7 +143,7 @@ export function Account({
left={name}
right={<CellValue binding={query} type="financial" />}
/>
- </AnchorLink>
+ </Link>
</View>
</View>
</View>
diff --git a/packages/desktop-client/src/components/sidebar/ItemContent.tsx b/packages/desktop-client/src/components/sidebar/ItemContent.tsx
index 6a4a50423b..2ba413baa7 100644
--- a/packages/desktop-client/src/components/sidebar/ItemContent.tsx
+++ b/packages/desktop-client/src/components/sidebar/ItemContent.tsx
@@ -1,7 +1,7 @@
import React, { type MouseEventHandler, type ReactNode } from 'react';
import { type CSSProperties } from '../../style';
-import { AnchorLink } from '../common/AnchorLink';
+import { Link } from '../common/Link';
import { View } from '../common/View';
type ItemContentProps = {
@@ -38,8 +38,8 @@ export function ItemContent({
{children}
</View>
) : (
- <AnchorLink to={to} style={style} activeStyle={activeStyle}>
+ <Link to={to} style={style} activeStyle={activeStyle}>
{children}
- </AnchorLink>
+ </Link>
);
}
diff --git a/upcoming-release-notes/2558.md b/upcoming-release-notes/2558.md
new file mode 100644
index 0000000000..201f214339
--- /dev/null
+++ b/upcoming-release-notes/2558.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [carkom]
+---
+
+Consolidates AnchorLink, ButtonLink and LinkButton to use existing props (Link and Button - with type).