From 46b314303ca758b818fbe08dc163112e30777aa4 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Mon, 20 Jan 2025 09:58:47 +0800 Subject: [PATCH] feat: enable pinned functionality for minapps and update 'flowith' configuration --- src/renderer/src/components/MinApp/index.tsx | 3 ++- src/renderer/src/config/minapps.ts | 3 ++- src/renderer/src/store/index.ts | 2 +- src/renderer/src/store/migrate.ts | 9 +++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/MinApp/index.tsx b/src/renderer/src/components/MinApp/index.tsx index 55659193..bc6c2c9c 100644 --- a/src/renderer/src/components/MinApp/index.tsx +++ b/src/renderer/src/components/MinApp/index.tsx @@ -1,6 +1,7 @@ /* eslint-disable react/no-unknown-property */ import { CloseOutlined, ExportOutlined, PushpinOutlined, ReloadOutlined } from '@ant-design/icons' import { isMac, isWindows } from '@renderer/config/constant' +import { DEFAULT_MIN_APPS } from '@renderer/config/minapps' import { useBridge } from '@renderer/hooks/useBridge' import { useMinapps } from '@renderer/hooks/useMinapps' import store from '@renderer/store' @@ -31,7 +32,7 @@ const PopupContainer: React.FC = ({ app, resolve }) => { useBridge() const canOpenExternalLink = app.url.startsWith('http://') || app.url.startsWith('https://') - const canPinned = !!app.id + const canPinned = DEFAULT_MIN_APPS.some((i) => i.id === app?.id) const onClose = async (_delay = 0.3) => { setOpen(false) diff --git a/src/renderer/src/config/minapps.ts b/src/renderer/src/config/minapps.ts index 6fc34b43..1562b66c 100644 --- a/src/renderer/src/config/minapps.ts +++ b/src/renderer/src/config/minapps.ts @@ -266,7 +266,8 @@ export const DEFAULT_MIN_APPS: MinAppType[] = [ id: 'flowith', name: 'Flowith', logo: FlowithAppLogo, - url: 'https://www.flowith.io/' + url: 'https://www.flowith.io/', + bodered: true } ] diff --git a/src/renderer/src/store/index.ts b/src/renderer/src/store/index.ts index 404af47d..641bcb20 100644 --- a/src/renderer/src/store/index.ts +++ b/src/renderer/src/store/index.ts @@ -30,7 +30,7 @@ const persistedReducer = persistReducer( { key: 'cherry-studio', storage, - version: 58, + version: 59, blacklist: ['runtime'], migrate }, diff --git a/src/renderer/src/store/migrate.ts b/src/renderer/src/store/migrate.ts index 453568bf..d7db10c2 100644 --- a/src/renderer/src/store/migrate.ts +++ b/src/renderer/src/store/migrate.ts @@ -871,6 +871,15 @@ const migrateConfig = { ) } return state + }, + '59': (state: RootState) => { + if (state.minapps) { + const flowith = DEFAULT_MIN_APPS.find((app) => app.id === 'flowith') + if (flowith) { + state.minapps.enabled.push(flowith) + } + } + return state } }