mirror of
https://github.com/nimbold/Firelink.git
synced 2026-08-06 01:17:48 +00:00
fix(ui): harden RTL sidebar and desktop window controls
Keep custom Windows/Linux controls available during platform detection, preserve RTL table order while aligning filenames left, and persist sidebar placement overrides. Refs #17
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { shouldUseCustomWindowControls } from './platform';
|
||||
|
||||
describe('shouldUseCustomWindowControls', () => {
|
||||
it('keeps custom controls present while Windows/Linux detection is unresolved', () => {
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (X11; Linux x86_64)')).toBe(true);
|
||||
});
|
||||
|
||||
it('does not render custom controls for macOS', () => {
|
||||
expect(shouldUseCustomWindowControls('unknown', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(false);
|
||||
expect(shouldUseCustomWindowControls('macos', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 14_0)')).toBe(false);
|
||||
});
|
||||
|
||||
it('only opts into the supported desktop platforms', () => {
|
||||
expect(shouldUseCustomWindowControls('windows', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('linux', 'Mozilla/5.0 (X11; Linux x86_64)')).toBe(true);
|
||||
expect(shouldUseCustomWindowControls('android', 'Mozilla/5.0 (Linux; Android 14)')).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -9,6 +9,9 @@ const fallback: PlatformInfo = {
|
||||
portable: false
|
||||
};
|
||||
|
||||
export const shouldUseCustomWindowControls = (os: string, userAgent: string): boolean =>
|
||||
!userAgent.includes('Mac') && (os === 'windows' || os === 'linux' || os === 'unknown');
|
||||
|
||||
let cached: PlatformInfo | null = null;
|
||||
let pending: Promise<PlatformInfo> | null = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user