fix(app): tighten up header elements
This commit is contained in:
@@ -138,12 +138,12 @@ function useSessionShare(args: {
|
|||||||
globalSDK: ReturnType<typeof useGlobalSDK>
|
globalSDK: ReturnType<typeof useGlobalSDK>
|
||||||
currentSession: () =>
|
currentSession: () =>
|
||||||
| {
|
| {
|
||||||
id: string
|
|
||||||
share?: {
|
share?: {
|
||||||
url?: string
|
url?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| undefined
|
| undefined
|
||||||
|
sessionID: () => string | undefined
|
||||||
projectDirectory: () => string
|
projectDirectory: () => string
|
||||||
platform: ReturnType<typeof usePlatform>
|
platform: ReturnType<typeof usePlatform>
|
||||||
}) {
|
}) {
|
||||||
@@ -167,11 +167,11 @@ function useSessionShare(args: {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const shareSession = () => {
|
const shareSession = () => {
|
||||||
const session = args.currentSession()
|
const sessionID = args.sessionID()
|
||||||
if (!session || state.share) return
|
if (!sessionID || state.share) return
|
||||||
setState("share", true)
|
setState("share", true)
|
||||||
args.globalSDK.client.session
|
args.globalSDK.client.session
|
||||||
.share({ sessionID: session.id, directory: args.projectDirectory() })
|
.share({ sessionID, directory: args.projectDirectory() })
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Failed to share session", error)
|
console.error("Failed to share session", error)
|
||||||
})
|
})
|
||||||
@@ -181,11 +181,11 @@ function useSessionShare(args: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unshareSession = () => {
|
const unshareSession = () => {
|
||||||
const session = args.currentSession()
|
const sessionID = args.sessionID()
|
||||||
if (!session || state.unshare) return
|
if (!sessionID || state.unshare) return
|
||||||
setState("unshare", true)
|
setState("unshare", true)
|
||||||
args.globalSDK.client.session
|
args.globalSDK.client.session
|
||||||
.unshare({ sessionID: session.id, directory: args.projectDirectory() })
|
.unshare({ sessionID, directory: args.projectDirectory() })
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Failed to unshare session", error)
|
console.error("Failed to unshare session", error)
|
||||||
})
|
})
|
||||||
@@ -243,9 +243,9 @@ export function SessionHeader() {
|
|||||||
})
|
})
|
||||||
const hotkey = createMemo(() => command.keybind("file.open"))
|
const hotkey = createMemo(() => command.keybind("file.open"))
|
||||||
|
|
||||||
const currentSession = createMemo(() => sync.data.session.find((s) => s.id === params.id))
|
const currentSession = createMemo(() => (params.id ? sync.session.get(params.id) : undefined))
|
||||||
const shareEnabled = createMemo(() => sync.data.config.share !== "disabled")
|
const shareEnabled = createMemo(() => sync.data.config.share !== "disabled")
|
||||||
const showShare = createMemo(() => shareEnabled() && !!currentSession())
|
const showShare = createMemo(() => shareEnabled() && !!params.id)
|
||||||
const sessionKey = createMemo(() => `${params.dir}${params.id ? "/" + params.id : ""}`)
|
const sessionKey = createMemo(() => `${params.dir}${params.id ? "/" + params.id : ""}`)
|
||||||
const view = createMemo(() => layout.view(sessionKey))
|
const view = createMemo(() => layout.view(sessionKey))
|
||||||
const os = createMemo(() => detectOS(platform))
|
const os = createMemo(() => detectOS(platform))
|
||||||
@@ -346,6 +346,7 @@ export function SessionHeader() {
|
|||||||
const share = useSessionShare({
|
const share = useSessionShare({
|
||||||
globalSDK,
|
globalSDK,
|
||||||
currentSession,
|
currentSession,
|
||||||
|
sessionID: () => params.id,
|
||||||
projectDirectory,
|
projectDirectory,
|
||||||
platform,
|
platform,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -202,29 +202,26 @@ export function StatusPopover() {
|
|||||||
triggerAs={Button}
|
triggerAs={Button}
|
||||||
triggerProps={{
|
triggerProps={{
|
||||||
variant: "ghost",
|
variant: "ghost",
|
||||||
class:
|
class: "titlebar-icon w-6 h-6 p-0 box-border",
|
||||||
"rounded-md h-[24px] pr-3 pl-0.5 gap-2 border border-border-weak-base bg-surface-panel shadow-none data-[expanded]:bg-surface-base-active",
|
"aria-label": language.t("status.popover.trigger"),
|
||||||
style: { scale: 1 },
|
style: { scale: 1 },
|
||||||
}}
|
}}
|
||||||
trigger={
|
trigger={
|
||||||
<div class="flex items-center gap-0.5">
|
<div class="flex size-4 items-center justify-center">
|
||||||
<div class="size-4 flex items-center justify-center">
|
<div
|
||||||
<div
|
classList={{
|
||||||
classList={{
|
"size-1.5 rounded-full": true,
|
||||||
"size-1.5 rounded-full": true,
|
"bg-icon-success-base": overallHealthy(),
|
||||||
"bg-icon-success-base": overallHealthy(),
|
"bg-icon-critical-base": !overallHealthy() && server.healthy() !== undefined,
|
||||||
"bg-icon-critical-base": !overallHealthy() && server.healthy() !== undefined,
|
"bg-border-weak-base": server.healthy() === undefined,
|
||||||
"bg-border-weak-base": server.healthy() === undefined,
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<span class="text-12-regular text-text-strong">{language.t("status.popover.trigger")}</span>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
class="[&_[data-slot=popover-body]]:p-0 w-[360px] max-w-[calc(100vw-40px)] bg-transparent border-0 shadow-none rounded-xl"
|
class="[&_[data-slot=popover-body]]:p-0 w-[360px] max-w-[calc(100vw-40px)] bg-transparent border-0 shadow-none rounded-xl"
|
||||||
gutter={4}
|
gutter={4}
|
||||||
placement="bottom-end"
|
placement="bottom-end"
|
||||||
shift={-136}
|
shift={-168}
|
||||||
>
|
>
|
||||||
<div class="flex items-center gap-1 w-[360px] rounded-xl shadow-[var(--shadow-lg-border-base)]">
|
<div class="flex items-center gap-1 w-[360px] rounded-xl shadow-[var(--shadow-lg-border-base)]">
|
||||||
<Tabs
|
<Tabs
|
||||||
|
|||||||
Reference in New Issue
Block a user