Skip to content

Commit 27ff57e

Browse files
authored
Add a status-bar support menu and tidy release highlights (#1548)
* Remove custom devices from release highlights * Add a support popover beside status bar notifications * Match support icon styling to the notification bell
1 parent 2a618f4 commit 27ff57e

7 files changed

Lines changed: 261 additions & 8 deletions

File tree

‎desktop-app/e2e/tests/announcements.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test.describe('Announcements', () => {
3333

3434
await expect(app.page.getByText('MCP integration')).toBeVisible();
3535
await expect(app.page.getByText('Canvas mode', {exact: true})).toBeVisible();
36-
await expect(app.page.getByText('Custom devices', {exact: true})).toBeVisible();
36+
await expect(app.page.getByText('Custom devices', {exact: true})).toHaveCount(0);
3737
await expect(app.page.getByText('Enjoying Responsively?')).toBeVisible();
3838
await expect(app.page.getByRole('button', {name: 'Sponsor'})).toBeVisible();
3939

‎desktop-app/e2e/tests/status-bar.spec.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,25 @@ test.describe('Status Bar', () => {
3636
await expect(app.page.locator('[data-testid="status-text"]')).toContainText('device');
3737
});
3838

39+
test('heart opens support choices and Escape returns focus to the trigger', async ({app}) => {
40+
await app.dismissModals();
41+
42+
const heart = app.page
43+
.locator('[data-testid="status-bar"]')
44+
.getByRole('button', {name: 'Support Responsively'});
45+
await heart.click();
46+
await expect(heart).toHaveAttribute('aria-expanded', 'true');
47+
await expect(app.page.getByText('Enjoying Responsively?')).toBeVisible();
48+
await expect(app.page.getByRole('button', {name: 'Sponsor', exact: true})).toBeVisible();
49+
await expect(app.page.getByRole('button', {name: 'Star on GitHub'})).toBeVisible();
50+
await expect(app.page.getByRole('button', {name: 'Share Responsively'})).toBeVisible();
51+
52+
await app.page.keyboard.press('Escape');
53+
await expect(heart).toHaveAttribute('aria-expanded', 'false');
54+
await expect(app.page.getByRole('button', {name: 'Share Responsively'})).toBeHidden();
55+
await expect(heart).toBeFocused();
56+
});
57+
3958
test('notifications open from the status bar bell', async ({app}) => {
4059
await app.dismissModals();
4160

‎desktop-app/src/renderer/components/AnnouncementCard/index.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const shortVersion = (version: string) => version.split('.').slice(0, 2).join('.
2020
const WHATS_NEW_ROWS: Array<{icon: string; label: string}> = [
2121
{icon: 'lucide:plug-zap', label: 'MCP server — connect Claude, Codex & more'},
2222
{icon: 'lucide:presentation', label: 'Canvas mode for presentations & recordings'},
23-
{icon: 'lucide:smartphone', label: 'Custom devices with live preview'},
2423
];
2524

2625
/**

‎desktop-app/src/renderer/components/Notifications/Notifications.tsx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ const WHATS_NEW: Array<{icon: string; title: string; body: string; when: string}
2626
body: 'Free-arrange devices, add frames, hit Present for clean recordings.',
2727
when: '2.0',
2828
},
29-
{
30-
icon: 'lucide:smartphone',
31-
title: 'Custom devices',
32-
body: 'Create devices with exact size, DPR and UA from the Device Manager.',
33-
when: '2.0',
34-
},
3529
];
3630

3731
const Row = ({

‎desktop-app/src/renderer/components/StatusBar/index.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import useKeyboardShortcut, {
88
} from 'renderer/components/KeyboardShortcutsManager/useKeyboardShortcut';
99
import Popover from 'renderer/components/Popover';
1010
import Notifications from 'renderer/components/Notifications/Notifications';
11+
import SupportPopover from 'renderer/components/SupportPopover';
1112
import useLocalStorage from 'renderer/components/useLocalStorage/useLocalStorage';
1213
import {selectActiveSuite} from 'renderer/store/features/device-manager';
1314
import {
@@ -195,6 +196,8 @@ const StatusBar = () => {
195196
<Notifications />
196197
</Popover>
197198

199+
<SupportPopover />
200+
198201
<button
199202
type="button"
200203
title="Toggle UI theme"
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import {act, cleanup, fireEvent, render, screen, waitFor} from '@testing-library/react';
2+
import {IPC_MAIN_CHANNELS} from 'common/constants';
3+
import {SPONSOR_URL_BASE} from 'renderer/components/Notifications/Notifications';
4+
import SupportPopover from './index';
5+
6+
const openPopover = async () => {
7+
render(<SupportPopover />);
8+
fireEvent.click(screen.getByRole('button', {name: 'Support Responsively'}));
9+
await screen.findByText('Enjoying Responsively?');
10+
};
11+
12+
beforeEach(() => {
13+
vi.clearAllMocks();
14+
vi.mocked(window.electron.ipcRenderer.invoke).mockResolvedValue(undefined);
15+
});
16+
17+
afterEach(cleanup);
18+
19+
describe('SupportPopover', () => {
20+
it('opens support choices without opening a website or copying anything', async () => {
21+
await openPopover();
22+
23+
expect(screen.getByRole('button', {name: 'Sponsor'})).toBeVisible();
24+
expect(screen.getByRole('button', {name: 'Star on GitHub'})).toBeVisible();
25+
expect(screen.getByRole('button', {name: 'Share Responsively'})).toBeVisible();
26+
expect(window.electron.ipcRenderer.sendMessage).not.toHaveBeenCalled();
27+
expect(window.electron.ipcRenderer.invoke).not.toHaveBeenCalledWith(
28+
IPC_MAIN_CHANNELS.COPY_TO_CLIPBOARD,
29+
expect.anything()
30+
);
31+
});
32+
33+
it('opens the existing sponsor page and the public repository when selected', async () => {
34+
await openPopover();
35+
36+
fireEvent.click(screen.getByRole('button', {name: 'Sponsor'}));
37+
expect(window.electron.ipcRenderer.sendMessage).toHaveBeenLastCalledWith(
38+
IPC_MAIN_CHANNELS.OPEN_EXTERNAL,
39+
{url: `${SPONSOR_URL_BASE}&utm_term=support-popover`}
40+
);
41+
42+
fireEvent.click(screen.getByRole('button', {name: 'Star on GitHub'}));
43+
expect(window.electron.ipcRenderer.sendMessage).toHaveBeenLastCalledWith(
44+
IPC_MAIN_CHANNELS.OPEN_EXTERNAL,
45+
{url: 'https://github.com/responsively-org/responsively-app'}
46+
);
47+
});
48+
49+
it('copies the website link and resets the confirmation when reopened', async () => {
50+
await openPopover();
51+
52+
fireEvent.click(screen.getByRole('button', {name: 'Share Responsively'}));
53+
await waitFor(() => expect(screen.getByRole('status')).toHaveTextContent('Link copied!'));
54+
expect(window.electron.ipcRenderer.invoke).toHaveBeenCalledWith(
55+
IPC_MAIN_CHANNELS.COPY_TO_CLIPBOARD,
56+
'https://responsively.app'
57+
);
58+
expect(window.electron.ipcRenderer.sendMessage).not.toHaveBeenCalled();
59+
60+
fireEvent.click(screen.getByRole('button', {name: 'Support Responsively'}));
61+
await waitFor(() => expect(screen.queryByText('Enjoying Responsively?')).toBeNull());
62+
fireEvent.click(screen.getByRole('button', {name: 'Support Responsively'}));
63+
await waitFor(() =>
64+
expect(screen.getByRole('status')).toHaveTextContent('Copy a link to Responsively')
65+
);
66+
});
67+
68+
it.each(['resolve', 'reject'] as const)(
69+
'ignores a stale clipboard %s after reopening and starting another copy',
70+
async (outcome) => {
71+
await openPopover();
72+
let resolveOld!: () => void;
73+
let rejectOld!: (error: Error) => void;
74+
const oldCopy = new Promise<void>((resolve, reject) => {
75+
resolveOld = resolve;
76+
rejectOld = reject;
77+
});
78+
vi.mocked(window.electron.ipcRenderer.invoke).mockReturnValueOnce(oldCopy);
79+
fireEvent.click(screen.getByRole('button', {name: 'Share Responsively'}));
80+
expect(screen.getByRole('button', {name: 'Share Responsively'})).toBeDisabled();
81+
82+
fireEvent.click(screen.getByRole('button', {name: 'Support Responsively'}));
83+
await waitFor(() => expect(screen.queryByText('Enjoying Responsively?')).toBeNull());
84+
fireEvent.click(screen.getByRole('button', {name: 'Support Responsively'}));
85+
await screen.findByText('Enjoying Responsively?');
86+
expect(screen.getByRole('status')).toHaveTextContent('Copy a link to Responsively');
87+
88+
let resolveNew!: () => void;
89+
const newCopy = new Promise<void>((resolve) => {
90+
resolveNew = resolve;
91+
});
92+
vi.mocked(window.electron.ipcRenderer.invoke).mockReturnValueOnce(newCopy);
93+
fireEvent.click(screen.getByRole('button', {name: 'Share Responsively'}));
94+
95+
await act(async () => {
96+
if (outcome === 'resolve') resolveOld();
97+
else rejectOld(new Error('old request failed'));
98+
});
99+
expect(screen.getByRole('status')).toHaveTextContent('Copying link…');
100+
expect(screen.getByRole('button', {name: 'Share Responsively'})).toBeDisabled();
101+
102+
await act(async () => resolveNew());
103+
expect(screen.getByRole('status')).toHaveTextContent('Link copied!');
104+
expect(screen.getByRole('button', {name: 'Share Responsively'})).toBeEnabled();
105+
}
106+
);
107+
108+
it('shows a retry message if the clipboard action fails', async () => {
109+
await openPopover();
110+
vi.mocked(window.electron.ipcRenderer.invoke).mockRejectedValueOnce(new Error('unavailable'));
111+
112+
fireEvent.click(screen.getByRole('button', {name: 'Share Responsively'}));
113+
await waitFor(() =>
114+
expect(screen.getByRole('status')).toHaveTextContent('Could not copy. Try again.')
115+
);
116+
expect(screen.getByRole('button', {name: 'Share Responsively'})).toBeEnabled();
117+
118+
fireEvent.click(screen.getByRole('button', {name: 'Share Responsively'}));
119+
await waitFor(() => expect(screen.getByRole('status')).toHaveTextContent('Link copied!'));
120+
});
121+
});
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import {Icon} from '@iconify/react';
2+
import {IPC_MAIN_CHANNELS} from 'common/constants';
3+
import {useRef, useState} from 'react';
4+
import {openSponsorPage} from 'renderer/components/Notifications/Notifications';
5+
import Popover from 'renderer/components/Popover';
6+
7+
const PROJECT_URL = 'https://github.com/responsively-org/responsively-app';
8+
const SHARE_URL = 'https://responsively.app';
9+
10+
const SupportPopover = () => {
11+
const [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'copied' | 'error'>('idle');
12+
const copyRequest = useRef(0);
13+
14+
const copyLink = async () => {
15+
const request = ++copyRequest.current;
16+
setCopyStatus('copying');
17+
try {
18+
await window.electron.ipcRenderer.invoke(IPC_MAIN_CHANNELS.COPY_TO_CLIPBOARD, SHARE_URL);
19+
if (request === copyRequest.current) {
20+
setCopyStatus('copied');
21+
}
22+
} catch {
23+
if (request === copyRequest.current) {
24+
setCopyStatus('error');
25+
}
26+
}
27+
};
28+
29+
const shareDescription = {
30+
idle: 'Copy a link to Responsively',
31+
copying: 'Copying link…',
32+
copied: 'Link copied!',
33+
error: 'Could not copy. Try again.',
34+
}[copyStatus];
35+
36+
return (
37+
<Popover
38+
triggerTitle="Support Responsively"
39+
anchor="top end"
40+
triggerClassName="flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-md text-[15px] text-muted transition-colors hover:bg-hover hover:text-fg"
41+
className="w-[260px] max-w-[calc(100vw-24px)] p-[14px]"
42+
onOpenChange={() => {
43+
// A previous panel session must not overwrite feedback after reopening.
44+
copyRequest.current += 1;
45+
setCopyStatus('idle');
46+
}}
47+
trigger={
48+
<span className="pointer-events-none inline-flex">
49+
<Icon icon="lucide:heart" />
50+
<span className="sr-only">Support Responsively</span>
51+
</span>
52+
}
53+
>
54+
<div className="mb-2 flex items-center gap-2 rounded-lg bg-heart-soft px-[10px] py-2">
55+
<Icon icon="lucide:heart" fontSize={13} className="shrink-0 text-heart" />
56+
<span className="text-[12.5px] font-bold text-fg">Enjoying Responsively?</span>
57+
</div>
58+
<div className="flex flex-col">
59+
<button
60+
type="button"
61+
aria-label="Sponsor"
62+
onClick={() => openSponsorPage('support-popover')}
63+
className="flex items-center gap-[10px] rounded-md px-2 py-2 text-left transition-colors hover:bg-heart-soft focus:outline-none focus-visible:ring-1 focus-visible:ring-heart"
64+
>
65+
<Icon icon="lucide:heart" fontSize={15} className="shrink-0 text-heart" />
66+
<span className="min-w-0 flex-1">
67+
<span className="block text-xs font-bold text-heart">Sponsor</span>
68+
<span className="block text-[11.5px] leading-[1.45] text-muted">
69+
Support development
70+
</span>
71+
</span>
72+
<Icon icon="lucide:arrow-up-right" fontSize={13} className="text-muted" />
73+
</button>
74+
<div className="my-1 border-t border-line-soft" />
75+
<button
76+
type="button"
77+
aria-label="Star on GitHub"
78+
onClick={() =>
79+
window.electron.ipcRenderer.sendMessage(IPC_MAIN_CHANNELS.OPEN_EXTERNAL, {
80+
url: PROJECT_URL,
81+
})
82+
}
83+
className="flex items-center gap-[10px] rounded-md px-2 py-2 text-left transition-colors hover:bg-hover focus:outline-none focus-visible:ring-1 focus-visible:ring-accent"
84+
>
85+
<Icon icon="lucide:star" fontSize={15} className="shrink-0 text-muted" />
86+
<span className="min-w-0 flex-1">
87+
<span className="block text-xs font-bold text-fg">Star</span>
88+
<span className="block text-[11.5px] leading-[1.45] text-muted">Star us on GitHub</span>
89+
</span>
90+
<Icon icon="lucide:arrow-up-right" fontSize={13} className="text-muted" />
91+
</button>
92+
<button
93+
type="button"
94+
aria-label="Share Responsively"
95+
disabled={copyStatus === 'copying'}
96+
onClick={() => void copyLink()}
97+
className="flex items-center gap-[10px] rounded-md px-2 py-2 text-left transition-colors hover:bg-hover focus:outline-none focus-visible:ring-1 focus-visible:ring-accent disabled:cursor-wait"
98+
>
99+
<Icon
100+
icon={copyStatus === 'copied' ? 'lucide:check' : 'lucide:share-2'}
101+
fontSize={15}
102+
className="shrink-0 text-muted"
103+
/>
104+
<span className="min-w-0 flex-1">
105+
<span className="block text-xs font-bold text-fg">Share</span>
106+
<span role="status" className="block text-[11.5px] leading-[1.45] text-muted">
107+
{shareDescription}
108+
</span>
109+
</span>
110+
<Icon icon="lucide:copy" fontSize={13} className="text-muted" />
111+
</button>
112+
</div>
113+
</Popover>
114+
);
115+
};
116+
117+
export default SupportPopover;

0 commit comments

Comments
 (0)