diff --git a/src/dashboardWebView/components/Contents/Item.tsx b/src/dashboardWebView/components/Contents/Item.tsx index 49f93bc3..74841042 100644 --- a/src/dashboardWebView/components/Contents/Item.tsx +++ b/src/dashboardWebView/components/Contents/Item.tsx @@ -250,49 +250,6 @@ export const Item: React.FunctionComponent = ({ ); - } else if (view === DashboardViewType.Structure) { - return ( -
-
- - - - - - -
- {pageData.date && ( - - )} - - {draftField && draftField.name && typeof pageData[draftField.name] !== "undefined" && ( - - )} - - -
-
-
- ); } return null; diff --git a/src/dashboardWebView/components/Contents/StructureItem.tsx b/src/dashboardWebView/components/Contents/StructureItem.tsx new file mode 100644 index 00000000..3deb5225 --- /dev/null +++ b/src/dashboardWebView/components/Contents/StructureItem.tsx @@ -0,0 +1,79 @@ +import { useRecoilValue } from 'recoil'; +import { MarkdownIcon } from '../../../panelWebView/components/Icons/MarkdownIcon'; +import { Page } from '../../models/Page'; +import { SettingsSelector } from '../../state'; +import { DateField } from '../Common/DateField'; +import { ContentActions } from './ContentActions'; +import { useMemo } from 'react'; +import { Status } from './Status'; +import * as React from 'react'; +import * as l10n from '@vscode/l10n'; +import { LocalizationKey } from '../../../localization'; +import useCard from '../../hooks/useCard'; +import { ItemSelection } from '../Common/ItemSelection'; +import { openFile } from '../../utils'; +import useSelectedItems from '../../hooks/useSelectedItems'; +import { cn } from '../../../utils/cn'; + +export interface IStructureItemProps extends Page { } + +export const StructureItem: React.FunctionComponent = ({ + ...pageData +}: React.PropsWithChildren) => { + const { selectedFiles } = useSelectedItems(); + const settings = useRecoilValue(SettingsSelector); + const draftField = useMemo(() => settings?.draftField, [settings]); + const { escapedTitle } = useCard(pageData, settings?.dashboardState?.contents?.cardFields); + + const isSelected = useMemo(() => selectedFiles.includes(pageData.fmFilePath), [selectedFiles, pageData.fmFilePath]); + + const onOpenFile = React.useCallback(() => { + openFile(pageData.fmFilePath); + }, [pageData.fmFilePath]); + + return ( +
+
+ + + + + + +
+ {pageData.date && ( + + )} + + {draftField && draftField.name && typeof pageData[draftField.name] !== "undefined" && ( + + )} + + +
+
+
+ ); +}; \ No newline at end of file diff --git a/src/dashboardWebView/components/Contents/StructureView.tsx b/src/dashboardWebView/components/Contents/StructureView.tsx index 0dedcf39..a429c292 100644 --- a/src/dashboardWebView/components/Contents/StructureView.tsx +++ b/src/dashboardWebView/components/Contents/StructureView.tsx @@ -3,7 +3,7 @@ import { ChevronRightIcon, FolderIcon } from '@heroicons/react/24/solid'; import * as React from 'react'; import { useMemo } from 'react'; import { Page } from '../../models'; -import { Item } from './Item'; +import { StructureItem } from './StructureItem'; export interface IStructureViewProps { pages: Page[]; @@ -112,7 +112,7 @@ export const StructureView: React.FunctionComponent = ({
    {node.pages.map((page, idx) => (
  • - +
  • ))}
@@ -156,7 +156,7 @@ export const StructureView: React.FunctionComponent = ({
    {node.pages.map((page, idx) => (
  • - +
  • ))}