Document: {doc.name}
+ {!interactive && (
+ {
+ getOrderedNuggets(
+ docBase.organizationId,
+ docBase.name,
+ doc.name,
+ doc.content
+ );
+ }}
+ >
+ Get more information about this document
+
+ )}
-
+
);
}
diff --git a/src/providers/DocBaseTaskProvider.tsx b/src/providers/DocBaseTaskProvider.tsx
index ef1b5ec..10f2015 100644
--- a/src/providers/DocBaseTaskProvider.tsx
+++ b/src/providers/DocBaseTaskProvider.tsx
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
-import React, { ReactNode } from 'react';
+import React, { ReactNode, useEffect } from 'react';
import DocbaseViewer from '../components/DocbaseViewer/DocbaseViewer';
import DocBase from '../types/DocBase';
import {
@@ -10,6 +10,7 @@ import APIService from '../utils/ApiService';
import { useShowNotification } from './NotificationProvider';
import Logger from '../utils/Logger';
import { MyAudio, usePlayAudio } from './AudioProvider';
+import InteractiveDocBaseViewer from '../components/InteractiveDocBaseViewer/InteractiveDocBaseViewer';
const DocBaseTaskContext = React.createContext({
isDocbaseTaskRunning: (): boolean => {
@@ -27,6 +28,16 @@ const DocBaseTaskContext = React.createContext({
_attributes: string[]
) => {},
loadDocbaseTask: (_organizationId: number, _baseName: string) => {},
+ startInteractiveTablePopulation: (
+ _organizationId: number,
+ _baseName: string
+ ) => {},
+ getOrderedNuggets: (
+ _organizationId: number,
+ _baseName: string,
+ _documentName: string,
+ _documentContent: string
+ ) => {},
});
// eslint-disable-next-line react-refresh/only-export-components
@@ -73,6 +84,28 @@ export function useLoadDocbaseTask() {
return context.loadDocbaseTask;
}
+// eslint-disable-next-line react-refresh/only-export-components
+export function useStartInteractiveTablePopulation() {
+ const context = React.useContext(DocBaseTaskContext);
+ if (!context) {
+ throw new Error(
+ 'useStartInteractiveTablePopulation must be used within a DocBaseTaskProvider'
+ );
+ }
+ return context.startInteractiveTablePopulation;
+}
+
+// eslint-disable-next-line react-refresh/only-export-components
+export function useGetOrderedNuggets() {
+ const context = React.useContext(DocBaseTaskContext);
+ if (!context) {
+ throw new Error(
+ 'useGetOrderedNuggets must be used within a DocBaseTaskProvider'
+ );
+ }
+ return context.getOrderedNuggets;
+}
+
interface Props {
children: ReactNode;
}
@@ -89,10 +122,30 @@ export function DocBaseTaskProvider({ children }: Props) {
const intervalTime = 1000;
const [isRunning, setIsRunning] = React.useState(false);
+ const [useInteractiveViewer, setUseInteractiveViewer] =
+ React.useState(false);
const [docBase, setDocBase] = React.useState