Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions src/web-ui/src/app/scenes/shell/ShellNav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,19 @@
min-width: 0;
}

&__terminal-item {
&__terminal-item-row {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
height: 32px;
}

&__terminal-item {
display: flex;
flex-direction: column;
gap: 0;
width: 100%;
min-height: 32px;
padding: 0 $size-gap-2;
border: none;
border-radius: $size-radius-base;
Expand All @@ -343,10 +350,17 @@
font-size: var(--font-size-sm);
font-weight: 400;
position: relative;
justify-content: center;
transition:
color $motion-fast $easing-standard,
background $motion-fast $easing-standard;

&.has-cwd {
padding-top: 4px;
padding-bottom: 4px;
justify-content: center;
}

&:hover {
color: var(--color-text-primary);
background: var(--element-bg-medium, var(--element-bg-soft));
Expand Down Expand Up @@ -447,6 +461,17 @@
}
}

&__terminal-cwd {
display: block;
padding-left: 20px;
font-size: var(--font-size-xxs);
line-height: 1.3;
color: var(--color-text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&__cmd-indicator {
flex-shrink: 0;
padding: 2px 5px;
Expand Down
77 changes: 48 additions & 29 deletions src/web-ui/src/app/scenes/shell/components/ShellNavEntryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ interface ShellNavEntryItemProps {
) => void;
}

function getDisplayCwd(entry: ShellEntry): string | null {
const cwd = entry.workingDirectory ?? entry.cwd;
if (!cwd || cwd.trim().length === 0) {
return null;
}
return cwd;
}

const ShellNavEntryItem: React.FC<ShellNavEntryItemProps> = ({
entry,
isActive,
Expand All @@ -37,13 +45,16 @@ const ShellNavEntryItem: React.FC<ShellNavEntryItemProps> = ({
onOpen,
onOpenContextMenu,
}) => {
const displayCwd = getDisplayCwd(entry);

return (
<div
role="button"
tabIndex={0}
className={[
'bitfun-shell-nav__terminal-item',
isActive && 'is-active',
displayCwd && 'has-cwd',
].filter(Boolean).join(' ')}
onClick={() => { void onOpen(entry); }}
onKeyDown={(event) => {
Expand All @@ -60,40 +71,48 @@ const ShellNavEntryItem: React.FC<ShellNavEntryItemProps> = ({
onOpenContextMenu(event, menuItems, { entry });
}}
>
<Tooltip content={entry.name} placement="right">
<span className="bitfun-shell-nav__terminal-item-main">
{showSavedBadge ? (
<Bookmark size={14} className="bitfun-shell-nav__terminal-icon bitfun-shell-nav__terminal-icon--saved" />
) : (
<SquareTerminal size={14} className="bitfun-shell-nav__terminal-icon" />
)}
<div className="bitfun-shell-nav__terminal-item-row">
<Tooltip content={entry.name} placement="right">
<span className="bitfun-shell-nav__terminal-item-main">
{showSavedBadge ? (
<Bookmark size={14} className="bitfun-shell-nav__terminal-icon bitfun-shell-nav__terminal-icon--saved" />
) : (
<SquareTerminal size={14} className="bitfun-shell-nav__terminal-icon" />
)}

<span className="bitfun-shell-nav__terminal-label">{entry.name}</span>
<span className="bitfun-shell-nav__terminal-label">{entry.name}</span>

{showSavedBadge ? (
<span className="bitfun-shell-nav__saved-indicator">{savedBadgeLabel}</span>
) : null}
{showSavedBadge ? (
<span className="bitfun-shell-nav__saved-indicator">{savedBadgeLabel}</span>
) : null}

{entry.startupCommand ? (
<span className="bitfun-shell-nav__cmd-indicator">{startupCommandBadgeLabel}</span>
) : null}
{entry.startupCommand ? (
<span className="bitfun-shell-nav__cmd-indicator">{startupCommandBadgeLabel}</span>
) : null}

<span className={`bitfun-shell-nav__terminal-dot${entry.isRunning ? ' is-running' : ' is-stopped'}`} />
</span>
</Tooltip>
<span className={`bitfun-shell-nav__terminal-dot${entry.isRunning ? ' is-running' : ' is-stopped'}`} />
</span>
</Tooltip>

<Tooltip content={quickAction.title} placement="right">
<button
type="button"
className="bitfun-shell-nav__terminal-close"
onClick={(event) => {
event.stopPropagation();
quickAction.onClick();
}}
>
{quickAction.icon}
</button>
</Tooltip>
</div>

<Tooltip content={quickAction.title} placement="right">
<button
type="button"
className="bitfun-shell-nav__terminal-close"
onClick={(event) => {
event.stopPropagation();
quickAction.onClick();
}}
>
{quickAction.icon}
</button>
</Tooltip>
{displayCwd ? (
<span className="bitfun-shell-nav__terminal-cwd" title={displayCwd}>
{displayCwd}
</span>
) : null}
</div>
);
};
Expand Down
Loading