Skip to content

Commit fc84a35

Browse files
committed
feat: Implement multiple resizable document panels, "open to side" functionality, and document persistence in the Data Explorer.
1 parent cc164e6 commit fc84a35

2 files changed

Lines changed: 107 additions & 36 deletions

File tree

frontend/components/JsonDisplay.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
import React, { useState, useRef, useEffect, useCallback } from 'react';
33
import { CheckIcon, ChevronDownIcon, ClipboardIcon, SearchIcon, XIcon, ArrowUpwardIcon, ArrowDownwardIcon, CaseSensitiveIcon, WholeWordIcon, RegexIcon, ImageIcon } from './icons/material-icons-imports';
44

5-
// Search context for highlighting and navigation
6-
interface SearchState {
7-
query: string;
8-
currentMatchIndex: number;
9-
totalMatches: number;
10-
isActive: boolean;
11-
}
5+
// Removed unused SearchState interface
126

137
// Helper function to highlight search matches in text
148
// Helper function to highlight search matches in text
@@ -65,7 +59,7 @@ const highlightText = (text: string, searchRegex: RegExp | null): React.ReactNod
6559
// Component to render ObjectId with both click navigation and copy functionality
6660
const ObjectIdDisplay: React.FC<{
6761
objectId: string;
68-
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void;
62+
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void;
6963
keyContext?: string;
7064
showAsLink?: boolean;
7165
}> = ({ objectId, onObjectIdClick, keyContext, showAsLink = true }) => {
@@ -175,6 +169,15 @@ const ObjectIdDisplay: React.FC<{
175169
>
176170
<span>Open in New Tab</span>
177171
</button>
172+
<button
173+
onClick={() => {
174+
setShowContextMenu(false);
175+
onObjectIdClick?.(objectId, keyContext, false, true);
176+
}}
177+
className="w-full text-left px-3 py-2 text-sm hover:bg-slate-100 dark:hover:bg-slate-700 flex items-center gap-2"
178+
>
179+
<span>Open to Side</span>
180+
</button>
178181
<div className="border-t border-slate-200 dark:border-slate-600 my-1"></div>
179182
<button
180183
onClick={handleCopyFromMenu}
@@ -296,7 +299,7 @@ const JsonNode: React.FC<{
296299
nodeValue: any;
297300
nodeKey?: string; // The key of this node, if it's in an object
298301
isRoot?: boolean; // The top-level object is not collapsible
299-
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void;
302+
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void;
300303
parentKeyContext?: string; // The key of the parent, used for context in clicks
301304
searchRegex?: RegExp | null; // Regex for highlighting
302305
currentMatchIndex?: number; // Current match index for highlighting
@@ -516,7 +519,7 @@ const JsonNode: React.FC<{
516519

517520
interface JsonDisplayProps {
518521
data: any;
519-
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void;
522+
onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void;
520523
}
521524

522525
const JsonDisplay: React.FC<JsonDisplayProps> = ({ data, onObjectIdClick }) => {

0 commit comments

Comments
 (0)