From 9a944048e8154b72e19831cf484e96ac5ca607ae Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 18 Jan 2024 07:53:15 +0000 Subject: [PATCH] feat(core): experimental features ui (#5338) fix TOV-280 experimental features ui - enabled in the workspace settings for a cloud workspace; only show for workspace owner + early access - a disclaimer prompt will be shown before going to the next feature setting page - for now only show the ai poc switch, which controls the display of the ai tab in editor's sidepanel --- packages/common/env/src/global.ts | 1 - .../component/src/ui/switch/switch.tsx | 3 +- .../frontend/core/.webpack/runtime-config.ts | 8 - .../setting-modal/general-setting/index.tsx | 12 +- .../components/affine/setting-modal/index.tsx | 54 +- .../setting-modal/setting-sidebar/index.tsx | 217 +++-- .../setting-sidebar/style.css.ts | 27 +- .../affine/setting-modal/style.css.ts | 1 + .../components/affine/setting-modal/types.ts | 21 + .../experimental-features/arts.css.ts | 7 + .../experimental-features/arts.tsx | 18 + .../experimental-features/dark-art-svg.ts | 857 ++++++++++++++++++ .../experimental-features/index.css.ts | 64 ++ .../experimental-features/index.tsx | 149 +++ .../experimental-features/light-art-svg.ts | 843 +++++++++++++++++ .../setting-modal/workspace-setting/index.tsx | 21 +- .../workspace-list/index.tsx | 2 +- .../core/src/hooks/use-workspace-features.ts | 74 ++ .../detail-page/editor-sidebar/atoms.ts | 7 +- .../editor-sidebar/extensions/extensions.tsx | 17 +- .../frontend/graphql/src/graphql/index.ts | 13 + .../graphql/workspace-enabled-features.gql | 5 + packages/frontend/graphql/src/schema.ts | 14 + packages/frontend/i18n/src/resources/en.json | 8 + 24 files changed, 2297 insertions(+), 146 deletions(-) create mode 100644 packages/frontend/core/src/components/affine/setting-modal/types.ts create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/arts.css.ts create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/arts.tsx create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/dark-art-svg.ts create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/index.css.ts create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/index.tsx create mode 100644 packages/frontend/core/src/components/affine/setting-modal/workspace-setting/experimental-features/light-art-svg.ts create mode 100644 packages/frontend/core/src/hooks/use-workspace-features.ts create mode 100644 packages/frontend/graphql/src/graphql/workspace-enabled-features.gql diff --git a/packages/common/env/src/global.ts b/packages/common/env/src/global.ts index 7e9527be4e..40fbf74ee7 100644 --- a/packages/common/env/src/global.ts +++ b/packages/common/env/src/global.ts @@ -29,7 +29,6 @@ export const runtimeFlagsSchema = z.object({ enableEnhanceShareMode: z.boolean(), enablePayment: z.boolean(), enablePageHistory: z.boolean(), - enableCopilot: z.boolean(), // this is for the electron app serverUrlPrefix: z.string(), enableMoveDatabase: z.boolean(), diff --git a/packages/frontend/component/src/ui/switch/switch.tsx b/packages/frontend/component/src/ui/switch/switch.tsx index b26c896396..739d47e47f 100644 --- a/packages/frontend/component/src/ui/switch/switch.tsx +++ b/packages/frontend/component/src/ui/switch/switch.tsx @@ -19,6 +19,7 @@ export const Switch = ({ checked: checkedProp = false, onChange: onChangeProp, children, + className, ...otherProps }: SwitchProps) => { const [checkedState, setCheckedState] = useState(checkedProp); @@ -34,7 +35,7 @@ export const Switch = ({ ); return ( -