Skip to content

Commit 5abaaba

Browse files
committed
Remove is_empty prop from Tabs component and simplify can_close logic to allow closing any tab when tabs_count is at least 1
1 parent b7146ab commit 5abaaba

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

‎packages/ui/src/components/editor/common/prompts/PromptField/PromptField.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
299299
<Tabs
300300
tabs_count={props.tabs_count}
301301
active_tab_index={props.active_tab_index}
302-
is_empty={!props.value}
303302
/>
304303
</div>
305304
<div className={styles['placeholder-text']}>{placeholder}</div>
@@ -322,7 +321,6 @@ export const PromptField: React.FC<PromptFieldProps> = (props) => {
322321
active_tab_index={props.active_tab_index}
323322
on_tabs_reorder={props.on_tabs_reorder}
324323
handle_input_click={handle_input_click}
325-
is_empty={!props.value}
326324
/>
327325
</div>
328326
<div

‎packages/ui/src/components/editor/common/prompts/PromptField/components/Tabs/Tabs.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ type Props = {
88
active_tab_index: number
99
on_tabs_reorder?: (new_order: number[]) => void
1010
handle_input_click?: (e: React.MouseEvent<HTMLDivElement>) => void
11-
is_empty?: boolean
1211
}
1312

1413
export type TabsRef = {
@@ -86,9 +85,9 @@ export const Tabs = forwardRef<TabsRef, Props>((props, ref) => {
8685
filter={`.${styles['tabs__tab--new']}`}
8786
>
8887
{tab_items.map((item, i) => {
89-
const is_active = i === props.active_tab_index
90-
const is_hovered = hovered_tab_index === i
91-
const can_close = !(props.tabs_count === 1 && props.is_empty)
88+
const is_active = i == props.active_tab_index
89+
const is_hovered = hovered_tab_index == i
90+
const can_close = props.tabs_count >= 1
9291
const show_close =
9392
is_active &&
9493
is_hovered &&

0 commit comments

Comments
 (0)