mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix(electron): set client border style to false by default on windows (#3960)
Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
1
.github/CLA.md
vendored
1
.github/CLA.md
vendored
@@ -60,3 +60,4 @@ Example:
|
|||||||
- Moeyua, @moeyua, 2023/04/22
|
- Moeyua, @moeyua, 2023/04/22
|
||||||
- Shishu, @shishudesu, 2023/05/19
|
- Shishu, @shishudesu, 2023/05/19
|
||||||
- Kushagra Singh, @kush002, 2023/06/28
|
- Kushagra Singh, @kush002, 2023/06/28
|
||||||
|
- Sarvesh Kumar, @sarvesh521 2023/08/25
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { isDesktop } from '@affine/env/constant';
|
|
||||||
import { atom, useAtom } from 'jotai';
|
import { atom, useAtom } from 'jotai';
|
||||||
import { atomWithStorage } from 'jotai/utils';
|
import { atomWithStorage } from 'jotai/utils';
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ export const fontStyleOptions = [
|
|||||||
}[];
|
}[];
|
||||||
|
|
||||||
const appSettingBaseAtom = atomWithStorage<AppSetting>('affine-settings', {
|
const appSettingBaseAtom = atomWithStorage<AppSetting>('affine-settings', {
|
||||||
clientBorder: isDesktop,
|
clientBorder: globalThis.platform !== 'win32',
|
||||||
fullWidthLayout: false,
|
fullWidthLayout: false,
|
||||||
windowFrameStyle: 'frameless',
|
windowFrameStyle: 'frameless',
|
||||||
fontStyle: 'Sans',
|
fontStyle: 'Sans',
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export const DeleteLeaveWorkspace = ({
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDelete(true);
|
setShowDelete(true);
|
||||||
}}
|
}}
|
||||||
testId="delete-workspace-button"
|
data-testid="delete-workspace-button"
|
||||||
>
|
>
|
||||||
<ArrowRightSmallIcon />
|
<ArrowRightSmallIcon />
|
||||||
</SettingRow>
|
</SettingRow>
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ export const AppearanceSettings = () => {
|
|||||||
const t = useAFFiNEI18N();
|
const t = useAFFiNEI18N();
|
||||||
|
|
||||||
const [appSettings, setAppSettings] = useAppSetting();
|
const [appSettings, setAppSettings] = useAppSetting();
|
||||||
|
|
||||||
const changeSwitch = useCallback(
|
const changeSwitch = useCallback(
|
||||||
(key: keyof AppSetting, checked: boolean) => {
|
(key: keyof AppSetting, checked: boolean) => {
|
||||||
setAppSettings({ [key]: checked });
|
setAppSettings({ [key]: checked });
|
||||||
@@ -131,6 +132,7 @@ export const AppearanceSettings = () => {
|
|||||||
desc={t[
|
desc={t[
|
||||||
'com.affine.settings.appearance.border-style-description'
|
'com.affine.settings.appearance.border-style-description'
|
||||||
]()}
|
]()}
|
||||||
|
data-testid="client-border-style-trigger"
|
||||||
>
|
>
|
||||||
<Switch
|
<Switch
|
||||||
checked={appSettings.clientBorder}
|
checked={appSettings.clientBorder}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { platform } from 'node:os';
|
import { platform } from 'node:os';
|
||||||
|
|
||||||
|
import { clickSideBarSettingButton } from '@affine-test/kit/utils/sidebar';
|
||||||
import { expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
|
||||||
import { test } from './fixture';
|
import { test } from './fixture';
|
||||||
@@ -80,6 +81,19 @@ if (platform() === 'darwin') {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test('clientBorder value should disable by default on window', async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
await clickSideBarSettingButton(page);
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
const settingItem = page.locator(
|
||||||
|
'[data-testid="client-border-style-trigger"]'
|
||||||
|
);
|
||||||
|
expect(await settingItem.locator('input').inputValue()).toEqual(
|
||||||
|
process.platform === 'win32' ? 'off' : 'on'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('app theme', async ({ page, electronApp }) => {
|
test('app theme', async ({ page, electronApp }) => {
|
||||||
const root = page.locator('html');
|
const root = page.locator('html');
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import type { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|||||||
|
|
||||||
import { settingRow } from './share.css';
|
import { settingRow } from './share.css';
|
||||||
|
|
||||||
interface SettingRowProps {
|
type SettingRowProps = {
|
||||||
name: ReactNode;
|
name: ReactNode;
|
||||||
desc: ReactNode;
|
desc: ReactNode;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
spreadCol?: boolean;
|
spreadCol?: boolean;
|
||||||
testId?: string;
|
'data-testid'?: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export const SettingRow = ({
|
export const SettingRow = ({
|
||||||
name,
|
name,
|
||||||
@@ -19,7 +19,7 @@ export const SettingRow = ({
|
|||||||
onClick,
|
onClick,
|
||||||
style,
|
style,
|
||||||
spreadCol = true,
|
spreadCol = true,
|
||||||
testId = '',
|
...props
|
||||||
}: PropsWithChildren<SettingRowProps>) => {
|
}: PropsWithChildren<SettingRowProps>) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -28,7 +28,7 @@ export const SettingRow = ({
|
|||||||
})}
|
})}
|
||||||
style={style}
|
style={style}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
data-testid={testId}
|
data-testid={props['data-testid']}
|
||||||
>
|
>
|
||||||
<div className="left-col">
|
<div className="left-col">
|
||||||
<div className="name">{name}</div>
|
<div className="name">{name}</div>
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ export const Switch = (props: SwitchProps) => {
|
|||||||
<input
|
<input
|
||||||
className={clsx(styles.inputStyle)}
|
className={clsx(styles.inputStyle)}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
value={isChecked ? 'on' : 'off'}
|
||||||
checked={isChecked}
|
checked={isChecked}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user