@seasketch/geoprocessing
Version:
Geoprocessing and reporting framework for SeaSketch 2.0
46 lines (45 loc) • 1.77 kB
TypeScript
import React from "react";
import { SketchProperties } from "../types/index.js";
/**
* Provides necessary context to ReportClient components, particularly for
* use by useFunction() and useSketchProperties() hooks
*/
export interface ReportContextValue {
/** Geoprocessing project metadata with details on functions, clients, uris */
projectUrl: string;
/** uri where the sketch can be fetched */
geometryUri: string;
sketchProperties: SketchProperties;
exampleOutputs?: TestExampleOutput[];
simulateLoading?: boolean;
simulateError?: string;
visibleLayers: string[];
toggleLayerVisibility?: (layerId: string) => void;
language: string;
changeLanguage?: (language: string) => void;
}
export type PartialReportContextValue = Partial<{
/** Geoprocessing project metadata with details on functions, clients, uris */
projectUrl: string;
/** uri where the sketch can be fetched */
geometryUri: string;
sketchProperties: Partial<SketchProperties>;
exampleOutputs?: TestExampleOutput[];
simulateLoading?: boolean;
simulateError?: string;
visibleLayers: string[];
toggleLayerVisibility?: (layerId: string) => void;
language: string;
changeLanguage?: (language: string) => void;
}>;
export interface TestExampleOutput {
sketchName: string;
functionName: string;
results: any;
}
export declare const ReportContext: React.Context<ReportContextValue | null>;
export declare const defaultReportContext: ReportContextValue;
/**
* Creates a ReportContextValue object for a Sketch with sample values. overrides will be merged in, replacing default values
*/
export declare const sampleSketchReportContextValue: (overrides?: PartialReportContextValue) => ReportContextValue;