Skip to content

A local-first personal finance app

Consistently use ExternalLink (#1184)

Jed Foxaa503d6a7436
diff --git a/.eslintrc.js b/.eslintrc.js
index 33f1213415..f83baef0d8 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -109,6 +109,12 @@ module.exports = {
message:
'Using default React import is discouraged, please use named exports directly instead.',
},
+ {
+ // forbid <a> in favor of <LinkButton> or <ExternalLink>
+ selector: 'JSXOpeningElement[name.name="a"]',
+ message:
+ 'Using <a> is discouraged, please use <LinkButton> or <ExternalLink> instead.',
+ },
],
'no-restricted-imports': ['error', { patterns: restrictedImportPatterns }],
diff --git a/packages/desktop-client/src/components/FatalError.js b/packages/desktop-client/src/components/FatalError.js
index 138bd12b63..c51be1e0bd 100644
--- a/packages/desktop-client/src/components/FatalError.js
+++ b/packages/desktop-client/src/components/FatalError.js
@@ -2,7 +2,17 @@ import React, { Component, useState } from 'react';
import { colors } from '../style';
-import { View, Stack, Text, Block, Modal, P, Link, Button } from './common';
+import {
+ View,
+ Stack,
+ Text,
+ Block,
+ Modal,
+ P,
+ LinkButton,
+ Button,
+ ExternalLink,
+} from './common';
import { Checkbox } from './forms';
class FatalError extends Component {
@@ -28,9 +38,12 @@ class FatalError extends Component {
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{' '}
- <a href="https://actualbudget.org/docs/troubleshooting/shared-array-buffer">
+ <ExternalLink
+ muted
+ to="https://actualbudget.org/docs/troubleshooting/shared-array-buffer"
+ >
our troubleshooting documentation
- </a>{' '}
+ </ExternalLink>{' '}
to learn more. <SharedArrayBufferOverride />
</Text>
);
@@ -42,9 +55,9 @@ class FatalError extends Component {
<Text>
There was a problem loading the app in this browser version. If this
continues to be a problem, you can{' '}
- <a href="https://github.com/actualbudget/releases">
+ <ExternalLink muted to="https://github.com/actualbudget/releases">
download the desktop app
- </a>
+ </ExternalLink>
.
</Text>
);
@@ -65,12 +78,14 @@ class FatalError extends Component {
color: colors.r4,
lineHeight: '1.5em',
fontSize: 15,
- '& a': { color: colors.r4 },
}}
>
<Text>{msg}</Text>
<Text>
- Please get <a href="https://actualbudget.org/contact">in touch</a>{' '}
+ Please get{' '}
+ <ExternalLink muted to="https://actualbudget.org/contact">
+ in touch
+ </ExternalLink>{' '}
for support
</Text>
</Stack>
@@ -93,12 +108,9 @@ class FatalError extends Component {
<P>There was an unrecoverable error in the UI. Sorry!</P>
<P>
If this error persists, please get{' '}
- <a
- href="https://actualbudget.org/contact"
- style={{ color: colors.p4 }}
- >
+ <ExternalLink to="https://actualbudget.org/contact">
in touch
- </a>{' '}
+ </ExternalLink>{' '}
so it can be investigated.
</P>
<P>
@@ -107,12 +119,12 @@ class FatalError extends Component {
</Button>
</P>
<P isLast={true} style={{ fontSize: 11 }}>
- <Link
+ <LinkButton
onClick={() => this.setState({ showError: true })}
style={{ color: colors.p4 }}
>
Show Error
- </Link>
+ </LinkButton>
{showError && (
<Block
style={{
@@ -163,7 +175,7 @@ function SharedArrayBufferOverride() {
</Button>
</>
) : (
- <Link
+ <LinkButton
onClick={() => setExpanded(true)}
style={{
color: `inherit !important`,
@@ -178,6 +190,6 @@ function SharedArrayBufferOverride() {
}}
>
Advanced options
- </Link>
+ </LinkButton>
);
}
diff --git a/packages/desktop-client/src/components/ManageRules.js b/packages/desktop-client/src/components/ManageRules.js
index 486ababc05..8f37157541 100644
--- a/packages/desktop-client/src/components/ManageRules.js
+++ b/packages/desktop-client/src/components/ManageRules.js
@@ -10,7 +10,6 @@ import React, {
import { useDispatch, useSelector } from 'react-redux';
import { format as formatDate, parseISO } from 'date-fns';
-import { css } from 'glamor';
import { pushModal } from 'loot-core/src/client/actions/modals';
import { initiallyLoadPayees } from 'loot-core/src/client/actions/queries';
@@ -32,7 +31,15 @@ import useSelected, {
import ArrowRight from '../icons/v0/RightArrow2';
import { colors } from '../style';
-import { View, Text, Button, Stack, ExternalLink, Input } from './common';
+import {
+ View,
+ Text,
+ Button,
+ Stack,
+ ExternalLink,
+ Input,
+ LinkButton,
+} from './common';
import {
SelectCell,
Row,
@@ -179,18 +186,9 @@ export function Value({
{numHidden > 0 && (
<Text style={{ color: colors.p4 }}>
&nbsp;&nbsp;
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
- <a
- href="#"
- onClick={onExpand}
- {...css({
- color: colors.p4,
- textDecoration: 'none',
- ':hover': { textDecoration: 'underline' },
- })}
- >
+ <LinkButton onClick={onExpand} style={{ color: colors.p4 }}>
{numHidden} more items...
- </a>
+ </LinkButton>
{!inline && <br />}
</Text>
)}
@@ -751,9 +749,8 @@ function ManageRulesContent({ isModal, payeeId, setLoading }) {
<Text>
Rules are always run in the order that you see them.{' '}
<ExternalLink
- asAnchor={true}
- href="https://actualbudget.org/docs/budgeting/rules/"
- style={{ color: colors.n4 }}
+ to="https://actualbudget.org/docs/budgeting/rules/"
+ linkColor="muted"
>
Learn more
</ExternalLink>
diff --git a/packages/desktop-client/src/components/Notifications.js b/packages/desktop-client/src/components/Notifications.js
index 9ca3119a8c..d584609155 100644
--- a/packages/desktop-client/src/components/Notifications.js
+++ b/packages/desktop-client/src/components/Notifications.js
@@ -16,6 +16,7 @@ import {
ButtonWithLoading,
Stack,
ExternalLink,
+ LinkButton,
} from './common';
function compileMessage(message, actions, setLoading, onRemove) {
@@ -34,9 +35,7 @@ function compileMessage(message, actions, setLoading, onRemove) {
if (href[0] === '#') {
let actionName = href.slice(1);
return (
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
- <a
- href="#"
+ <LinkButton
onClick={async e => {
e.preventDefault();
if (actions[actionName]) {
@@ -47,12 +46,12 @@ function compileMessage(message, actions, setLoading, onRemove) {
}}
>
{text}
- </a>
+ </LinkButton>
);
}
return (
- <ExternalLink key={idx} asAnchor={true} href={match[2]}>
+ <ExternalLink key={idx} to={match[2]}>
{match[1]}
</ExternalLink>
);
diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.js
index 4bd3af0f2f..27e0596428 100644
--- a/packages/desktop-client/src/components/Titlebar.js
+++ b/packages/desktop-client/src/components/Titlebar.js
@@ -34,6 +34,7 @@ import {
ButtonWithLoading,
Tooltip,
P,
+ ExternalLink,
} from './common';
import { useSidebar } from './FloatableSidebar';
import LoggedInUser from './LoggedInUser';
@@ -238,16 +239,12 @@ function BudgetTitlebar({ globalPrefs, saveGlobalPrefs, localPrefs }) {
</ButtonWithLoading>
</P>
<P isLast={true}>
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
- <a
- href="#"
- style={{
- color: colors.n4,
- fontStyle: 'italic',
- }}
+ <ExternalLink
+ to="https://actualbudget.org/docs/experimental/report-budget"
+ linkColor="muted"
>
How do these types of budgeting work?
- </a>
+ </ExternalLink>
</P>
</Tooltip>
)}
diff --git a/packages/desktop-client/src/components/UpdateNotification.js b/packages/desktop-client/src/components/UpdateNotification.js
index ad775e33de..b66653bc92 100644
--- a/packages/desktop-client/src/components/UpdateNotification.js
+++ b/packages/desktop-client/src/components/UpdateNotification.js
@@ -8,7 +8,7 @@ import * as actions from 'loot-core/src/client/actions';
import Close from '../icons/v1/Close';
import { colors } from '../style';
-import { View, Text, Link, Button } from './common';
+import { View, Text, LinkButton, Button } from './common';
function closeNotification(setAppState) {
// Set a flag to never show an update notification again for this session
@@ -49,14 +49,14 @@ function UpdateNotification({
<View style={{ flex: 1 }} />
<View style={{ marginTop: -1 }}>
<Text>
- <Link
+ <LinkButton
onClick={updateApp}
style={{ color: 'white', textDecoration: 'underline' }}
>
Restart
- </Link>{' '}
+ </LinkButton>{' '}
(
- <Link
+ <LinkButton
style={{ color: 'white', textDecoration: 'underline' }}
onClick={() =>
window.Actual.openURLInBrowser(
@@ -65,7 +65,7 @@ function UpdateNotification({
}
>
notes
- </Link>
+ </LinkButton>
)
<Button
bare
diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js
index ca3f97ede6..164d0f2c36 100644
--- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js
+++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js
@@ -7,7 +7,7 @@ import * as actions from 'loot-core/src/client/actions';
import ExclamationOutline from '../../icons/v1/ExclamationOutline';
import { authorizeBank } from '../../nordigen';
import { colors } from '../../style';
-import { View, Button, Tooltip } from '../common';
+import { View, Button, Tooltip, ExternalLink } from '../common';
function getErrorMessage(type, code) {
switch (type.toUpperCase()) {
@@ -38,13 +38,9 @@ function getErrorMessage(type, code) {
return (
<>
An internal error occurred. Try to login again, or get{' '}
- <a
- href="https://actualbudget.org/contact/"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://actualbudget.org/contact/">
in touch
- </a>{' '}
+ </ExternalLink>{' '}
for support.
</>
);
diff --git a/packages/desktop-client/src/components/common.tsx b/packages/desktop-client/src/components/common.tsx
index 255e88fb98..e7c4fe5a84 100644
--- a/packages/desktop-client/src/components/common.tsx
+++ b/packages/desktop-client/src/components/common.tsx
@@ -126,14 +126,15 @@ export const Card = forwardRef<HTMLDivElement, CardProps>(
type LinkProps = ComponentProps<typeof Button>;
-export function Link({ style, children, ...nativeProps }: LinkProps) {
+export function LinkButton({ style, children, ...nativeProps }: LinkProps) {
return (
<Button
{...css(
{
textDecoration: 'none',
color: styles.textColor,
- backgroundColor: 'transparent',
+ backgroundColor: 'transparent !important',
+ display: 'inline',
border: 0,
cursor: 'pointer',
padding: 0,
@@ -142,6 +143,9 @@ export function Link({ style, children, ...nativeProps }: LinkProps) {
textDecoration: 'underline',
boxShadow: 'none',
},
+ ':focus': {
+ boxShadow: 'none',
+ },
},
styles.smallText,
style,
@@ -178,43 +182,31 @@ export function AnchorLink({
);
}
-type ExternalLinkAnchorProps = {
- asAnchor: true;
-} & HTMLPropsWithStyle<HTMLAnchorElement>;
-type ExternalLinkButtonProps = { asAnchor: false | undefined } & ComponentProps<
- typeof Button
->;
-type ExternalLinkProps = ExternalLinkAnchorProps | ExternalLinkButtonProps;
-
-export const ExternalLink = forwardRef<HTMLElement, ExternalLinkProps>(
- ({ asAnchor, children, ...props }, ref) => {
- function onClick(e) {
- e.preventDefault();
- window.Actual.openURLInBrowser(props.href);
- }
+let externalLinkColors = {
+ purple: colors.p4,
+ blue: colors.b4,
+ muted: 'inherit',
+};
+type ExternalLinkProps = {
+ children?: ReactNode;
+ to: string;
+ linkColor?: keyof typeof externalLinkColors;
+};
- if (asAnchor) {
- return (
- <a
- ref={ref as Ref<HTMLAnchorElement>}
- {...(props as ExternalLinkAnchorProps)}
- onClick={onClick}
- >
- {children}
- </a>
- );
- }
- return (
- <Button
- ref={ref as Ref<HTMLButtonElement>}
- bare
- {...(props as ExternalLinkButtonProps)}
- onClick={onClick}
- >
- {children}
- </Button>
- );
- },
+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>
+ ),
);
type ButtonLinkProps = ComponentProps<typeof Button> & {
diff --git a/packages/desktop-client/src/components/manager/ImportYNAB5.js b/packages/desktop-client/src/components/manager/ImportYNAB5.js
index 86a75f06a0..393038f2f7 100644
--- a/packages/desktop-client/src/components/manager/ImportYNAB5.js
+++ b/packages/desktop-client/src/components/manager/ImportYNAB5.js
@@ -61,11 +61,7 @@ function Import({ modalProps, availableImports }) {
style={{ alignItems: 'center', '& > div': { lineHeight: '1.7em' } }}
>
<P>
- <ExternalLink
- asAnchor={true}
- href="https://actualbudget.org/docs/migration/nynab"
- target="_blank"
- >
+ <ExternalLink to="https://actualbudget.org/docs/migration/nynab">
Read here
</ExternalLink>{' '}
for instructions on how to migrate your data from YNAB. You need
diff --git a/packages/desktop-client/src/components/manager/ManagementApp.js b/packages/desktop-client/src/components/manager/ManagementApp.js
index 4d7038f260..d8125019df 100644
--- a/packages/desktop-client/src/components/manager/ManagementApp.js
+++ b/packages/desktop-client/src/components/manager/ManagementApp.js
@@ -41,7 +41,6 @@ function Version() {
zIndex: 5001,
},
}}
- href="https://actualbudget.org/docs/releases"
>
{`App: v${window.Actual.ACTUAL_VERSION} | Server: ${version}`}
</Text>
diff --git a/packages/desktop-client/src/components/manager/WelcomeScreen.js b/packages/desktop-client/src/components/manager/WelcomeScreen.js
index 9273f43130..076bba6e63 100644
--- a/packages/desktop-client/src/components/manager/WelcomeScreen.js
+++ b/packages/desktop-client/src/components/manager/WelcomeScreen.js
@@ -26,17 +26,19 @@ function WelcomeScreen({ createBudget, pushModal }) {
top of that, we want to provide powerful tools to allow you to do
whatever you want with your data.
</P>
- <P style={{ '& a, & a:visited': { color: colors.p5 } }}>
+ <P>
Currently, Actual implements budgeting based on a{' '}
<ExternalLink
- asAnchor
- style={{ color: colors.p5 }}
- href="https://actualbudget.org/docs/budgeting/"
+ to="https://actualbudget.org/docs/budgeting/"
+ linkColor="purple"
>
monthly envelope system
</ExternalLink>
. Consider taking our{' '}
- <ExternalLink asAnchor href="https://actualbudget.org/docs/tour/">
+ <ExternalLink
+ to="https://actualbudget.org/docs/tour/"
+ linkColor="purple"
+ >
guided tour
</ExternalLink>{' '}
to help you get your bearings, and check out the rest of the
diff --git a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
index 7a8468a099..ff264ca56d 100644
--- a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
+++ b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.tsx
@@ -6,7 +6,7 @@ import { loggedIn } from 'loot-core/src/client/actions/user';
import { send } from 'loot-core/src/platform/client/fetch';
import { colors } from '../../../style';
-import { View, Text, Button, P } from '../../common';
+import { View, Text, Button, P, ExternalLink } from '../../common';
import { useBootstrapped, Title } from './common';
import { ConfirmPasswordForm } from './ConfirmPasswordForm';
@@ -59,14 +59,9 @@ export default function Bootstrap() {
<P isLast style={{ fontSize: 16, color: colors.n2 }}>
Consider opening{' '}
- <a
- href="https://actualbudget.org/docs/tour/"
- target="_blank"
- rel="noopener noreferrer"
- style={{ color: colors.b4 }}
- >
+ <ExternalLink to="https://actualbudget.org/docs/tour/">
our tour
- </a>{' '}
+ </ExternalLink>{' '}
in a new tab for some guidance on what to do when you’ve set your
password.
</P>
diff --git a/packages/desktop-client/src/components/modals/CloseAccount.js b/packages/desktop-client/src/components/modals/CloseAccount.js
index b955cfb796..9e0356461a 100644
--- a/packages/desktop-client/src/components/modals/CloseAccount.js
+++ b/packages/desktop-client/src/components/modals/CloseAccount.js
@@ -5,7 +5,16 @@ import { Formik } from 'formik';
import { integerToCurrency } from 'loot-core/src/shared/util';
import { colors } from '../../style';
-import { View, Text, Modal, Button, P, Select, FormError } from '../common';
+import {
+ View,
+ Text,
+ Modal,
+ Button,
+ P,
+ Select,
+ FormError,
+ LinkButton,
+} from '../common';
function needsCategory(account, currentTransfer, accounts) {
const acct = accounts.find(a => a.id === currentTransfer);
@@ -178,11 +187,8 @@ function CloseAccount({
<View style={{ marginBottom: 15 }}>
<Text style={{ fontSize: 12 }}>
You can also{' '}
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
- <a
- href="#"
- onClick={e => {
- e.preventDefault();
+ <LinkButton
+ onClick={() => {
setLoading(true);
actions
@@ -192,7 +198,7 @@ function CloseAccount({
style={{ color: colors.r6 }}
>
force close
- </a>{' '}
+ </LinkButton>{' '}
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.js b/packages/desktop-client/src/components/modals/CreateAccount.js
index 46e15d2696..86cf1bee2a 100644
--- a/packages/desktop-client/src/components/modals/CreateAccount.js
+++ b/packages/desktop-client/src/components/modals/CreateAccount.js
@@ -5,7 +5,15 @@ import { pushModal } from 'loot-core/src/client/actions/modals';
import useNordigenStatus from '../../hooks/useNordigenStatus';
import { authorizeBank } from '../../nordigen';
-import { View, Text, Modal, P, Button, ButtonWithLoading } from '../common';
+import {
+ View,
+ Text,
+ Modal,
+ P,
+ Button,
+ ButtonWithLoading,
+ ExternalLink,
+} from '../common';
export default function CreateAccount({ modalProps, syncServerStatus }) {
const dispatch = useDispatch();
@@ -57,13 +65,12 @@ export default function CreateAccount({ modalProps, syncServerStatus }) {
<Text>
<strong>Create a local account</strong> if you want to add
transactions manually. You can also{' '}
- <a
- href="https://actualbudget.org/docs/transactions/importing"
- target="_blank"
- rel="noopener noreferrer"
+ <ExternalLink
+ to="https://actualbudget.org/docs/transactions/importing"
+ linkColor="muted"
>
import QIF/OFX/QFX files into a local account
- </a>
+ </ExternalLink>
.
</Text>
</View>
@@ -105,13 +112,12 @@ export default function CreateAccount({ modalProps, syncServerStatus }) {
</Button>
<P style={{ fontSize: 15 }}>
Connect to an Actual server to set up{' '}
- <a
- href="https://actualbudget.org/docs/advanced/bank-sync"
- target="_blank"
- rel="noopener noreferrer"
+ <ExternalLink
+ to="https://actualbudget.org/docs/advanced/bank-sync"
+ linkColor="muted"
>
automatic syncing with Nordigen
- </a>
+ </ExternalLink>
.
</P>
</>
diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js
index 82a6662282..687188bd25 100644
--- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js
+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js
@@ -67,10 +67,7 @@ export default 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
- asAnchor
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more
</ExternalLink>
</P>
@@ -106,10 +103,7 @@ export default 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
- asAnchor
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more
</ExternalLink>
</P>
diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccount.js b/packages/desktop-client/src/components/modals/CreateLocalAccount.js
index d4b8efcdf2..449e7435d7 100644
--- a/packages/desktop-client/src/components/modals/CreateLocalAccount.js
+++ b/packages/desktop-client/src/components/modals/CreateLocalAccount.js
@@ -16,6 +16,7 @@ import {
FormError,
InitialFocus,
Text,
+ ExternalLink,
} from '../common';
function CreateLocalAccount({ modalProps, actions }) {
@@ -116,16 +117,12 @@ function CreateLocalAccount({ modalProps, actions }) {
<Text>
This cannot be changed later. <br /> {'\n'}
See{' '}
- <a
- href="https://actualbudget.org/docs/accounts/#off-budget-accounts"
- target="_blank"
- rel="noopener noreferrer"
- style={{
- color: colors.n5,
- }}
+ <ExternalLink
+ linkColor="muted"
+ to="https://actualbudget.org/docs/accounts/#off-budget-accounts"
>
Accounts Overview
- </a>{' '}
+ </ExternalLink>{' '}
for more information.
</Text>
</div>
diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.js b/packages/desktop-client/src/components/modals/FixEncryptionKey.js
index ca8697ae15..1f980de716 100644
--- a/packages/desktop-client/src/components/modals/FixEncryptionKey.js
+++ b/packages/desktop-client/src/components/modals/FixEncryptionKey.js
@@ -70,10 +70,7 @@ export default 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
- asAnchor
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more
</ExternalLink>
</P>
@@ -81,10 +78,7 @@ export default function FixEncryptionKey({
<P>
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
- asAnchor
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more
</ExternalLink>
</P>
diff --git a/packages/desktop-client/src/components/modals/NordigenExternalMsg.js b/packages/desktop-client/src/components/modals/NordigenExternalMsg.js
index 1dc7bf36e5..5536bf97a6 100644
--- a/packages/desktop-client/src/components/modals/NordigenExternalMsg.js
+++ b/packages/desktop-client/src/components/modals/NordigenExternalMsg.js
@@ -10,7 +10,16 @@ import DotsHorizontalTriple from '../../icons/v1/DotsHorizontalTriple';
import { colors } from '../../style';
import { Error, Warning } from '../alerts';
import Autocomplete from '../autocomplete/Autocomplete';
-import { View, Modal, Button, P, Link, Menu, Tooltip } from '../common';
+import {
+ View,
+ Modal,
+ Button,
+ P,
+ LinkButton,
+ Menu,
+ Tooltip,
+ ExternalLink,
+} from '../common';
import { FormField, FormLabel } from '../forms';
import { COUNTRY_OPTIONS } from './countries';
@@ -144,12 +153,12 @@ export default function NordigenExternalMsg({
<Error>
Failed loading available banks: Nordigen access credentials might be
misconfigured. Please{' '}
- <Link
+ <LinkButton
onClick={onNordigenInit}
style={{ color: colors.b3, display: 'inline' }}
>
set them up
- </Link>{' '}
+ </LinkButton>{' '}
again.
</Error>
) : (
@@ -180,21 +189,13 @@ export default function NordigenExternalMsg({
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 Nordigen’s{' '}
- <a
- href="https://nordigen.com/en/company/privacy-policy/"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://nordigen.com/en/company/privacy-policy/">
Privacy Policy
- </a>{' '}
+ </ExternalLink>{' '}
and{' '}
- <a
- href="https://nordigen.com/en/company/privacy-policy-end-user/"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://nordigen.com/en/company/privacy-policy-end-user/">
End User Privacy Policy
- </a>{' '}
+ </ExternalLink>{' '}
before proceeding.
</Warning>
@@ -280,9 +281,9 @@ export default function NordigenExternalMsg({
</View>
{waiting === 'browser' && (
- <Link onClick={onJump} style={{ marginTop: 10 }}>
+ <LinkButton onClick={onJump} style={{ marginTop: 10 }}>
(Account linking not opening in a new tab? Click here)
- </Link>
+ </LinkButton>
)}
</View>
) : success ? (
diff --git a/packages/desktop-client/src/components/modals/NordigenInitialise.tsx b/packages/desktop-client/src/components/modals/NordigenInitialise.tsx
index 397ede3e6c..c67f01e787 100644
--- a/packages/desktop-client/src/components/modals/NordigenInitialise.tsx
+++ b/packages/desktop-client/src/components/modals/NordigenInitialise.tsx
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
import { send } from 'loot-core/src/platform/client/fetch';
import { Error } from '../alerts';
+import { ExternalLink } from '../common';
import { ButtonWithLoading } from '../common/Button';
import Input from '../common/Input';
import Modal, { ModalButtons } from '../common/Modal';
@@ -56,14 +57,7 @@ const NordigenInitialise = ({
In order to enable bank-sync via Nordigen (only for EU banks) you will
need to create access credentials. This can be done by creating an
account with{' '}
- <a
- href="https://nordigen.com/"
- target="_blank"
- rel="noopener noreferrer"
- >
- Nordigen
- </a>
- .
+ <ExternalLink to="https://nordigen.com/">Nordigen</ExternalLink>.
</Text>
<FormField>
diff --git a/packages/desktop-client/src/components/settings/Encryption.js b/packages/desktop-client/src/components/settings/Encryption.js
index 8d59384b0d..e381ad66aa 100644
--- a/packages/desktop-client/src/components/settings/Encryption.js
+++ b/packages/desktop-client/src/components/settings/Encryption.js
@@ -1,7 +1,7 @@
import React from 'react';
import { colors } from '../../style';
-import { Text, Button } from '../common';
+import { Text, Button, ExternalLink } from '../common';
import { useServerURL } from '../ServerContext';
import { Setting } from './UI';
@@ -25,13 +25,9 @@ export default function EncryptionSettings({ prefs, pushModal }) {
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.{' '}
- <a
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more…
- </a>
+ </ExternalLink>
</Text>
</Setting>
) : missingCryptoAPI ? (
@@ -41,13 +37,9 @@ export default function EncryptionSettings({ prefs, pushModal }) {
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.{' '}
- <a
- href="https://actualbudget.org/docs/config/https"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://actualbudget.org/docs/config/https">
Learn more…
- </a>
+ </ExternalLink>
</Text>
</Setting>
) : serverURL ? (
@@ -64,13 +56,9 @@ export default function EncryptionSettings({ prefs, pushModal }) {
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.{' '}
- <a
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more…
- </a>
+ </ExternalLink>
</Text>
</Setting>
) : (
@@ -79,13 +67,9 @@ export default function EncryptionSettings({ prefs, pushModal }) {
<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.{' '}
- <a
- href="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption"
- target="_blank"
- rel="noopener noreferrer"
- >
+ <ExternalLink to="https://actualbudget.org/docs/getting-started/sync/#end-to-end-encryption">
Learn more…
- </a>
+ </ExternalLink>
</Text>
</Setting>
);
diff --git a/packages/desktop-client/src/components/settings/Experimental.js b/packages/desktop-client/src/components/settings/Experimental.js
index 23a2821193..6404c9bf23 100644
--- a/packages/desktop-client/src/components/settings/Experimental.js
+++ b/packages/desktop-client/src/components/settings/Experimental.js
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { useAllFeatureFlags } from '../../hooks/useFeatureFlag';
import { colors } from '../../style';
-import { Link, Text, View } from '../common';
+import { LinkButton, Text, View } from '../common';
import { Checkbox } from '../forms';
import { Setting } from './UI';
@@ -55,7 +55,7 @@ export default function ExperimentalFeatures({ prefs, savePrefs }) {
</label>
</View>
) : (
- <Link
+ <LinkButton
onClick={() => setExpanded(true)}
style={{
flexShrink: 0,
@@ -64,7 +64,7 @@ export default function ExperimentalFeatures({ prefs, savePrefs }) {
}}
>
I understand the risks, show experimental features
- </Link>
+ </LinkButton>
)
}
>
diff --git a/packages/desktop-client/src/components/settings/UI.tsx b/packages/desktop-client/src/components/settings/UI.tsx
index 40d39221db..d5f9bdd9ca 100644
--- a/packages/desktop-client/src/components/settings/UI.tsx
+++ b/packages/desktop-client/src/components/settings/UI.tsx
@@ -6,7 +6,7 @@ import type { CSSProperties } from 'glamor';
import { colors } from '../../style';
import tokens from '../../tokens';
-import { View, Link } from '../common';
+import { View, LinkButton } from '../common';
type SettingProps = {
primaryAction: ReactNode;
@@ -79,7 +79,7 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
{children}
</View>
) : (
- <Link
+ <LinkButton
id="advanced"
onClick={() => setExpanded(true)}
style={{
@@ -90,6 +90,6 @@ export const AdvancedToggle = ({ children }: AdvancedToggleProps) => {
}}
>
Show advanced settings
- </Link>
+ </LinkButton>
);
};
diff --git a/packages/desktop-client/src/components/settings/index.js b/packages/desktop-client/src/components/settings/index.js
index 79f7039e5e..cbb01e5b2c 100644
--- a/packages/desktop-client/src/components/settings/index.js
+++ b/packages/desktop-client/src/components/settings/index.js
@@ -12,7 +12,7 @@ import { useResponsive } from '../../ResponsiveProvider';
import { colors } from '../../style';
import tokens from '../../tokens';
import { withThemeColor } from '../../util/withThemeColor';
-import { View, Text, Button, Input } from '../common';
+import { View, Text, Button, Input, ExternalLink } from '../common';
import { FormField, FormLabel } from '../forms';
import { Page } from '../Page';
import { useServerVersion } from '../ServerContext';
@@ -52,19 +52,21 @@ function About() {
<Text>Client version: v{window.Actual.ACTUAL_VERSION}</Text>
<Text>Server version: {version}</Text>
{isOutdated ? (
- <a
- style={{ color: colors.p4 }}
- href="https://actualbudget.org/docs/releases"
+ <ExternalLink
+ to="https://actualbudget.org/docs/releases"
+ linkColor="purple"
>
New version available: {latestVersion}
- </a>
+ </ExternalLink>
) : (
<Text style={{ color: colors.g2, fontWeight: 600 }}>
You’re up to date!
</Text>
)}
<Text>
- <a href="https://actualbudget.org/docs/releases">Release Notes</a>
+ <ExternalLink to="https://actualbudget.org/docs/releases">
+ Release Notes
+ </ExternalLink>
</Text>
</View>
</Setting>
diff --git a/upcoming-release-notes/1184.md b/upcoming-release-notes/1184.md
new file mode 100644
index 0000000000..c6a158bb18
--- /dev/null
+++ b/upcoming-release-notes/1184.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [j-f1]
+---
+
+Consistently use `<ExternalLink />`