Mark preview tab as opened in double click

This commit is contained in:
Hakan Shehu
2025-04-24 17:44:27 +02:00
parent a0df904981
commit c10ec7e856
4 changed files with 12 additions and 1 deletions

View File

@@ -20,12 +20,14 @@ import { MessageContainerTab } from '@/renderer/components/messages/message-cont
interface ContainerTabTriggerProps { interface ContainerTabTriggerProps {
tab: ContainerTab; tab: ContainerTab;
onClose: () => void; onClose: () => void;
onOpen: () => void;
onMove: (before: string | null) => void; onMove: (before: string | null) => void;
} }
export const ContainerTabTrigger = ({ export const ContainerTabTrigger = ({
tab, tab,
onClose, onClose,
onOpen,
onMove, onMove,
}: ContainerTabTriggerProps) => { }: ContainerTabTriggerProps) => {
const [, dragRef] = useDrag<string>({ const [, dragRef] = useDrag<string>({
@@ -76,6 +78,11 @@ export const ContainerTabTrigger = ({
onClose(); onClose();
} }
}} }}
onDoubleClick={() => {
if (tab.preview) {
onOpen();
}
}}
ref={dragDropRef as React.LegacyRef<HTMLButtonElement>} ref={dragDropRef as React.LegacyRef<HTMLButtonElement>}
> >
<div className="overflow-hidden truncate"> <div className="overflow-hidden truncate">

View File

@@ -13,6 +13,7 @@ interface ContainerTabsProps {
onTabChange: (value: string) => void; onTabChange: (value: string) => void;
onFocus: () => void; onFocus: () => void;
onClose: (value: string) => void; onClose: (value: string) => void;
onOpen: (value: string) => void;
onMove: (tab: string, before: string | null) => void; onMove: (tab: string, before: string | null) => void;
} }
@@ -21,6 +22,7 @@ export const ContainerTabs = ({
onTabChange, onTabChange,
onFocus, onFocus,
onClose, onClose,
onOpen,
onMove, onMove,
}: ContainerTabsProps) => { }: ContainerTabsProps) => {
const activeTab = tabs.find((t) => t.active)?.path; const activeTab = tabs.find((t) => t.active)?.path;
@@ -54,6 +56,7 @@ export const ContainerTabs = ({
key={tab.path} key={tab.path}
tab={tab} tab={tab}
onClose={() => onClose(tab.path)} onClose={() => onClose(tab.path)}
onOpen={() => onOpen(tab.path)}
onMove={(before) => onMove(tab.path, before)} onMove={(before) => onMove(tab.path, before)}
/> />
))} ))}

View File

@@ -101,6 +101,7 @@ export const Layout = () => {
onFocus={() => { onFocus={() => {
handleFocus('left'); handleFocus('left');
}} }}
onOpen={handleOpenLeft}
onClose={handleCloseLeft} onClose={handleCloseLeft}
onTabChange={handleActivateLeft} onTabChange={handleActivateLeft}
onMove={handleMoveLeft} onMove={handleMoveLeft}
@@ -142,6 +143,7 @@ export const Layout = () => {
onFocus={() => { onFocus={() => {
handleFocus('right'); handleFocus('right');
}} }}
onOpen={handleOpenRight}
onTabChange={handleActivateRight} onTabChange={handleActivateRight}
onClose={handleCloseRight} onClose={handleCloseRight}
onMove={handleMoveRight} onMove={handleMoveRight}

View File

@@ -97,7 +97,6 @@ export type EmailPasswordResetInitInput = {
export type EmailPasswordResetCompleteInput = { export type EmailPasswordResetCompleteInput = {
id: string; id: string;
otp: string; otp: string;
email: string;
password: string; password: string;
platform: string; platform: string;
version: string; version: string;