Added Dataset Builder

This commit is contained in:
Jeremy Rangel
2025-01-15 23:53:26 -08:00
parent 3c9d74e8f6
commit 06b8c30fa3
6 changed files with 438 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import { __ } from '@wordpress/i18n';
import { SelectControl, TextareaControl, Button, TextControl } from '@wordpress/components';
import { useState, useEffect } from '@wordpress/element';
import { MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
import LCPDatasetBuilder from './LCPDatasetBuilder';
const DEFAULT_COLORS = [
'#FF6384', '#36A2EB', '#FFCE56', '#4BC0C0', '#9966FF',
@ -43,6 +44,7 @@ const LCPDataSelector = ({ value, onChange, dataSource, onDataSourceChange }) =>
{ label: __('Manual JSON', 'lcp'), value: 'manual_json' },
{ label: __('CSV Upload', 'lcp'), value: 'csv_upload' },
{ label: __('CSV URL', 'lcp'), value: 'csv_url' },
{ label: __('Dataset Builder', 'lcp'), value: 'dataset_builder' },
];
const validateJsonData = (jsonString) => {
@ -170,6 +172,15 @@ const LCPDataSelector = ({ value, onChange, dataSource, onDataSourceChange }) =>
onChange={onDataSourceChange}
/>
{dataSource === 'dataset_builder' && (
<LCPDatasetBuilder
value={value}
onChange={(newValue) => {
onChange(newValue);
}}
/>
)}
{dataSource === 'manual_json' && (
<TextareaControl
label={__('JSON Data', 'lcp')}