diff --git a/package.json b/package.json index ff72f2a..d9729a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "joplin-plugin-note-categorization", - "version": "0.1.9", + "version": "0.1.10", "scripts": { "dist": "webpack --env joplin-plugin-config=buildMain && webpack --env joplin-plugin-config=buildExtraScripts && npm run copyAssets && webpack --env joplin-plugin-config=createArchive", "prepare": "npm run dist", diff --git a/src/manifest.json b/src/manifest.json index d285e31..eaf6d74 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 1, "id": "com.harsh16gupta.notecategorization", "app_min_version": "3.5", - "version": "0.1.9", + "version": "0.1.10", "name": "Note Categorization Plugin", "description": "AI-based note categorisation: clusters notes semantically, suggests tags and notebook structures, and detects stale notes.", "author": "Harsh Gupta", diff --git a/src/panel/setupPanel.ts b/src/panel/setupPanel.ts index d384a5d..8d93541 100644 --- a/src/panel/setupPanel.ts +++ b/src/panel/setupPanel.ts @@ -123,6 +123,7 @@ export async function setupPanel(operationState: OperationState): Promise Promise; fetchSettings: () => Promise; diff --git a/src/webview/context/useSettingsState.ts b/src/webview/context/useSettingsState.ts index ac2a04e..369a7b8 100644 --- a/src/webview/context/useSettingsState.ts +++ b/src/webview/context/useSettingsState.ts @@ -3,12 +3,18 @@ import * as React from 'react'; interface SettingsResponse { 'categorization.parentNotebook': string; 'categorization.changeLog': string; + 'categorization.applyMethod'?: 'both' | 'tags' | 'notebooks'; } export function useSettingsState() { - const [settings, setSettings] = React.useState({ + const [settings, setSettings] = React.useState<{ + parentNotebook: string; + changeLog: string; + applyMethod: 'both' | 'tags' | 'notebooks'; + }>({ parentNotebook: '', changeLog: '', + applyMethod: 'both', }); const fetchSettings = React.useCallback(async () => { @@ -20,6 +26,7 @@ export function useSettingsState() { setSettings({ parentNotebook: data['categorization.parentNotebook'] || '', changeLog: data['categorization.changeLog'] || '', + applyMethod: data['categorization.applyMethod'] || 'both', }); } } catch (err) { diff --git a/src/webview/pages/DashboardPage.tsx b/src/webview/pages/DashboardPage.tsx index 95b98f9..068e7e7 100644 --- a/src/webview/pages/DashboardPage.tsx +++ b/src/webview/pages/DashboardPage.tsx @@ -27,6 +27,7 @@ export const DashboardPage: React.FC = () => { undoError, undoSuccess, settings, + updateSetting, isNativeAiUsed, isAiNamingUsed, } = useAppState(); @@ -40,6 +41,19 @@ export const DashboardPage: React.FC = () => { const [isNativeAiDismissed, setIsNativeAiDismissed] = React.useState(false); const [isAiNamingDismissed, setIsAiNamingDismissed] = React.useState(false); + const [applyMethod, setApplyMethod] = React.useState<'both' | 'tags' | 'notebooks'>(settings.applyMethod || 'both'); + + React.useEffect(() => { + if (settings.applyMethod) { + setApplyMethod(settings.applyMethod); + } + }, [settings.applyMethod]); + + const handleApplyMethodChange = (newMethod: 'both' | 'tags' | 'notebooks') => { + setApplyMethod(newMethod); + updateSetting('categorization.applyMethod', newMethod); + }; + const { clusters, noise, sortedClusterIds } = React.useMemo(() => { const clusters: { [key: number]: number[] } = {}; const noise: number[] = []; @@ -86,7 +100,7 @@ export const DashboardPage: React.FC = () => { return; } applyChanges({ - method: 'both', + method: applyMethod, parentNotebookName: settings.parentNotebook || '', }); }; @@ -197,10 +211,32 @@ export const DashboardPage: React.FC = () => {
Apply the new categorization
- This will automatically move notes into their corresponding notebooks and apply the semantic - tags. + {applyMethod === 'both' && + 'This will automatically move notes into their corresponding notebooks and apply the semantic tags.'} + {applyMethod === 'tags' && + 'This will apply cluster and keyword tags to notes without moving them or creating notebooks.'} + {applyMethod === 'notebooks' && + 'This will create notebooks and move notes into them without creating or adding tags.'}
+ +
+ + +
+