From c67a1f987029bd908f0cd879129f62cc403af07c Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Tue, 16 Jan 2024 21:12:28 +0100 Subject: [PATCH] View action added --- .../TaxonomyView/TaxonomyActions.tsx | 10 ++++-- .../TaxonomyView/TaxonomyManager.tsx | 2 +- .../TaxonomyView/TaxonomyTagging.tsx | 35 +++++++++++++++---- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx b/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx index fe8e4897..a1183b0b 100644 --- a/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx +++ b/src/dashboardWebView/components/TaxonomyView/TaxonomyActions.tsx @@ -2,10 +2,11 @@ import { Messenger } from '@estruyf/vscode/dist/client'; import { ArrowUpCircleIcon, PencilIcon, + PlusCircleIcon, PlusIcon, TagIcon, TrashIcon, -} from '@heroicons/react/24/outline'; +} from '@heroicons/react/24/solid'; import * as React from 'react'; import { useCallback } from 'react'; import { MergeIcon } from '../../../components/icons/MergeIcon'; @@ -68,7 +69,7 @@ export const TaxonomyActions: React.FunctionComponent = ( return ( <> -
+
{unmapped && ( = ( - +
+ + +
{l10n.t(LocalizationKey.commonEdit)}
diff --git a/src/dashboardWebView/components/TaxonomyView/TaxonomyManager.tsx b/src/dashboardWebView/components/TaxonomyView/TaxonomyManager.tsx index 5360342a..35108658 100644 --- a/src/dashboardWebView/components/TaxonomyView/TaxonomyManager.tsx +++ b/src/dashboardWebView/components/TaxonomyView/TaxonomyManager.tsx @@ -174,7 +174,7 @@ export const TaxonomyManager: React.FunctionComponent = ( {l10n.t(LocalizationKey.dashboardTaxonomyViewTaxonomyManagerTableHeadingName)} diff --git a/src/dashboardWebView/components/TaxonomyView/TaxonomyTagging.tsx b/src/dashboardWebView/components/TaxonomyView/TaxonomyTagging.tsx index 7fff6ee1..92cf5001 100644 --- a/src/dashboardWebView/components/TaxonomyView/TaxonomyTagging.tsx +++ b/src/dashboardWebView/components/TaxonomyView/TaxonomyTagging.tsx @@ -1,10 +1,10 @@ import * as React from 'react'; import { Page, PageMappings, SortingOption } from '../../models'; import { useRecoilValue } from 'recoil'; -import { SettingsSelector, SortingAtom } from '../../state'; +import { SettingsSelector } from '../../state'; import { getTaxonomyField } from '../../../helpers/getTaxonomyField'; import { Sorting } from '../../../helpers/Sorting'; -import { ArrowLeftIcon } from '@heroicons/react/24/outline'; +import { ArrowLeftIcon, EyeIcon } from '@heroicons/react/24/outline'; import { Button } from '../Common/Button'; import { VSCodeCheckbox } from '@vscode/webview-ui-toolkit/react'; import { FilterInput } from './FilterInput'; @@ -12,9 +12,10 @@ import { useDebounce } from '../../../hooks/useDebounce'; import * as l10n from '@vscode/l10n'; import { LocalizationKey } from '../../../localization'; import { sortPages } from '../../../utils/sortPages'; -import { messageHandler } from '@estruyf/vscode/dist/client'; +import { Messenger, messageHandler } from '@estruyf/vscode/dist/client'; import { DashboardMessage } from '../../DashboardMessage'; import { ExtensionState } from '../../../constants'; +import { LinkButton } from '../Common/LinkButton'; export interface ITaxonomyTaggingProps { taxonomy: string | null; @@ -123,6 +124,10 @@ export const TaxonomyTagging: React.FunctionComponent = ( return (!untaggedPages.find((p: Page) => p.fmFilePath === page.fmFilePath) && !pageMappings.untagged.find((p: Page) => p.fmFilePath === page.fmFilePath)) || pageMappings.tagged.find((p: Page) => p.fmFilePath === page.fmFilePath); }, [untaggedPages, pageMappings.tagged]); + const onFileView = (filePath: string) => { + Messenger.send(DashboardMessage.openFile, filePath); + } + React.useEffect(() => { messageHandler.request<{ key: string; value: SortingOption; }>(DashboardMessage.getState, { key: ExtensionState.Dashboard.Contents.Sorting @@ -173,12 +178,18 @@ export const TaxonomyTagging: React.FunctionComponent = ( > {l10n.t(LocalizationKey.commonTitle)} + + + {untaggedPages && sortedPages && sortedPages.map((page) => ( - - + + onCheckboxClick(page)} @@ -188,14 +199,24 @@ export const TaxonomyTagging: React.FunctionComponent = ( - + + + onFileView(page.fmFilePath)}> + + + {l10n.t(LocalizationKey.dashboardContentsContentActionsMenuItemView)} + + + ))}