Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .changeset/desktop-sidebar-status-right.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@sfmc-bds/desktop": patch
---

实例状态灯移到侧栏右侧,实例名称与侧栏其余文字左对齐。
实例行与侧栏导航对齐:类型图标在名称前,状态灯在行尾。
17 changes: 11 additions & 6 deletions packages/desktop/src/renderer/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function profileSubtitle(profile: InstanceProfile): string {
: `${profile.username ? `${profile.username}@` : ""}${profile.host}${profile.port && profile.port !== 22 ? `:${profile.port}` : ""} ${profile.os === "windows" ? "Windows" : "Linux"}`;
}

/** 实例列表:每行一个实例,名称在左、状态点在右。当前实例高亮,悬停显示设置按钮 */
/** 实例列表:图标与名称对齐导航项,状态点在行尾。当前实例高亮,悬停显示设置按钮 */
function InstanceList({ collapsed }: { collapsed: boolean }) {
const { profiles, current, setCurrent, models, openProfileDialog } = useDesktop();
return (
Expand Down Expand Up @@ -50,13 +50,18 @@ function InstanceList({ collapsed }: { collapsed: boolean }) {
>
<button
type="button"
className="sb-instance-main"
className={cx("sb-item", "sb-instance-main", active && "active")}
aria-label={profile.name}
aria-current={active ? "true" : undefined}
onClick={() => setCurrent(profile.id)}
>
<span className="truncate">{profile.name}</span>
<Icon name={profile.kind === "ssh" ? "server" : "monitor"} size={14} className="sb-instance-kind" />
<Icon
name={profile.kind === "ssh" ? "server" : "monitor"}
size={20}
weight={active ? "fill" : "duotone"}
className="sb-instance-kind"
/>
<span className="sb-item-label truncate">{profile.name}</span>
<StatusDot tone={state.tone} pulse={state.tone === "info"} />
</button>
</Tooltip>
Expand All @@ -76,11 +81,11 @@ function InstanceList({ collapsed }: { collapsed: boolean }) {
<Tooltip content={collapsed ? "添加第一个实例" : undefined} side="right">
<button
type="button"
className="sb-instance-empty"
className="sb-item sb-instance-empty"
aria-label="添加第一个实例"
onClick={() => openProfileDialog(null)}
>
<Icon name="plus" size={14} />
<Icon name="plus" size={20} weight="duotone" />
<span className="sb-item-label">添加第一个实例</span>
</button>
</Tooltip>
Expand Down
41 changes: 13 additions & 28 deletions packages/desktop/src/renderer/styles/shell.css
Original file line number Diff line number Diff line change
Expand Up @@ -134,50 +134,38 @@
}

.sb-instance {
position: relative;
display: flex;
align-items: center;
border-radius: var(--r-12);
}

.sb-instance:hover,
.sb-instance.active {
background: var(--c-fill);
}

.sb-instance-main {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
height: 32px;
padding: 0 8px;
text-align: left;
}

.sb-instance-kind {
margin-left: auto;
color: var(--c-text-4);
}

.sb-instance-edit {
position: absolute;
right: 4px;
top: 50%;
transform: translateY(-50%);
opacity: 0;
margin-right: 2px;
pointer-events: none;
}

.sb-instance:hover .sb-instance-edit,
.sb-instance.active .sb-instance-edit,
.sb-instance-edit:focus-visible {
opacity: 1;
pointer-events: auto;
}

.sb-instance-empty {
display: flex;
align-items: center;
gap: 8px;
height: 32px;
padding: 0 8px;
border-radius: var(--r-12);
.sidebar-open .sb-instance:hover .sb-instance-main,
.sidebar-open .sb-instance.active .sb-instance-main {
padding-right: 36px;
}

.sb-item.sb-instance-empty {
color: var(--c-text-3);
}

Expand Down Expand Up @@ -311,9 +299,6 @@

.sidebar-collapsed .sb-instance-kind {
margin-left: 0;
width: 20px;
height: 20px;
color: var(--c-text-2);
}

.sidebar-collapsed .sb-instance-main > .status-dot {
Expand Down
Loading