Skip to content

Commit 8e467cf

Browse files
committed
Merge branch 'master' into DX-2210
2 parents ba2f475 + d75de19 commit 8e467cf

File tree

5 files changed

+35
-5
lines changed

5 files changed

+35
-5
lines changed

bun.lockb

3.82 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"zustand": "5.0.0"
5959
},
6060
"devDependencies": {
61-
"@playwright/test": "^1.53.1",
61+
"@playwright/test": "^1.56.1",
6262
"@types/node": "^22.8.4",
6363
"@types/react": "^18.3.12",
6464
"@types/react-dom": "^18.3.1",

src/components/databrowser/components/databrowser-tabs.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
import { restrictToHorizontalAxis } from "@dnd-kit/modifiers"
1515
import { horizontalListSortingStrategy, SortableContext, useSortable } from "@dnd-kit/sortable"
1616
import { CSS } from "@dnd-kit/utilities"
17-
import { IconChevronDown, IconPlus } from "@tabler/icons-react"
17+
import { IconChevronDown, IconMaximize, IconPlus } from "@tabler/icons-react"
1818

1919
import { Button } from "@/components/ui/button"
2020
import {
@@ -122,7 +122,7 @@ const SortableTab = ({ id }: { id: TabId }) => {
122122
)
123123
}
124124

125-
export const DatabrowserTabs = () => {
125+
export const DatabrowserTabs = ({ onFullScreenClick }: { onFullScreenClick?: () => void }) => {
126126
const { tabs, reorderTabs, selectedTab, selectTab } = useDatabrowserStore()
127127

128128
// Sort tabs with pinned tabs first
@@ -262,6 +262,17 @@ export const DatabrowserTabs = () => {
262262
<div className="flex items-center gap-1 pl-1">
263263
{isOverflow && <AddTabButton />}
264264
{tabs.length > 1 && <TabsListButton tabs={tabs} onSelectTab={selectTab} />}
265+
{onFullScreenClick && (
266+
<Button
267+
aria-label="Toggle fullscreen"
268+
variant="secondary"
269+
size="icon-sm"
270+
onClick={onFullScreenClick}
271+
className="flex-shrink-0 bg-blue-100 hover:bg-blue-600 hover:text-white"
272+
>
273+
<IconMaximize size={16} />
274+
</Button>
275+
)}
265276
</div>
266277
</div>
267278
</div>

src/components/databrowser/index.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,17 @@ export const RedisBrowser = ({
2929
hideTabs,
3030
storage,
3131
darkMode = "light",
32+
onFullScreenClick,
3233
}: RedisCredentials & {
3334
hideTabs?: boolean
3435

36+
/**
37+
* If defined, the databrowser will have a full screen button in the tab bar.
38+
* Clicking on the button will call this function.
39+
* @returns
40+
*/
41+
onFullScreenClick?: () => void
42+
3543
/**
3644
* Persistence storage for the Databrowser.
3745
*
@@ -73,7 +81,11 @@ export const RedisBrowser = ({
7381
<DarkModeProvider darkMode={darkMode}>
7482
<DatabrowserProvider storage={storage} rootRef={rootRef}>
7583
<TooltipProvider>
76-
<RedisBrowserRoot hideTabs={hideTabs} rootRef={rootRef} />
84+
<RedisBrowserRoot
85+
hideTabs={hideTabs}
86+
rootRef={rootRef}
87+
onFullScreenClick={onFullScreenClick}
88+
/>
7789
</TooltipProvider>
7890
</DatabrowserProvider>
7991
</DarkModeProvider>
@@ -85,11 +97,14 @@ export const RedisBrowser = ({
8597
const RedisBrowserRoot = ({
8698
hideTabs,
8799
rootRef,
100+
onFullScreenClick,
88101
}: {
89102
hideTabs?: boolean
90103
rootRef: React.RefObject<HTMLDivElement>
104+
onFullScreenClick?: () => void
91105
}) => {
92106
const theme = useDarkMode()
107+
93108

94109
useEffect(() => {
95110
portalWrapper.classList.add("text-zinc-700")
@@ -104,7 +119,7 @@ const RedisBrowserRoot = ({
104119
ref={rootRef}
105120
>
106121
<div className="flex h-full flex-col text-zinc-700">
107-
{!hideTabs && <DatabrowserTabs />}
122+
{!hideTabs && <DatabrowserTabs onFullScreenClick={onFullScreenClick} />}
108123
<DatabrowserInstances />
109124
</div>
110125
</div>

src/playground/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ const App = () => {
7272
<div style={{ height: "800px" }}>
7373
{credentials ? (
7474
<RedisBrowser
75+
onFullScreenClick={() => {
76+
// eslint-disable-next-line no-console
77+
console.log("Fullscreen button clicked")
78+
}}
7579
storage={{
7680
get: () => localStorage.getItem("redis-browser-data") || "",
7781
set: (value) => localStorage.setItem("redis-browser-data", value),

0 commit comments

Comments
 (0)