mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-29 03:32:43 +01:00
Keep Clear in the header with Cmd+Shift+K in its tooltip, and leave the port to the menu's address line
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a4061d5dee
commit
d12beda8a9
5 files changed
+65
-70
No files matched your search
@@ -24,18 +24,15 @@ import { proxyStateAtom, systemProxyEverOnAtom } from "../lib/store";
|
||||
import { helperPollInterval, recordingLabel, systemProxySwitch } from "../lib/systemProxy";
|
||||
import { onWindowFocus } from "../lib/tauri";
|
||||
import { useShowToast } from "../lib/toast";
|
||||
import { ClearFlowsMenu, useCanClearFlows } from "./ClearFlowsMenu";
|
||||
|
||||
/**
|
||||
* The header's state pill and its menu: the listening address, the state, Pause or Resume
|
||||
* Recording, Clear Traffic, Override system proxy, and the certificate. The engine runs for as long as the app does, so the
|
||||
* pill shows whether flows are being stored. A certificate that is not trusted steps out of the
|
||||
* The header's state pill and its menu: the listening address, which copies itself, the state,
|
||||
* Pause or Resume Recording, Override system proxy, and the certificate. The engine runs for as
|
||||
* long as the app does, so the pill shows whether flows are being stored. A certificate that is not trusted steps out of the
|
||||
* menu beside the pill until it is. Everything set once and left alone lives in Settings.
|
||||
*/
|
||||
export function ProxyStatus() {
|
||||
const dropdownRef = useRef<DropdownRef>(null);
|
||||
const clearRef = useRef<DropdownRef>(null);
|
||||
const canClear = useCanClearFlows();
|
||||
const [copied, setCopied] = useCopied();
|
||||
const proxyState = useAtomValue(proxyStateAtom);
|
||||
const setup = useProxySetup();
|
||||
@@ -134,17 +131,6 @@ export function ProxyStatus() {
|
||||
hotKeyLabelOnly: true,
|
||||
onSelect: () => execute.mutate({ scope: "global", action: "recording_toggle" }),
|
||||
},
|
||||
{
|
||||
label: "Clear Traffic",
|
||||
icon: "trash",
|
||||
disabled: !canClear,
|
||||
hotKeyAction: "flows_clear",
|
||||
hotKeyLabelOnly: true,
|
||||
// Its confirmation opens from the pill once this menu has closed.
|
||||
onSelect: () => {
|
||||
setTimeout(() => clearRef.current?.open());
|
||||
},
|
||||
},
|
||||
{ type: "separator" },
|
||||
{
|
||||
type: "content",
|
||||
@@ -222,36 +208,33 @@ export function ProxyStatus() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className="relative flex">
|
||||
<Dropdown ref={dropdownRef} items={items}>
|
||||
<Pill color={status === "stopped" ? "warning" : undefined}>
|
||||
{status === "encrypting" ? (
|
||||
<>
|
||||
<LoadingIcon size="xs" />
|
||||
<span className="text-text">Encrypting</span>
|
||||
<span className="font-mono text-text-subtle">{encrypting}</span>
|
||||
</>
|
||||
) : status === "cli" && other != null ? (
|
||||
<>
|
||||
<StateDot state="cli" />
|
||||
<span className="text-text">CLI</span>
|
||||
</>
|
||||
) : status === "recording" || status === "paused" ? (
|
||||
<>
|
||||
<StateDot state={status} />
|
||||
<span className="text-text">{recording ? "Recording" : "Paused"}</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon icon="alert_triangle" size="xs" />
|
||||
Not running
|
||||
</>
|
||||
)}
|
||||
<Icon icon="chevron_down" size="xs" className="text-text-subtlest" />
|
||||
</Pill>
|
||||
</Dropdown>
|
||||
<ClearFlowsMenu ref={clearRef} />
|
||||
</span>
|
||||
<Dropdown ref={dropdownRef} items={items}>
|
||||
<Pill color={status === "stopped" ? "warning" : undefined}>
|
||||
{status === "encrypting" ? (
|
||||
<>
|
||||
<LoadingIcon size="xs" />
|
||||
<span className="text-text">Encrypting</span>
|
||||
<span className="font-mono text-text-subtle">{encrypting}</span>
|
||||
</>
|
||||
) : status === "cli" && other != null ? (
|
||||
<>
|
||||
<StateDot state="cli" />
|
||||
<span className="text-text">CLI</span>
|
||||
</>
|
||||
) : status === "recording" || status === "paused" ? (
|
||||
<>
|
||||
<StateDot state={status} />
|
||||
<span className="text-text">{recording ? "Recording" : "Paused"}</span>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Icon icon="alert_triangle" size="xs" />
|
||||
Not running
|
||||
</>
|
||||
)}
|
||||
<Icon icon="chevron_down" size="xs" className="text-text-subtlest" />
|
||||
</Pill>
|
||||
</Dropdown>
|
||||
{untrusted && (
|
||||
<Pill color="warning" onClick={() => dropdownRef.current?.open()}>
|
||||
<Icon icon="shield_off" size="xs" />
|
||||
@@ -337,6 +320,7 @@ export function useCopyEnvironment() {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** Whether something was just copied, for a moment, and the call that says it was */
|
||||
function useCopied(): [boolean, () => void] {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
Reference in new issue
Block a user