design(preview): organize address bar tools, move refresh button to far left

This commit is contained in:
2026-06-12 11:50:54 -07:00
parent a52557f35b
commit 2e8d9ddecc

View File

@@ -21,16 +21,6 @@ export function ProjectIconRail({ workspace, projectId, actions }: Props) {
return ( return (
<nav style={bar} aria-label="Project sections"> <nav style={bar} aria-label="Project sections">
{/* Dynamic Left Content Area (e.g. Preview Device Toggles & URL bar) */}
<div
style={{
display: "flex",
alignItems: "center",
gap: 12,
flex: 1,
minWidth: 0,
}}
>
<div style={primaryGroup}> <div style={primaryGroup}>
<Link <Link
href={`${projectBase}/preview`} href={`${projectBase}/preview`}
@@ -42,9 +32,7 @@ export function ProjectIconRail({ workspace, projectId, actions }: Props) {
textDecoration: "none", textDecoration: "none",
background: isPreviewActive ? "#ffffff" : "transparent", background: isPreviewActive ? "#ffffff" : "transparent",
color: isPreviewActive ? "#18181b" : "#71717a", color: isPreviewActive ? "#18181b" : "#71717a",
boxShadow: isPreviewActive boxShadow: isPreviewActive ? "0 1px 2px rgba(0,0,0,0.05)" : "none",
? "0 1px 2px rgba(0,0,0,0.05)"
: "none",
transition: "all 0.15s ease", transition: "all 0.15s ease",
}} }}
> >
@@ -60,9 +48,7 @@ export function ProjectIconRail({ workspace, projectId, actions }: Props) {
textDecoration: "none", textDecoration: "none",
background: !isPreviewActive ? "#ffffff" : "transparent", background: !isPreviewActive ? "#ffffff" : "transparent",
color: !isPreviewActive ? "#18181b" : "#71717a", color: !isPreviewActive ? "#18181b" : "#71717a",
boxShadow: !isPreviewActive boxShadow: !isPreviewActive ? "0 1px 2px rgba(0,0,0,0.05)" : "none",
? "0 1px 2px rgba(0,0,0,0.05)"
: "none",
transition: "all 0.15s ease", transition: "all 0.15s ease",
}} }}
> >
@@ -70,16 +56,24 @@ export function ProjectIconRail({ workspace, projectId, actions }: Props) {
</Link> </Link>
</div> </div>
{isPreviewActive && <PreviewDeviceToggles />}
</div>
{/* Right Content Area (Publish Button) */}
<div <div
style={{ style={{
display: "flex", display: "flex",
justifyContent: "flex-end",
alignItems: "center", alignItems: "center",
gap: 12, flex: 1,
minWidth: 0,
marginLeft: 12,
}}
>
{isPreviewActive && <PreviewDeviceToggles />}
</div>
<div
style={{
display: "flex",
alignItems: "center",
flexShrink: 0,
marginLeft: 12,
}} }}
> >
{actions} {actions}
@@ -102,9 +96,6 @@ function PreviewDeviceToggles() {
const displayUrl = running?.url ?? ""; const displayUrl = running?.url ?? "";
return ( return (
<div
style={{ display: "flex", alignItems: "center", gap: 8, width: "100%" }}
>
<div <div
style={{ style={{
display: "flex", display: "flex",
@@ -115,8 +106,8 @@ function PreviewDeviceToggles() {
padding: "4px 8px", padding: "4px 8px",
borderRadius: 8, borderRadius: 8,
height: 34, height: 34,
flex: 1, // Let the URL bar grow to fill the header space flex: 1,
minWidth: 320, minWidth: 0, // critical for input overflow to work
color: "#71717a", color: "#71717a",
fontSize: "0.75rem", fontSize: "0.75rem",
}} }}
@@ -136,6 +127,7 @@ function PreviewDeviceToggles() {
transition: "all 0.15s", transition: "all 0.15s",
background: "transparent", background: "transparent",
color: "#71717a", color: "#71717a",
flexShrink: 0,
}} }}
onMouseEnter={(e) => { onMouseEnter={(e) => {
e.currentTarget.style.background = "#e4e4e7"; e.currentTarget.style.background = "#e4e4e7";
@@ -148,14 +140,18 @@ function PreviewDeviceToggles() {
> >
<RotateCw size={12} /> <RotateCw size={12} />
</button> </button>
<div <div
style={{ style={{
width: 1, width: 1,
height: 14, height: 14,
background: "#e4e4e7", background: "#e4e4e7",
margin: "0 2px", margin: "0 2px",
flexShrink: 0,
}} }}
/> />
<span style={{ opacity: 0.6, flexShrink: 0 }}>🌐</span>
<input <input
type="text" type="text"
value={displayUrl} value={displayUrl}
@@ -165,7 +161,8 @@ function PreviewDeviceToggles() {
background: "transparent", background: "transparent",
border: "none", border: "none",
outline: "none", outline: "none",
width: "100%", flex: 1,
minWidth: 0,
color: "#18181b", color: "#18181b",
fontSize: "0.75rem", fontSize: "0.75rem",
textOverflow: "ellipsis", textOverflow: "ellipsis",
@@ -173,8 +170,20 @@ function PreviewDeviceToggles() {
}} }}
/> />
<div
style={{
width: 1,
height: 14,
background: "#e4e4e7",
margin: "0 4px",
flexShrink: 0,
}}
/>
{/* Device Toggles Inside the Address Bar */} {/* Device Toggles Inside the Address Bar */}
<div style={{ display: "flex", gap: 2, alignItems: "center", marginRight: 4 }}> <div
style={{ display: "flex", gap: 2, alignItems: "center", flexShrink: 0 }}
>
<button <button
onClick={() => setDeviceMode("desktop")} onClick={() => setDeviceMode("desktop")}
style={{ style={{
@@ -221,21 +230,30 @@ function PreviewDeviceToggles() {
height: 14, height: 14,
background: "#e4e4e7", background: "#e4e4e7",
margin: "0 4px", margin: "0 4px",
flexShrink: 0,
}} }}
/> />
{displayUrl && ( {displayUrl ? (
<a <a
href={displayUrl} href={displayUrl}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
title="Open preview in new tab" title="Open preview in new tab"
style={{ color: "#71717a", display: "flex", padding: "4px" }} style={{
color: "#71717a",
display: "flex",
padding: "4px",
flexShrink: 0,
}}
> >
<ExternalLink size={14} /> <ExternalLink size={14} />
</a> </a>
)} ) : (
<div style={{ padding: "4px", opacity: 0.3, flexShrink: 0 }}>
<ExternalLink size={14} />
</div> </div>
)}
</div> </div>
); );
} }