Skip to content

A local-first personal finance app

feat: add SharedArrayBuffer warning indicator in title bar (#7922)

Awais Saeed6e5c39c55258
diff --git a/packages/desktop-client/src/components/SharedArrayBufferWarning.tsx b/packages/desktop-client/src/components/SharedArrayBufferWarning.tsx
new file mode 100644
index 0000000000..42079035e9
--- /dev/null
+++ b/packages/desktop-client/src/components/SharedArrayBufferWarning.tsx
@@ -0,0 +1,54 @@
+import { Trans } from 'react-i18next';
+
+import { SvgAlertTriangle } from '@actual-app/components/icons/v2';
+import { styles } from '@actual-app/components/styles';
+import { theme } from '@actual-app/components/theme';
+import { Tooltip } from '@actual-app/components/tooltip';
+import { css } from '@emotion/css';
+
+import { Link } from '#components/common/Link';
+
+export function SharedArrayBufferWarning() {
+ const hasSharedArrayBuffer = typeof SharedArrayBuffer !== 'undefined';
+
+ // Only show warning if SharedArrayBuffer is not supported
+ if (hasSharedArrayBuffer) {
+ return null;
+ }
+
+ return (
+ <Tooltip
+ placement="bottom start"
+ content={
+ <Trans>
+ Your environment does not support SharedArrayBuffer. You may
+ experience data loss or degraded functionality. Click to learn more.
+ </Trans>
+ }
+ style={{
+ ...styles.tooltip,
+ lineHeight: 1.5,
+ padding: '6px 10px',
+ marginTop: '10px',
+ width: '300px',
+ }}
+ >
+ <Link
+ variant="external"
+ to="https://actualbudget.org/docs/troubleshooting/shared-array-buffer"
+ className={css({
+ color: `${theme.warningText} !important`,
+ textDecoration: 'none',
+ padding: '4px 6px',
+ borderRadius: 4,
+ display: 'flex',
+ alignItems: 'center',
+ ':hover': { backgroundColor: theme.buttonBareBackgroundHover },
+ })}
+ >
+ <Trans>Warning</Trans>
+ <SvgAlertTriangle width={13} style={{ marginLeft: '6px' }} />
+ </Link>
+ </Tooltip>
+ );
+}
diff --git a/packages/desktop-client/src/components/Titlebar.tsx b/packages/desktop-client/src/components/Titlebar.tsx
index 88eba5de9f..ef4c467e18 100644
--- a/packages/desktop-client/src/components/Titlebar.tsx
+++ b/packages/desktop-client/src/components/Titlebar.tsx
@@ -13,8 +13,8 @@ import {
SvgViewShow,
} from '@actual-app/components/icons/v2';
import { SpaceBetween } from '@actual-app/components/space-between';
-import { styles } from '@actual-app/components/styles';
import type { CSSProperties } from '@actual-app/components/styles';
+import { styles } from '@actual-app/components/styles';
import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
@@ -24,6 +24,7 @@ import * as Platform from '@actual-app/core/shared/platform';
import { css } from '@emotion/css';
import { sync } from '#app/appSlice';
+import { SharedArrayBufferWarning } from '#components/SharedArrayBufferWarning';
import { useGlobalPref } from '#hooks/useGlobalPref';
import { useIsTestEnv } from '#hooks/useIsTestEnv';
import { useMetadataPref } from '#hooks/useMetadataPref';
@@ -344,6 +345,7 @@ export function Titlebar({ style }: TitlebarProps) {
{isDevelopmentEnvironment() && !isTestEnv && <ThemeSelector />}
<PrivacyButton />
{serverURL ? <ServerSyncButton /> : null}
+ <SharedArrayBufferWarning />
<LoggedInUser />
<HelpMenu />
</SpaceBetween>
diff --git a/packages/desktop-client/src/components/common/Link.tsx b/packages/desktop-client/src/components/common/Link.tsx
index aad94b0232..62da4dfe39 100644
--- a/packages/desktop-client/src/components/common/Link.tsx
+++ b/packages/desktop-client/src/components/common/Link.tsx
@@ -47,6 +47,7 @@ type ExternalLinkProps = {
to?: string;
linkColor?: keyof typeof externalLinkColors;
onClick?: MouseEventHandler;
+ className?: string;
};
const ExternalLink = ({
@@ -54,6 +55,7 @@ const ExternalLink = ({
to,
linkColor = 'blue',
onClick,
+ className,
}: ExternalLinkProps) => {
return (
// we can't use <ExternalLink /> here for obvious reasons
@@ -62,6 +64,7 @@ const ExternalLink = ({
target="_blank"
rel="noopener noreferrer"
style={{ color: externalLinkColors[linkColor] }}
+ className={className}
onClick={onClick}
>
{children}
diff --git a/upcoming-release-notes/7922.md b/upcoming-release-notes/7922.md
new file mode 100644
index 0000000000..f3e235889e
--- /dev/null
+++ b/upcoming-release-notes/7922.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [awaissaeed530]
+---
+
+Display a warning indicator in titlebar when browser does not support SharedArrayBuffer