-
Notifications
You must be signed in to change notification settings - Fork 1
DX-1485: Multi tabs and search history #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
65458ea
feat: add multiple tab support
ytkimirti ab3be4c
feat: add search history
ytkimirti ee65c53
feat: add keyboard support to the search
ytkimirti 669505b
chore: unused import
ytkimirti 076d253
chore: remove unusued hook
ytkimirti 2921747
chore: rename the custom scroll component argument
ytkimirti 92f561e
chore: update playground for easier debugging
ytkimirti f00dcf6
feat: add hideTabs option and fix styles
ytkimirti db7492e
feat: add a credentials form to playground
ytkimirti 792425f
fix: use cloudflare version of redis to avoid direct process access
ytkimirti f9fbfc0
Merge branch 'master' into DX-1485
ytkimirti a6e1620
feat: add persistance support
ytkimirti 8f7b999
fix: prevent useEffect from working when tab is not active
ytkimirti 49fd950
fix: automatically rescan until a result shows up
ytkimirti a8dd13c
fix: only fetch when the tab is active
ytkimirti 6fc3865
fix: skeleton and empty styles
ytkimirti c037dc3
fix: refactor tabs and improve next tab selection logic when current …
ytkimirti f9995f5
feat: add useOverflow utility hook
ytkimirti 3faf449
fix: make the tooltip use portals
ytkimirti 4a8fac7
fix: search recomendations overflowing
ytkimirti 44f54dc
feat: show tooltip only when tabs is overflowing
ytkimirti f7efb5c
fix: adding new key sometimes throwing error
ytkimirti 5bc9a90
fix: not being able to click anywhere after closing delete key modal
ytkimirti d30c551
feat: add "copy key" to dropdown menu
ytkimirti 2d7875d
feat: make the "delete key" item red
ytkimirti 3ae114f
fix: add zustand migration
ytkimirti 3bb1d4b
fix: review
ytkimirti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/components/databrowser/components/databrowser-instance.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels" | ||
|
||
import { cn } from "@/lib/utils" | ||
import { Toaster } from "@/components/ui/toaster" | ||
import { DataDisplay } from "./display" | ||
import { Sidebar } from "./sidebar" | ||
import { KeysProvider } from "../hooks/use-keys" | ||
|
||
export const DatabrowserInstance = ({ hidden }: { hidden?: boolean }) => { | ||
return ( | ||
<KeysProvider> | ||
<div className={cn("h-full rounded-md bg-zinc-100", hidden && "hidden")}> | ||
<PanelGroup | ||
autoSaveId="persistence" | ||
direction="horizontal" | ||
className="h-full w-full gap-0.5 text-sm antialiased" | ||
> | ||
<Panel defaultSize={30} minSize={30}> | ||
<Sidebar /> | ||
</Panel> | ||
<PanelResizeHandle className="group flex h-full w-1.5 justify-center"> | ||
<div className="h-full border-r border-dashed border-zinc-200 transition-colors group-hover:border-zinc-300" /> | ||
</PanelResizeHandle> | ||
<Panel minSize={40}> | ||
<DataDisplay /> | ||
</Panel> | ||
</PanelGroup> | ||
<Toaster /> | ||
</div> | ||
</KeysProvider> | ||
) | ||
} |
65 changes: 65 additions & 0 deletions
65
src/components/databrowser/components/databrowser-tabs.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { IconPlus, IconX } from "@tabler/icons-react" | ||
|
||
import { cn } from "@/lib/utils" | ||
import { Button } from "@/components/ui/button" | ||
import type { TabId } from "@/store" | ||
import { useDatabrowserStore } from "@/store" | ||
import { TabTypeIcon } from "./tab-type-icon" | ||
|
||
const Tab = ({ id }: { id: TabId }) => { | ||
const { selectTab, selectedTab, tabs, removeTab } = useDatabrowserStore() | ||
ytkimirti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return ( | ||
<div | ||
onClick={() => selectTab(id)} | ||
className={cn( | ||
"flex h-9 translate-y-[1px] cursor-pointer items-center gap-2 rounded-t-lg border border-zinc-200 px-3 text-[13px] transition-colors", | ||
id === selectedTab | ||
? "border-b-white bg-white text-zinc-900" | ||
: "bg-zinc-100 hover:bg-zinc-50" | ||
)} | ||
> | ||
{tabs[id].selectedKey ? ( | ||
<> | ||
<TabTypeIcon selectedKey={tabs[id].selectedKey} /> | ||
<span className="max-w-32 truncate">{tabs[id].selectedKey}</span> | ||
</> | ||
) : ( | ||
"New Tab" | ||
)} | ||
{/* Only show close button if there's more than one tab */} | ||
{Object.keys(tabs).length > 1 && ( | ||
<button | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
removeTab(id) | ||
}} | ||
className="p-1 text-zinc-300 transition-colors hover:text-zinc-500" | ||
> | ||
<IconX size={16} /> | ||
</button> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export const DatabrowserTabs = () => { | ||
const { tabs, addTab } = useDatabrowserStore() | ||
|
||
return ( | ||
<div className="mb-2 flex items-center gap-1 border-b border-zinc-200"> | ||
{Object.keys(tabs).map((id) => ( | ||
<Tab id={id as TabId} key={id} /> | ||
))} | ||
<Button | ||
variant="secondary" | ||
size="icon-sm" | ||
onClick={addTab} | ||
className="mr-1 flex-shrink-0" | ||
title="Add new tab" | ||
> | ||
<IconPlus className="text-zinc-500" size={16} /> | ||
</Button> | ||
</div> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.