diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index 4a6c81d7..cebd70af 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -567,6 +567,8 @@ "notion.api_key_placeholder": "Enter Notion API Key", "notion.database_id": "Notion Database ID", "notion.database_id_placeholder": "Enter Notion Database ID", + "notion.page_name_key": "Page Title Field Name", + "notion.page_name_key_placeholder": "Enter page title field name, default is Name", "notion.title": "Notion Configuration", "notion.help": "Notion Configuration Documentation", "notion.check": { diff --git a/src/renderer/src/i18n/locales/ja-jp.json b/src/renderer/src/i18n/locales/ja-jp.json index 0ae3ba2b..1fae1c95 100644 --- a/src/renderer/src/i18n/locales/ja-jp.json +++ b/src/renderer/src/i18n/locales/ja-jp.json @@ -567,6 +567,8 @@ "notion.api_key_placeholder": "Notion APIキーを入力してください", "notion.database_id": "Notion データベースID", "notion.database_id_placeholder": "Notion データベースIDを入力してください", + "notion.page_name_key": "ページタイトルフィールド名", + "notion.page_name_key_placeholder": "ページタイトルフィールド名を入力してください。デフォルトは Name です", "notion.title": "Notion 設定", "notion.help": "Notion 設定ドキュメント", "notion.check": { diff --git a/src/renderer/src/i18n/locales/ru-ru.json b/src/renderer/src/i18n/locales/ru-ru.json index 0f9d8fdf..de2c6929 100644 --- a/src/renderer/src/i18n/locales/ru-ru.json +++ b/src/renderer/src/i18n/locales/ru-ru.json @@ -567,6 +567,8 @@ "notion.api_key_placeholder": "Введите ключ API Notion", "notion.database_id": "ID базы данных Notion", "notion.database_id_placeholder": "Введите ID базы данных Notion", + "notion.page_name_key": "Название поля заголовка страницы", + "notion.page_name_key_placeholder": "Введите название поля заголовка страницы, по умолчанию Name", "notion.title": "Настройки Notion", "notion.help": "Документация по настройке Notion", "notion.check": { diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index f5a13b0c..6db008c1 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -567,8 +567,10 @@ "notion.api_key_placeholder": "请输入Notion 密钥", "notion.database_id": "Notion 数据库 ID", "notion.database_id_placeholder": "请输入Notion 数据库 ID", + "notion.page_name_key": "页面标题字段名", + "notion.page_name_key_placeholder": "请输入页面标题字段名,默认为 Name", "notion.title": "Notion 配置", - "notion.help" : "Notion 配置文档", + "notion.help": "Notion 配置文档", "notion.check": { "button": "检查", "fail": "连接失败,请检查网络及Api_key和Database_id是否正确", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index d220154d..7844f882 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -565,6 +565,8 @@ "notion.api_key_placeholder": "請輸入Notion 密鑰", "notion.database_id": "Notion 資料庫 ID", "notion.database_id_placeholder": "請輸入Notion 資料庫 ID", + "notion.page_name_key": "頁面標題欄位名稱", + "notion.page_name_key_placeholder": "請輸入頁面標題欄位名稱,預設為 Name", "notion.title": "Notion 配置", "notion.help": "Notion 配置文檔", "notion.check": { diff --git a/src/renderer/src/pages/settings/DataSettings/DataSettings.tsx b/src/renderer/src/pages/settings/DataSettings/DataSettings.tsx index b51483c1..887c564d 100644 --- a/src/renderer/src/pages/settings/DataSettings/DataSettings.tsx +++ b/src/renderer/src/pages/settings/DataSettings/DataSettings.tsx @@ -5,7 +5,7 @@ import MinApp from '@renderer/components/MinApp' import { useTheme } from '@renderer/context/ThemeProvider' import { backup, reset, restore } from '@renderer/services/BackupService' import { RootState, useAppDispatch } from '@renderer/store' -import { setNotionApiKey, setNotionDatabaseID } from '@renderer/store/settings' +import { setNotionApiKey, setNotionDatabaseID, setNotionPageNameKey } from '@renderer/store/settings' import { AppInfo } from '@renderer/types' import { Button, Modal, Tooltip, Typography } from 'antd' import Input from 'antd/es/input/Input' @@ -23,10 +23,9 @@ const NotionSettings: FC = () => { const { theme } = useTheme() const dispatch = useAppDispatch() - // 这里可以添加 Notion 相关的状态和逻辑 - // 例如: const notionApiKey = useSelector((state: RootState) => state.settings.notionApiKey) const notionDatabaseID = useSelector((state: RootState) => state.settings.notionDatabaseID) + const notionPageNameKey = useSelector((state: RootState) => state.settings.notionPageNameKey) const handleNotionTokenChange = (e: React.ChangeEvent) => { dispatch(setNotionApiKey(e.target.value)) @@ -35,6 +34,11 @@ const NotionSettings: FC = () => { const handleNotionDatabaseIdChange = (e: React.ChangeEvent) => { dispatch(setNotionDatabaseID(e.target.value)) } + + const handleNotionPageNameKeyChange = (e: React.ChangeEvent) => { + dispatch(setNotionPageNameKey(e.target.value)) + } + const handleNotionConnectionCheck = () => { if (notionApiKey === null) { window.message.error(t('settings.data.notion.check.empty_api_key')) @@ -95,6 +99,20 @@ const NotionSettings: FC = () => { + + {t('settings.data.notion.page_name_key')} + + + + + {t('settings.data.notion.api_key')} diff --git a/src/renderer/src/store/settings.ts b/src/renderer/src/store/settings.ts index 03b51658..8fd8f46f 100644 --- a/src/renderer/src/store/settings.ts +++ b/src/renderer/src/store/settings.ts @@ -69,6 +69,7 @@ export interface SettingsState { multiModelMessageStyle: MultiModelMessageStyle notionDatabaseID: string | null notionApiKey: string | null + notionPageNameKey: string | null } export type MultiModelMessageStyle = 'horizontal' | 'vertical' | 'fold' | 'grid' @@ -123,7 +124,8 @@ const initialState: SettingsState = { clickTrayToShowQuickAssistant: false, multiModelMessageStyle: 'fold', notionDatabaseID: '', - notionApiKey: '' + notionApiKey: '', + notionPageNameKey: 'Name' } const settingsSlice = createSlice({ @@ -283,6 +285,9 @@ const settingsSlice = createSlice({ }, setNotionApiKey: (state, action: PayloadAction) => { state.notionApiKey = action.payload + }, + setNotionPageNameKey: (state, action: PayloadAction) => { + state.notionPageNameKey = action.payload } } }) @@ -336,7 +341,8 @@ export const { setEnableQuickAssistant, setMultiModelMessageStyle, setNotionDatabaseID, - setNotionApiKey + setNotionApiKey, + setNotionPageNameKey } = settingsSlice.actions export default settingsSlice.reducer diff --git a/src/renderer/src/utils/export.ts b/src/renderer/src/utils/export.ts index d00f95c4..5ce759af 100644 --- a/src/renderer/src/utils/export.ts +++ b/src/renderer/src/utils/export.ts @@ -67,7 +67,7 @@ export const exportTopicToNotion = async (topic: Topic) => { const response = await notion.pages.create({ parent: { database_id: notionDatabaseID }, properties: { - Name: { + [store.getState().settings.notionPageNameKey || 'Name']: { title: [{ text: { content: topic.name } }] } },