style(settings): fold the Happ settings into four tabs

Seven tabs, several holding one or two settings, made the page hard to
scan. The encrypted-links switch moves above the tabs under
auto-detection, the colour profile joins the banners under Appearance &
Theme, and Android per-app proxy joins Network & TUN Engine. The QR
modal's settings link no longer needs a happTab selector, and the three
orphaned tab-label keys are dropped from every locale.
This commit is contained in:
MHSanaei
2026-09-27 16:06:42 +02:00
parent a33b2341e9
commit 8f47b53879
18 changed files with 103 additions and 209 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ describe('ClientQrModal Happ presentation', () => {
expect(view.onOpenChange).toHaveBeenCalledOnce();
expect(view.onOpenChange).toHaveBeenCalledWith(false);
expect(screen.getByTestId('location').textContent).toBe(
'/settings?subscriptionTab=happ&happTab=links#subscription',
'/settings?subscriptionTab=happ#subscription',
);
expect(HttpUtil.post).not.toHaveBeenCalled();
});
@@ -144,7 +144,7 @@ describe('SubscriptionGeneralTab', () => {
});
it.each([false, true])(
'updates the Happ link gate from its own tab when stored as %s',
'updates the Happ link gate beside auto-detection when stored as %s',
(enabled) => {
const updateSetting = vi.fn();
@@ -158,11 +158,6 @@ describe('SubscriptionGeneralTab', () => {
);
fireEvent.click(screen.getByRole('tab', { name: /Happ/ }));
expect(
screen.getByRole('tab', { name: /Routing & Rules/ }).getAttribute('aria-selected'),
).toBe('true');
expect(screen.queryByRole('switch', { name: 'Encrypted subscription links' })).toBeNull();
fireEvent.click(screen.getByRole('tab', { name: /Subscription Links/ }));
const linkSwitch = screen.getByRole('switch', { name: 'Encrypted subscription links' });
expect(linkSwitch.getAttribute('aria-checked')).toBe(String(enabled));
expect(updateSetting).not.toHaveBeenCalled();
@@ -172,51 +167,24 @@ describe('SubscriptionGeneralTab', () => {
},
);
it('opens the Happ link tab from the QR settings deep link without enabling generation', () => {
it('shows the Happ link gate from the QR settings deep link without enabling generation', () => {
const updateSetting = vi.fn();
renderWithProviders(
<MemoryRouter initialEntries={['/settings?subscriptionTab=happ&happTab=links#subscription']}>
<MemoryRouter initialEntries={['/settings?subscriptionTab=happ#subscription']}>
<SubscriptionGeneralTab
allSetting={new AllSetting({ happLinkEnable: false })}
updateSetting={updateSetting}
/>
<LocationProbe />
</MemoryRouter>,
);
expect(screen.getByRole('tab', { name: /Happ/ }).getAttribute('aria-selected')).toBe('true');
expect(
screen.getByRole('tab', { name: /Subscription Links/ }).getAttribute('aria-selected'),
).toBe('true');
expect(
screen
.getByRole('switch', { name: 'Encrypted subscription links' })
.getAttribute('aria-checked'),
).toBe('false');
expect(screen.getByTestId('location').textContent).toBe(
'/settings?subscriptionTab=happ&happTab=links#subscription',
);
expect(updateSetting).not.toHaveBeenCalled();
});
it.each(['', '&happTab=unknown'])(
'keeps the routing default for a general Happ deep link %s',
(query) => {
const updateSetting = vi.fn();
renderWithProviders(
<MemoryRouter initialEntries={['/settings?subscriptionTab=happ' + query + '#subscription']}>
<SubscriptionGeneralTab allSetting={new AllSetting()} updateSetting={updateSetting} />
</MemoryRouter>,
);
expect(screen.getByRole('tab', { name: /Happ/ }).getAttribute('aria-selected')).toBe('true');
expect(
screen.getByRole('tab', { name: /Routing & Rules/ }).getAttribute('aria-selected'),
).toBe('true');
expect(screen.queryByRole('switch', { name: 'Encrypted subscription links' })).toBeNull();
expect(updateSetting).not.toHaveBeenCalled();
},
);
});