refactor(core): clear build config (#8268)

remove build config

allowLocalWorkspace -> FeatureFlag
enablePreloading -> removed
enableNewSettingUnstableApi -> removed
enableExperimentalFeature -> removed
enableThemeEditor -> FeatureFlag

remove some unused code
This commit is contained in:
EYHN
2024-09-18 06:33:24 +00:00
parent 46f8237a46
commit fab23d226d
17 changed files with 91 additions and 611 deletions

View File

@@ -31,12 +31,6 @@ export type BUILD_CONFIG_TYPE = {
imageProxyUrl: string;
linkPreviewUrl: string;
allowLocalWorkspace: boolean;
enablePreloading: boolean;
enableNewSettingUnstableApi: boolean;
enableExperimentalFeature: boolean;
enableThemeEditor: boolean;
// TODO(@forehalo): remove
isSelfHosted: boolean;
};

View File

@@ -8,20 +8,9 @@ setupGlobal();
const logger = new DebugLogger('affine:settings');
export type DateFormats =
| 'MM/dd/YYYY'
| 'dd/MM/YYYY'
| 'YYYY-MM-dd'
| 'YYYY.MM.dd'
| 'YYYY/MM/dd'
| 'dd-MMM-YYYY'
| 'dd MMMM YYYY';
export type AppSetting = {
clientBorder: boolean;
windowFrameStyle: 'frameless' | 'NativeTitleBar';
dateFormat: DateFormats;
startWeekOnMonday: boolean;
enableBlurBackground: boolean;
enableNoisyBackground: boolean;
autoCheckUpdate: boolean;
@@ -33,21 +22,9 @@ export const windowFrameStyleOptions: AppSetting['windowFrameStyle'][] = [
'NativeTitleBar',
];
export const dateFormatOptions: DateFormats[] = [
'MM/dd/YYYY',
'dd/MM/YYYY',
'YYYY-MM-dd',
'YYYY.MM.dd',
'YYYY/MM/dd',
'dd-MMM-YYYY',
'dd MMMM YYYY',
];
const appSettingBaseAtom = atomWithStorage<AppSetting>('affine-settings', {
clientBorder: BUILD_CONFIG.isElectron && !environment.isWindows,
windowFrameStyle: 'frameless',
dateFormat: dateFormatOptions[0],
startWeekOnMonday: false,
enableBlurBackground: true,
enableNoisyBackground: true,
autoCheckUpdate: true,

View File

@@ -118,6 +118,20 @@ export const AFFINE_FLAGS = {
configurable: isDesktopEnvironment,
defaultState: false,
},
enable_theme_editor: {
category: 'affine',
displayName: 'Theme Editor',
description: 'Enables theme editor.',
configurable: isCanaryBuild,
defaultState: isCanaryBuild,
},
enable_local_workspace: {
category: 'affine',
displayName: 'Allow create local workspace',
description: 'Allow create local workspace.',
configurable: isCanaryBuild,
defaultState: isDesktopEnvironment || isCanaryBuild,
},
} satisfies { [key in string]: FlagInfo };
export type AFFINE_FLAGS = typeof AFFINE_FLAGS;