Skip to content

Commit cb00b8a

Browse files
committed
Implement resize functionality in state and import views
1 parent 5429eef commit cb00b8a

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

browser-extensions/chrome/src/panel/components/import/ImportView.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useStore } from "../../store";
1212
import { ImportList } from "./ImportList";
1313
import { TraceDetail } from "../detail/TraceDetail";
1414
import { SubscriptionDetail } from "../subscription/SubscriptionDetail";
15+
import { ResizeHandle } from "../layout/ResizeHandle";
1516

1617
interface ImportViewProps {
1718
viewState: ViewState;
@@ -98,9 +99,21 @@ export const ImportView: Component<ImportViewProps> = (props) => {
9899
input.click();
99100
};
100101

102+
const handleResize = (delta: number) => {
103+
const currentWidth = props.viewState.listPanelWidth;
104+
const newWidth = Math.max(
105+
200,
106+
Math.min(currentWidth + delta, window.innerWidth / 2)
107+
);
108+
props.actions.updateViewState("listPanelWidth", newWidth);
109+
};
110+
101111
return (
102112
<div class="flex h-full w-full">
103-
<div class="w-70 border-r border-spoosh-border flex flex-col">
113+
<div
114+
class="shrink-0 border-r border-spoosh-border flex flex-col"
115+
style={{ width: `${props.viewState.listPanelWidth}px` }}
116+
>
104117
<div class="px-3 py-2 text-xs font-medium text-spoosh-text-muted border-b border-spoosh-border bg-spoosh-surface/50 flex items-center justify-between">
105118
<span>Imported Traces</span>
106119
{session() && (
@@ -120,6 +133,8 @@ export const ImportView: Component<ImportViewProps> = (props) => {
120133
/>
121134
</div>
122135

136+
<ResizeHandle onResize={handleResize} />
137+
123138
<div class="flex-1 min-w-0">
124139
<Show
125140
when={selectedItem()}

browser-extensions/chrome/src/panel/components/state/StateView.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { ViewState } from "../../App";
44
import { useStore } from "../../store";
55
import { StateList } from "./StateList";
66
import { StateDetail } from "./StateDetail";
7+
import { ResizeHandle } from "../layout/ResizeHandle";
78

89
type Actions = {
910
selectStateEntry: (key: string | null) => void;
@@ -50,9 +51,21 @@ export const StateView: Component<StateViewProps> = (props) => {
5051
props.actions.selectStateEntry(null);
5152
};
5253

54+
const handleResize = (delta: number) => {
55+
const currentWidth = props.viewState.listPanelWidth;
56+
const newWidth = Math.max(
57+
200,
58+
Math.min(currentWidth + delta, window.innerWidth / 2)
59+
);
60+
props.actions.updateViewState("listPanelWidth", newWidth);
61+
};
62+
5363
return (
5464
<div class="flex h-full w-full">
55-
<div class="w-70 border-r border-spoosh-border flex flex-col">
65+
<div
66+
class="shrink-0 border-r border-spoosh-border flex flex-col"
67+
style={{ width: `${props.viewState.listPanelWidth}px` }}
68+
>
5669
<div
5770
class="px-3 py-2 text-xs font-medium text-spoosh-text-muted border-b border-spoosh-border border-l-2 border-l-[#14b8a6]"
5871
style={{
@@ -69,6 +82,8 @@ export const StateView: Component<StateViewProps> = (props) => {
6982
/>
7083
</div>
7184

85+
<ResizeHandle onResize={handleResize} />
86+
7287
<div class="flex-1 min-w-0 h-full">
7388
<StateDetail
7489
entry={selectedEntry()}

0 commit comments

Comments
 (0)