fix: a serise of ui issues of new setting (#2920)

Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
Qi
2023-06-29 17:25:42 +08:00
committed by Alex Yang
parent f7b07f4216
commit 6f5f0ab986
11 changed files with 43 additions and 41 deletions

View File

@@ -27,6 +27,7 @@ on:
env: env:
DEBUG: napi:* DEBUG: napi:*
BUILD_TYPE: canary
APP_NAME: affine APP_NAME: affine
COVERAGE: true COVERAGE: true
MACOSX_DEPLOYMENT_TARGET: '10.13' MACOSX_DEPLOYMENT_TARGET: '10.13'
@@ -89,8 +90,6 @@ jobs:
name: Build @affine/web name: Build @affine/web
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
env:
RELEASE_VERSION: canary
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -109,9 +108,6 @@ jobs:
name: Build @affine/web (Desktop) name: Build @affine/web (Desktop)
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: development environment: development
env:
ENABLE_BOOKMARK_OPERATION: true
RELEASE_VERSION: canary
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

View File

@@ -19,7 +19,7 @@ export const blockSuiteFeatureFlags = {
*/ */
const buildPreset = { const buildPreset = {
stable: { stable: {
enableAllPageFilter: true, enableAllPageSaving: false,
enablePlugin: false, enablePlugin: false,
enableTestProperties: false, enableTestProperties: false,
enableBroadcastChannelProvider: true, enableBroadcastChannelProvider: true,
@@ -28,13 +28,14 @@ const buildPreset = {
changelogUrl: 'https://affine.pro/blog/what-is-new-affine-0620', changelogUrl: 'https://affine.pro/blog/what-is-new-affine-0620',
enablePreloading: true, enablePreloading: true,
enableNewSettingModal: false, enableNewSettingModal: false,
enableNewSettingUnstableApi: false,
enableSQLiteProvider: false, enableSQLiteProvider: false,
}, },
beta: {}, beta: {},
internal: {}, internal: {},
// canary will be aggressive and enable all features // canary will be aggressive and enable all features
canary: { canary: {
enableAllPageFilter: true, enableAllPageSaving: true,
enablePlugin: true, enablePlugin: true,
enableTestProperties: true, enableTestProperties: true,
enableBroadcastChannelProvider: true, enableBroadcastChannelProvider: true,
@@ -43,6 +44,7 @@ const buildPreset = {
changelogUrl: 'https://github.com/toeverything/AFFiNE/releases', changelogUrl: 'https://github.com/toeverything/AFFiNE/releases',
enablePreloading: true, enablePreloading: true,
enableNewSettingModal: true, enableNewSettingModal: true,
enableNewSettingUnstableApi: false,
enableSQLiteProvider: false, enableSQLiteProvider: false,
}, },
}; };
@@ -51,36 +53,43 @@ const buildPreset = {
buildPreset.beta = buildPreset.stable; buildPreset.beta = buildPreset.stable;
buildPreset.internal = buildPreset.stable; buildPreset.internal = buildPreset.stable;
const currentBuild = process.env.BUILD_ENV || 'stable'; const currentBuild = process.env.BUILD_TYPE || 'stable';
if (process.env.CI && !process.env.BUILD_TYPE) {
throw new Error('BUILD_ENV is required in CI');
}
const currentBuildPreset = buildPreset[currentBuild]; const currentBuildPreset = buildPreset[currentBuild];
const environmentPreset = { const environmentPreset = {
enablePlugin: process.env.ENABLE_PLUGIN enablePlugin: process.env.ENABLE_PLUGIN
? process.env.ENABLE_PLUGIN === 'true' ? process.env.ENABLE_PLUGIN === 'true'
: buildPreset.canary.enablePlugin, : currentBuildPreset.enablePlugin,
enableAllPageFilter: process.env.ENABLE_ALL_PAGE_FILTER enableAllPageSaving: process.env.ENABLE_ALL_PAGE_SAVING
? process.env.ENABLE_ALL_PAGE_FILTER === 'true' ? process.env.ENABLE_ALL_PAGE_FILTER === 'true'
: buildPreset.canary.enableAllPageFilter, : currentBuildPreset.enableAllPageSaving,
enableTestProperties: process.env.ENABLE_TEST_PROPERTIES enableTestProperties: process.env.ENABLE_TEST_PROPERTIES
? process.env.ENABLE_TEST_PROPERTIES === 'true' ? process.env.ENABLE_TEST_PROPERTIES === 'true'
: buildPreset.canary.enableTestProperties, : currentBuildPreset.enableTestProperties,
enableLegacyCloud: process.env.ENABLE_LEGACY_PROVIDER enableLegacyCloud: process.env.ENABLE_LEGACY_PROVIDER
? process.env.ENABLE_LEGACY_PROVIDER === 'true' ? process.env.ENABLE_LEGACY_PROVIDER === 'true'
: buildPreset.canary.enableLegacyCloud, : currentBuildPreset.enableLegacyCloud,
enableBroadcastChannelProvider: process.env.ENABLE_BC_PROVIDER enableBroadcastChannelProvider: process.env.ENABLE_BC_PROVIDER
? process.env.ENABLE_BC_PROVIDER !== 'false' ? process.env.ENABLE_BC_PROVIDER !== 'false'
: buildPreset.canary.enableBroadcastChannelProvider, : currentBuildPreset.enableBroadcastChannelProvider,
changelogUrl: process.env.CHANGELOG_URL ?? buildPreset.canary.changelogUrl, changelogUrl: process.env.CHANGELOG_URL ?? currentBuildPreset.changelogUrl,
enablePreloading: process.env.ENABLE_PRELOADING enablePreloading: process.env.ENABLE_PRELOADING
? process.env.ENABLE_PRELOADING === 'true' ? process.env.ENABLE_PRELOADING === 'true'
: buildPreset.canary.enablePreloading, : currentBuildPreset.enablePreloading,
enableNewSettingModal: process.env.ENABLE_NEW_SETTING_MODAL enableNewSettingModal: process.env.ENABLE_NEW_SETTING_MODAL
? process.env.ENABLE_NEW_SETTING_MODAL === 'true' ? process.env.ENABLE_NEW_SETTING_MODAL === 'true'
: buildPreset.canary.enableNewSettingModal, : currentBuildPreset.enableNewSettingModal,
enableSQLiteProvider: process.env.ENABLE_SQLITE_PROVIDER enableSQLiteProvider: process.env.ENABLE_SQLITE_PROVIDER
? process.env.ENABLE_SQLITE_PROVIDER === 'true' ? process.env.ENABLE_SQLITE_PROVIDER === 'true'
: buildPreset.canary.enableSQLiteProvider, : currentBuildPreset.enableSQLiteProvider,
enableNewSettingUnstableApi: process.env.ENABLE_NEW_SETTING_UNSTABLE_API
? process.env.ENABLE_NEW_SETTING_UNSTABLE_API === 'true'
: currentBuildPreset.enableNewSettingUnstableApi,
}; };
/** /**
@@ -91,7 +100,7 @@ const buildFlags = {
// environment preset will overwrite current build preset // environment preset will overwrite current build preset
// this environment variable is for debug proposes only // this environment variable is for debug proposes only
// do not put them into CI // do not put them into CI
...environmentPreset, ...(process.env.CI ? {} : environmentPreset),
}; };
export { buildFlags }; export { buildFlags };

View File

@@ -137,9 +137,7 @@ const PublishPanelLocal: FC<PublishPanelLocalProps> = ({
}} }}
style={{ marginTop: '12px' }} style={{ marginTop: '12px' }}
> >
{runtimeConfig.enableLegacyCloud {t['Enable AFFiNE Cloud']()}
? t['Enable AFFiNE Cloud']()
: 'Disable AFFiNE Cloud'}
</Button> </Button>
</SettingRow> </SettingRow>
<FakePublishPanelAffine workspace={workspace} /> <FakePublishPanelAffine workspace={workspace} />

View File

@@ -1,2 +0,0 @@
// Some settings are not implemented yet, but need to show in the setting modal when boss is watching.
export const IS_EXHIBITION = true;

View File

@@ -8,7 +8,6 @@ import { ArrowRightSmallIcon, OpenInNewIcon } from '@blocksuite/icons';
import { useCallback } from 'react'; import { useCallback } from 'react';
import { type AppSetting, useAppSetting } from '../../../../../atoms/settings'; import { type AppSetting, useAppSetting } from '../../../../../atoms/settings';
import { IS_EXHIBITION } from '../../config';
import { communityItem, communityWrapper, link } from './style.css'; import { communityItem, communityWrapper, link } from './style.css';
export const AboutAffine = () => { export const AboutAffine = () => {
@@ -23,7 +22,7 @@ export const AboutAffine = () => {
return ( return (
<> <>
<SettingHeader title={t['About AFFiNE']()} subtitle={t['None yet']()} /> <SettingHeader title={t['About AFFiNE']()} subtitle={t['None yet']()} />
{IS_EXHIBITION && environment.isDesktop ? ( {runtimeConfig.enableNewSettingUnstableApi && environment.isDesktop ? (
<SettingWrapper title={t['Version']()}> <SettingWrapper title={t['Version']()}>
<SettingRow <SettingRow
name={t['Check for updates']()} name={t['Check for updates']()}

View File

@@ -12,7 +12,6 @@ import {
windowFrameStyleOptions, windowFrameStyleOptions,
} from '../../../../../atoms/settings'; } from '../../../../../atoms/settings';
import { LanguageMenu } from '../../../language-menu'; import { LanguageMenu } from '../../../language-menu';
import { IS_EXHIBITION } from '../../config';
import { DateFormatSetting } from './date-format-setting'; import { DateFormatSetting } from './date-format-setting';
import { settingWrapper } from './style.css'; import { settingWrapper } from './style.css';
@@ -70,7 +69,7 @@ export const AppearanceSettings = () => {
<LanguageMenu /> <LanguageMenu />
</div> </div>
</SettingRow> </SettingRow>
{IS_EXHIBITION && environment.isDesktop ? ( {runtimeConfig.enableNewSettingUnstableApi && environment.isDesktop ? (
<SettingRow <SettingRow
name={t['Client Border Style']()} name={t['Client Border Style']()}
desc={t['Customize the appearance of the client.']()} desc={t['Customize the appearance of the client.']()}
@@ -91,7 +90,7 @@ export const AppearanceSettings = () => {
onChange={checked => changeSwitch('fullWidthLayout', checked)} onChange={checked => changeSwitch('fullWidthLayout', checked)}
/> />
</SettingRow> </SettingRow>
{IS_EXHIBITION && environment.isDesktop ? ( {runtimeConfig.enableNewSettingUnstableApi && environment.isDesktop ? (
<SettingRow <SettingRow
name={t['Window frame style']()} name={t['Window frame style']()}
desc={t['Customize appearance of Windows Client.']()} desc={t['Customize appearance of Windows Client.']()}
@@ -114,7 +113,7 @@ export const AppearanceSettings = () => {
</SettingRow> </SettingRow>
) : null} ) : null}
</SettingWrapper> </SettingWrapper>
{IS_EXHIBITION ? ( {runtimeConfig.enableNewSettingUnstableApi ? (
<SettingWrapper title={t['Date']()}> <SettingWrapper title={t['Date']()}>
<SettingRow <SettingRow
name={t['Date Format']()} name={t['Date Format']()}
@@ -154,9 +153,9 @@ export const AppearanceSettings = () => {
desc={t['None yet']()} desc={t['None yet']()}
> >
<Switch <Switch
checked={appSettings.disableBlurBackground} checked={!appSettings.disableBlurBackground}
onChange={checked => onChange={checked =>
changeSwitch('disableBlurBackground', checked) changeSwitch('disableBlurBackground', !checked)
} }
/> />
</SettingRow> </SettingRow>

View File

@@ -3,7 +3,8 @@ import { globalStyle, style } from '@vanilla-extract/css';
export const settingContent = style({ export const settingContent = style({
flexGrow: '1', flexGrow: '1',
height: '100%', height: '100%',
padding: '40px 0', padding: '40px 15px 20px',
overflowX: 'auto',
}); });
globalStyle(`${settingContent} .wrapper`, { globalStyle(`${settingContent} .wrapper`, {

View File

@@ -39,7 +39,7 @@ export function WorkspaceHeader({
}} }}
/> />
</div> </div>
{runtimeConfig.enableAllPageFilter && ( {runtimeConfig.enableAllPageSaving && (
<div> <div>
{setting.currentView.id !== NIL || {setting.currentView.id !== NIL ||
(setting.currentView.id === NIL && (setting.currentView.id === NIL &&

View File

@@ -16,7 +16,6 @@ export const navWrapperStyle = style({
zIndex: 2, zIndex: 2,
paddingBottom: '8px', paddingBottom: '8px',
backgroundColor: 'transparent', backgroundColor: 'transparent',
borderRight: '1px solid var(--affine-border-color)',
'@media': { '@media': {
[`(max-width: ${floatingMaxWidth}px)`]: { [`(max-width: ${floatingMaxWidth}px)`]: {
position: 'absolute', position: 'absolute',
@@ -42,6 +41,10 @@ export const navWrapperStyle = style({
}, },
'&.has-background': { '&.has-background': {
backgroundColor: 'var(--affine-white-60)', backgroundColor: 'var(--affine-white-60)',
borderRight: '1px solid var(--affine-border-color)',
},
'&.has-border': {
borderRight: '1px solid var(--affine-border-color)',
}, },
}, },
}); });

View File

@@ -97,6 +97,9 @@ export function AppSidebar(props: AppSidebarProps): ReactElement {
})} })}
className={clsx(navWrapperStyle, { className={clsx(navWrapperStyle, {
'has-background': environment.isDesktop && props.hasBackground, 'has-background': environment.isDesktop && props.hasBackground,
'has-border':
!environment.isDesktop ||
(environment.isDesktop && props.hasBackground),
})} })}
data-open={open} data-open={open}
data-is-macos-electron={isMacosDesktop} data-is-macos-electron={isMacosDesktop}

View File

@@ -50,12 +50,7 @@ declare global {
} }
export const buildFlagsSchema = z.object({ export const buildFlagsSchema = z.object({
/** enableAllPageSaving: z.boolean(),
* todo: remove this build flag when filter feature is ready.
*
* filter feature in the all pages.
*/
enableAllPageFilter: z.boolean(),
enablePlugin: z.boolean(), enablePlugin: z.boolean(),
enableTestProperties: z.boolean(), enableTestProperties: z.boolean(),
enableBroadcastChannelProvider: z.boolean(), enableBroadcastChannelProvider: z.boolean(),
@@ -64,6 +59,7 @@ export const buildFlagsSchema = z.object({
changelogUrl: z.string(), changelogUrl: z.string(),
enablePreloading: z.boolean(), enablePreloading: z.boolean(),
enableNewSettingModal: z.boolean(), enableNewSettingModal: z.boolean(),
enableNewSettingUnstableApi: z.boolean(),
enableSQLiteProvider: z.boolean(), enableSQLiteProvider: z.boolean(),
}); });