@fgv/ts-res-ui-components 5.0.0-21 → 5.0.0-23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +401 -155
- package/config/jest.setup.js +10 -0
- package/dist/ts-res-ui-components.d.ts +1657 -76
- package/lib/components/common/QualifierContextControl.js +4 -1
- package/lib/components/common/ResourceTreeView.js +4 -1
- package/lib/components/forms/GenericQualifierTypeEditForm.d.ts +26 -0
- package/lib/components/forms/GenericQualifierTypeEditForm.js +166 -0
- package/lib/components/forms/QualifierEditForm.d.ts +1 -1
- package/lib/components/forms/index.d.ts +2 -0
- package/lib/components/forms/index.js +1 -0
- package/lib/components/orchestrator/ResourceOrchestrator.d.ts +3 -0
- package/lib/components/orchestrator/ResourceOrchestrator.js +118 -51
- package/lib/components/pickers/ResourcePicker/ResourcePickerTree.js +32 -10
- package/lib/components/pickers/ResourcePicker/index.js +4 -2
- package/lib/components/views/CompiledView/index.js +75 -16
- package/lib/components/views/ConfigurationView/index.js +94 -35
- package/lib/components/views/FilterView/index.js +7 -4
- package/lib/components/views/GridView/EditableGridCell.d.ts +76 -0
- package/lib/components/views/GridView/EditableGridCell.js +224 -0
- package/lib/components/views/GridView/GridSelector.d.ts +43 -0
- package/lib/components/views/GridView/GridSelector.js +89 -0
- package/lib/components/views/GridView/MultiGridView.d.ts +85 -0
- package/lib/components/views/GridView/MultiGridView.js +196 -0
- package/lib/components/views/GridView/ResourceGrid.d.ts +38 -0
- package/lib/components/views/GridView/ResourceGrid.js +232 -0
- package/lib/components/views/GridView/SharedContextControls.d.ts +47 -0
- package/lib/components/views/GridView/SharedContextControls.js +95 -0
- package/lib/components/views/GridView/cells/BooleanCell.d.ts +44 -0
- package/lib/components/views/GridView/cells/BooleanCell.js +49 -0
- package/lib/components/views/GridView/cells/DropdownCell.d.ts +58 -0
- package/lib/components/views/GridView/cells/DropdownCell.js +182 -0
- package/lib/components/views/GridView/cells/StringCell.d.ts +57 -0
- package/lib/components/views/GridView/cells/StringCell.js +106 -0
- package/lib/components/views/GridView/cells/TriStateCell.d.ts +54 -0
- package/lib/components/views/GridView/cells/TriStateCell.js +112 -0
- package/lib/components/views/GridView/cells/index.d.ts +15 -0
- package/lib/components/views/GridView/cells/index.js +11 -0
- package/lib/components/views/GridView/index.d.ts +53 -0
- package/lib/components/views/GridView/index.js +212 -0
- package/lib/components/views/ImportView/index.js +22 -19
- package/lib/components/views/MessagesWindow/index.js +4 -1
- package/lib/components/views/ResolutionView/index.js +8 -5
- package/lib/contexts/ObservabilityContext.d.ts +85 -0
- package/lib/contexts/ObservabilityContext.js +98 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/contexts/index.js +24 -0
- package/lib/hooks/useConfigurationState.d.ts +3 -3
- package/lib/hooks/useResolutionState.js +850 -246
- package/lib/hooks/useResourceData.d.ts +7 -4
- package/lib/hooks/useResourceData.js +185 -184
- package/lib/index.d.ts +5 -1
- package/lib/index.js +8 -1
- package/lib/namespaces/GridTools.d.ts +136 -0
- package/lib/namespaces/GridTools.js +138 -0
- package/lib/namespaces/ObservabilityTools.d.ts +3 -0
- package/lib/namespaces/ObservabilityTools.js +23 -0
- package/lib/namespaces/ResolutionTools.d.ts +2 -1
- package/lib/namespaces/ResolutionTools.js +2 -0
- package/lib/namespaces/index.d.ts +2 -0
- package/lib/namespaces/index.js +2 -0
- package/lib/test/integration/observability.integration.test.d.ts +2 -0
- package/lib/test/unit/hooks/useResourceData.test.d.ts +2 -0
- package/lib/test/unit/utils/downloadHelper.test.d.ts +2 -0
- package/lib/test/unit/workflows/resolutionWorkflows.test.d.ts +2 -0
- package/lib/test/unit/workflows/resourceCreation.test.d.ts +2 -0
- package/lib/test/unit/workflows/resultPatternExtensions.test.d.ts +2 -0
- package/lib/test/unit/workflows/validation.test.d.ts +2 -0
- package/lib/types/index.d.ts +387 -20
- package/lib/types/index.js +2 -1
- package/lib/utils/cellValidation.d.ts +113 -0
- package/lib/utils/cellValidation.js +248 -0
- package/lib/utils/downloadHelper.d.ts +66 -0
- package/lib/utils/downloadHelper.js +195 -0
- package/lib/utils/observability/factories.d.ts +29 -0
- package/lib/utils/observability/factories.js +58 -0
- package/lib/utils/observability/implementations.d.ts +61 -0
- package/lib/utils/observability/implementations.js +103 -0
- package/lib/utils/observability/index.d.ts +4 -0
- package/lib/utils/observability/index.js +26 -0
- package/lib/utils/observability/interfaces.d.ts +30 -0
- package/lib/utils/observability/interfaces.js +23 -0
- package/lib/utils/resolutionEditing.js +2 -1
- package/lib/utils/resourceSelector.d.ts +97 -0
- package/lib/utils/resourceSelector.js +195 -0
- package/lib/utils/resourceSelectors.d.ts +146 -0
- package/lib/utils/resourceSelectors.js +233 -0
- package/lib/utils/tsResIntegration.d.ts +6 -41
- package/lib/utils/tsResIntegration.js +20 -16
- package/lib/utils/zipLoader/zipProcessingHelpers.d.ts +3 -2
- package/lib/utils/zipLoader/zipProcessingHelpers.js +6 -5
- package/lib-commonjs/components/common/QualifierContextControl.js +4 -1
- package/lib-commonjs/components/common/ResourceTreeView.js +4 -1
- package/lib-commonjs/components/forms/GenericQualifierTypeEditForm.js +171 -0
- package/lib-commonjs/components/forms/index.js +3 -1
- package/lib-commonjs/components/orchestrator/ResourceOrchestrator.js +118 -51
- package/lib-commonjs/components/pickers/ResourcePicker/ResourcePickerTree.js +32 -10
- package/lib-commonjs/components/pickers/ResourcePicker/index.js +4 -2
- package/lib-commonjs/components/views/CompiledView/index.js +75 -16
- package/lib-commonjs/components/views/ConfigurationView/index.js +93 -34
- package/lib-commonjs/components/views/FilterView/index.js +7 -4
- package/lib-commonjs/components/views/GridView/EditableGridCell.js +232 -0
- package/lib-commonjs/components/views/GridView/GridSelector.js +94 -0
- package/lib-commonjs/components/views/GridView/MultiGridView.js +201 -0
- package/lib-commonjs/components/views/GridView/ResourceGrid.js +237 -0
- package/lib-commonjs/components/views/GridView/SharedContextControls.js +100 -0
- package/lib-commonjs/components/views/GridView/cells/BooleanCell.js +54 -0
- package/lib-commonjs/components/views/GridView/cells/DropdownCell.js +187 -0
- package/lib-commonjs/components/views/GridView/cells/StringCell.js +111 -0
- package/lib-commonjs/components/views/GridView/cells/TriStateCell.js +117 -0
- package/lib-commonjs/components/views/GridView/cells/index.js +18 -0
- package/lib-commonjs/components/views/GridView/index.js +217 -0
- package/lib-commonjs/components/views/ImportView/index.js +22 -19
- package/lib-commonjs/components/views/MessagesWindow/index.js +4 -1
- package/lib-commonjs/components/views/ResolutionView/index.js +8 -5
- package/lib-commonjs/contexts/ObservabilityContext.js +104 -0
- package/lib-commonjs/contexts/index.js +30 -0
- package/lib-commonjs/hooks/useResolutionState.js +849 -245
- package/lib-commonjs/hooks/useResourceData.js +184 -215
- package/lib-commonjs/index.js +15 -1
- package/lib-commonjs/namespaces/GridTools.js +161 -0
- package/lib-commonjs/namespaces/ObservabilityTools.js +33 -0
- package/lib-commonjs/namespaces/ResolutionTools.js +10 -1
- package/lib-commonjs/namespaces/index.js +3 -1
- package/lib-commonjs/types/index.js +10 -0
- package/lib-commonjs/utils/cellValidation.js +253 -0
- package/lib-commonjs/utils/downloadHelper.js +198 -0
- package/lib-commonjs/utils/observability/factories.js +63 -0
- package/lib-commonjs/utils/observability/implementations.js +109 -0
- package/lib-commonjs/utils/observability/index.js +36 -0
- package/lib-commonjs/utils/observability/interfaces.js +24 -0
- package/lib-commonjs/utils/resolutionEditing.js +2 -1
- package/lib-commonjs/utils/resourceSelector.js +200 -0
- package/lib-commonjs/utils/resourceSelectors.js +242 -0
- package/lib-commonjs/utils/tsResIntegration.js +21 -16
- package/lib-commonjs/utils/zipLoader/zipProcessingHelpers.js +7 -5
- package/package.json +7 -7
- package/src/components/common/QualifierContextControl.tsx +0 -338
- package/src/components/common/ResolutionContextOptionsControl.tsx +0 -450
- package/src/components/common/ResolutionResults/index.tsx +0 -481
- package/src/components/common/ResourceListView.tsx +0 -167
- package/src/components/common/ResourcePickerOptionsControl.tsx +0 -351
- package/src/components/common/ResourceTreeView.tsx +0 -417
- package/src/components/common/SourceResourceDetail/index.tsx +0 -493
- package/src/components/forms/HierarchyEditor.tsx +0 -285
- package/src/components/forms/QualifierEditForm.tsx +0 -487
- package/src/components/forms/QualifierTypeEditForm.tsx +0 -458
- package/src/components/forms/ResourceTypeEditForm.tsx +0 -437
- package/src/components/forms/index.ts +0 -11
- package/src/components/orchestrator/ResourceOrchestrator.tsx +0 -444
- package/src/components/pickers/ResourcePicker/README.md +0 -570
- package/src/components/pickers/ResourcePicker/ResourceItem.tsx +0 -127
- package/src/components/pickers/ResourcePicker/ResourcePickerList.tsx +0 -114
- package/src/components/pickers/ResourcePicker/ResourcePickerTree.tsx +0 -461
- package/src/components/pickers/ResourcePicker/index.tsx +0 -234
- package/src/components/pickers/ResourcePicker/types.ts +0 -301
- package/src/components/pickers/ResourcePicker/utils/treeNavigation.ts +0 -210
- package/src/components/views/CompiledView/index.tsx +0 -1342
- package/src/components/views/ConfigurationView/index.tsx +0 -848
- package/src/components/views/FilterView/index.tsx +0 -681
- package/src/components/views/ImportView/index.tsx +0 -789
- package/src/components/views/MessagesWindow/index.tsx +0 -325
- package/src/components/views/ResolutionView/EditableJsonView.tsx +0 -386
- package/src/components/views/ResolutionView/NewResourceModal.tsx +0 -158
- package/src/components/views/ResolutionView/UnifiedChangeControls.tsx +0 -163
- package/src/components/views/ResolutionView/index.tsx +0 -751
- package/src/components/views/SourceView/index.tsx +0 -291
- package/src/hooks/useConfigurationState.ts +0 -436
- package/src/hooks/useFilterState.ts +0 -150
- package/src/hooks/useResolutionState.ts +0 -893
- package/src/hooks/useResourceData.ts +0 -596
- package/src/hooks/useViewState.ts +0 -97
- package/src/index.ts +0 -68
- package/src/namespaces/ConfigurationTools.ts +0 -59
- package/src/namespaces/FilterTools.ts +0 -47
- package/src/namespaces/ImportTools.ts +0 -42
- package/src/namespaces/PickerTools.ts +0 -104
- package/src/namespaces/ResolutionTools.ts +0 -68
- package/src/namespaces/ResourceTools.ts +0 -106
- package/src/namespaces/TsResTools.ts +0 -49
- package/src/namespaces/ViewStateTools.ts +0 -91
- package/src/namespaces/ZipTools.ts +0 -49
- package/src/namespaces/index.ts +0 -49
- package/src/types/index.ts +0 -1273
- package/src/utils/configurationUtils.ts +0 -339
- package/src/utils/fileProcessing.ts +0 -164
- package/src/utils/filterResources.ts +0 -356
- package/src/utils/resolutionEditing.ts +0 -346
- package/src/utils/resolutionUtils.ts +0 -740
- package/src/utils/tsResIntegration.ts +0 -475
- package/src/utils/zipLoader/index.ts +0 -5
- package/src/utils/zipLoader/zipProcessingHelpers.ts +0 -46
- package/src/utils/zipLoader/zipUtils.ts +0 -7
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
import React, { useState, useMemo, useCallback } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
DocumentTextIcon,
|
|
4
|
-
MagnifyingGlassIcon,
|
|
5
|
-
DocumentArrowDownIcon,
|
|
6
|
-
CodeBracketIcon,
|
|
7
|
-
ChevronDownIcon,
|
|
8
|
-
ChevronUpIcon
|
|
9
|
-
} from '@heroicons/react/24/outline';
|
|
10
|
-
import { Resources, ResourceJson } from '@fgv/ts-res';
|
|
11
|
-
import { Result } from '@fgv/ts-utils';
|
|
12
|
-
import { SourceViewProps } from '../../../types';
|
|
13
|
-
import { ResourcePicker } from '../../pickers/ResourcePicker';
|
|
14
|
-
import { ResourceSelection, ResourcePickerOptions } from '../../pickers/ResourcePicker/types';
|
|
15
|
-
import { SourceResourceDetail } from '../../common/SourceResourceDetail';
|
|
16
|
-
import { ResourcePickerOptionsControl } from '../../common/ResourcePickerOptionsControl';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* SourceView component for browsing and managing source resource collections.
|
|
20
|
-
*
|
|
21
|
-
* Provides an interface for browsing source resources in their original form,
|
|
22
|
-
* viewing resource details including candidates and conditions, and exporting
|
|
23
|
-
* the complete source resource collection.
|
|
24
|
-
*
|
|
25
|
-
* **Key Features:**
|
|
26
|
-
* - **Resource browsing**: Navigate through all resources with search and filtering
|
|
27
|
-
* - **Detailed resource view**: See resource structure, candidates, conditions, and values
|
|
28
|
-
* - **Export functionality**: Export the complete source resource collection as JSON
|
|
29
|
-
* - **Source-specific details**: View resources in their original source form
|
|
30
|
-
* - **Candidate analysis**: Examine resource candidates and their conditions
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* import { SourceView } from '@fgv/ts-res-ui-components';
|
|
35
|
-
*
|
|
36
|
-
* function MySourceBrowser() {
|
|
37
|
-
* const handleExport = () => {
|
|
38
|
-
* // Export source resources
|
|
39
|
-
* console.log('Exporting source resources...');
|
|
40
|
-
* };
|
|
41
|
-
*
|
|
42
|
-
* return (
|
|
43
|
-
* <SourceView
|
|
44
|
-
* resources={processedResources}
|
|
45
|
-
* onExport={handleExport}
|
|
46
|
-
* onMessage={(type, message) => console.log(`${type}: ${message}`)}
|
|
47
|
-
* />
|
|
48
|
-
* );
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
export const SourceView: React.FC<SourceViewProps> = ({
|
|
55
|
-
resources,
|
|
56
|
-
onExport,
|
|
57
|
-
onMessage,
|
|
58
|
-
pickerOptions,
|
|
59
|
-
pickerOptionsPresentation = 'hidden',
|
|
60
|
-
className = ''
|
|
61
|
-
}) => {
|
|
62
|
-
const [selectedResourceId, setSelectedResourceId] = useState<string | null>(null);
|
|
63
|
-
const [showJsonView, setShowJsonView] = useState(false);
|
|
64
|
-
|
|
65
|
-
// State for picker options control
|
|
66
|
-
const [currentPickerOptions, setCurrentPickerOptions] = useState<ResourcePickerOptions>(
|
|
67
|
-
pickerOptions || {}
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
// Merge picker options with view-specific defaults
|
|
71
|
-
const effectivePickerOptions = useMemo(
|
|
72
|
-
() => ({
|
|
73
|
-
defaultView: 'list' as const,
|
|
74
|
-
showViewToggle: true,
|
|
75
|
-
enableSearch: true,
|
|
76
|
-
searchPlaceholder: 'Search resources...',
|
|
77
|
-
searchScope: 'all' as const,
|
|
78
|
-
height: '560px',
|
|
79
|
-
emptyMessage: 'No resources available',
|
|
80
|
-
// Override with user-provided options
|
|
81
|
-
...pickerOptions,
|
|
82
|
-
// Override with current picker options from control
|
|
83
|
-
...currentPickerOptions
|
|
84
|
-
}),
|
|
85
|
-
[pickerOptions, currentPickerOptions]
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
// Handle resource selection with new enhanced callback
|
|
89
|
-
const handleResourceSelect = useCallback(
|
|
90
|
-
(selection: ResourceSelection) => {
|
|
91
|
-
setSelectedResourceId(selection.resourceId);
|
|
92
|
-
if (selection.resourceId) {
|
|
93
|
-
onMessage?.('info', `Selected resource: ${selection.resourceId}`);
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
[onMessage]
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
// Get full resource collection data using the new method
|
|
100
|
-
const getResourceCollectionData = useCallback(() => {
|
|
101
|
-
if (!resources?.system.resourceManager) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Check if this is a ResourceManagerBuilder (has getResourceCollectionDecl method)
|
|
106
|
-
if ('getResourceCollectionDecl' in resources.system.resourceManager) {
|
|
107
|
-
const collectionResult = resources.system.resourceManager.getResourceCollectionDecl();
|
|
108
|
-
if (collectionResult.isSuccess()) {
|
|
109
|
-
return {
|
|
110
|
-
...collectionResult.value,
|
|
111
|
-
metadata: {
|
|
112
|
-
exportedAt: new Date().toISOString(),
|
|
113
|
-
totalResources: resources.summary.totalResources,
|
|
114
|
-
type: 'ts-res-resource-collection'
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
} else {
|
|
118
|
-
onMessage?.('error', `Failed to get resource collection: ${collectionResult.message}`);
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
} else if (resources.compiledCollection) {
|
|
122
|
-
// For IResourceManager from bundles, use the compiled collection directly
|
|
123
|
-
return {
|
|
124
|
-
resources: resources.compiledCollection.resources || [],
|
|
125
|
-
metadata: {
|
|
126
|
-
exportedAt: new Date().toISOString(),
|
|
127
|
-
totalResources: resources.summary.totalResources,
|
|
128
|
-
type: 'ts-res-resource-collection'
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
} else {
|
|
132
|
-
onMessage?.('error', 'Resource collection data not available');
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
}, [resources, onMessage]);
|
|
136
|
-
|
|
137
|
-
// Export source data to JSON file
|
|
138
|
-
const handleExportSourceData = useCallback(() => {
|
|
139
|
-
try {
|
|
140
|
-
const collectionData = getResourceCollectionData();
|
|
141
|
-
if (!collectionData) {
|
|
142
|
-
onMessage?.('error', 'No source collection data available to export');
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
onExport?.(collectionData, 'json');
|
|
147
|
-
onMessage?.('success', 'Resource collection exported successfully');
|
|
148
|
-
} catch (error) {
|
|
149
|
-
onMessage?.(
|
|
150
|
-
'error',
|
|
151
|
-
`Failed to export resource collection: ${error instanceof Error ? error.message : String(error)}`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}, [getResourceCollectionData, onExport, onMessage]);
|
|
155
|
-
|
|
156
|
-
if (!resources) {
|
|
157
|
-
return (
|
|
158
|
-
<div className={`p-6 ${className}`}>
|
|
159
|
-
<div className="flex items-center space-x-3 mb-6">
|
|
160
|
-
<DocumentTextIcon className="h-8 w-8 text-blue-600" />
|
|
161
|
-
<h2 className="text-2xl font-bold text-gray-900">Source Browser</h2>
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
<div className="bg-white rounded-lg shadow-sm border border-gray-200 p-8 text-center">
|
|
165
|
-
<div className="max-w-2xl mx-auto">
|
|
166
|
-
<h3 className="text-xl font-semibold text-gray-900 mb-4">No Resources Loaded</h3>
|
|
167
|
-
<p className="text-gray-600 mb-6">Import resources to explore them here.</p>
|
|
168
|
-
<div className="bg-blue-50 rounded-lg p-4">
|
|
169
|
-
<p className="text-sm text-blue-800">
|
|
170
|
-
<strong>Tip:</strong> Use the Import View to load ts-res resource files or directories, then
|
|
171
|
-
return here to browse and explore the loaded resources.
|
|
172
|
-
</p>
|
|
173
|
-
</div>
|
|
174
|
-
</div>
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<div className={`p-6 ${className}`}>
|
|
182
|
-
<div className="flex items-center justify-between mb-6">
|
|
183
|
-
<div className="flex items-center space-x-3">
|
|
184
|
-
<DocumentTextIcon className="h-8 w-8 text-blue-600" />
|
|
185
|
-
<h2 className="text-2xl font-bold text-gray-900">Source Browser</h2>
|
|
186
|
-
</div>
|
|
187
|
-
{resources && (
|
|
188
|
-
<div className="flex items-center space-x-2">
|
|
189
|
-
<button
|
|
190
|
-
onClick={handleExportSourceData}
|
|
191
|
-
className="inline-flex items-center px-3 py-1.5 border border-gray-300 text-xs font-medium rounded text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
192
|
-
>
|
|
193
|
-
<DocumentArrowDownIcon className="h-4 w-4 mr-1" />
|
|
194
|
-
Export JSON
|
|
195
|
-
</button>
|
|
196
|
-
</div>
|
|
197
|
-
)}
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
{/* ResourcePicker Options Control */}
|
|
201
|
-
<ResourcePickerOptionsControl
|
|
202
|
-
options={currentPickerOptions}
|
|
203
|
-
onOptionsChange={setCurrentPickerOptions}
|
|
204
|
-
presentation={pickerOptionsPresentation}
|
|
205
|
-
title="Source Browser Picker Options"
|
|
206
|
-
className="mb-6"
|
|
207
|
-
/>
|
|
208
|
-
|
|
209
|
-
{/* JSON View Toggle */}
|
|
210
|
-
{resources && (
|
|
211
|
-
<div className="bg-white rounded-lg shadow-sm border border-gray-200 p-4 mb-6">
|
|
212
|
-
<button
|
|
213
|
-
onClick={() => setShowJsonView(!showJsonView)}
|
|
214
|
-
className="inline-flex items-center px-3 py-1.5 text-sm font-medium text-gray-700 hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
215
|
-
>
|
|
216
|
-
<CodeBracketIcon className="h-4 w-4 mr-2" />
|
|
217
|
-
{showJsonView ? 'Hide' : 'Show'} JSON Resource Collection
|
|
218
|
-
{showJsonView ? (
|
|
219
|
-
<ChevronUpIcon className="h-4 w-4 ml-2" />
|
|
220
|
-
) : (
|
|
221
|
-
<ChevronDownIcon className="h-4 w-4 ml-2" />
|
|
222
|
-
)}
|
|
223
|
-
</button>
|
|
224
|
-
|
|
225
|
-
{/* JSON View */}
|
|
226
|
-
{showJsonView && (
|
|
227
|
-
<div className="mt-4">
|
|
228
|
-
<div className="bg-gray-50 rounded-lg border border-gray-200 p-4">
|
|
229
|
-
<div className="flex items-center justify-between mb-2">
|
|
230
|
-
<h3 className="text-sm font-medium text-gray-900">Resource Collection (JSON)</h3>
|
|
231
|
-
<button
|
|
232
|
-
onClick={handleExportSourceData}
|
|
233
|
-
className="inline-flex items-center px-2 py-1 text-xs font-medium text-gray-700 bg-gray-100 rounded hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
|
234
|
-
>
|
|
235
|
-
<DocumentArrowDownIcon className="h-3 w-3 mr-1" />
|
|
236
|
-
Export
|
|
237
|
-
</button>
|
|
238
|
-
</div>
|
|
239
|
-
<pre className="text-xs text-gray-800 bg-white p-3 rounded border overflow-x-auto max-h-64 overflow-y-auto">
|
|
240
|
-
{JSON.stringify(getResourceCollectionData(), null, 2)}
|
|
241
|
-
</pre>
|
|
242
|
-
</div>
|
|
243
|
-
</div>
|
|
244
|
-
)}
|
|
245
|
-
</div>
|
|
246
|
-
)}
|
|
247
|
-
|
|
248
|
-
<div className="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
|
|
249
|
-
<div className="flex flex-col lg:flex-row gap-6 h-[600px]">
|
|
250
|
-
{/* Left side: Resource Picker */}
|
|
251
|
-
<div className="lg:w-1/2 flex flex-col">
|
|
252
|
-
<div className="flex items-center mb-4">
|
|
253
|
-
<h3 className="text-lg font-semibold text-gray-900">Resources</h3>
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
{/* Enhanced Resource Picker */}
|
|
257
|
-
<div className="flex-1 min-h-0">
|
|
258
|
-
<ResourcePicker
|
|
259
|
-
resources={resources}
|
|
260
|
-
selectedResourceId={selectedResourceId}
|
|
261
|
-
onResourceSelect={handleResourceSelect}
|
|
262
|
-
options={effectivePickerOptions}
|
|
263
|
-
onMessage={onMessage}
|
|
264
|
-
/>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
|
|
268
|
-
{/* Right side: Resource Details */}
|
|
269
|
-
<div className="lg:w-1/2 flex flex-col">
|
|
270
|
-
{selectedResourceId ? (
|
|
271
|
-
<SourceResourceDetail
|
|
272
|
-
resourceId={selectedResourceId}
|
|
273
|
-
processedResources={resources}
|
|
274
|
-
onMessage={onMessage}
|
|
275
|
-
/>
|
|
276
|
-
) : (
|
|
277
|
-
<div className="flex-1 flex items-center justify-center border border-gray-200 rounded-lg bg-gray-50">
|
|
278
|
-
<div className="text-center">
|
|
279
|
-
<DocumentTextIcon className="h-12 w-12 text-gray-400 mx-auto mb-4" />
|
|
280
|
-
<p className="text-gray-500">Select a resource to view details</p>
|
|
281
|
-
</div>
|
|
282
|
-
</div>
|
|
283
|
-
)}
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
);
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
export default SourceView;
|