Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
import { deviceDisplayName } from '@/lib/deviceName';
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Button } from '@/components/ui/button';
import { useDeviceLinkDeviceList } from '@/features/device-link/useDeviceLinkDeviceList';
import { toast } from '@/lib/toast';
/** Navigation only: authorization and credentials stay in the computer's own UI. */
export function PluginSetupRemoteDesktopButton({ deviceId }: { deviceId: string }) {
const { t } = useTranslation();
const devices = useDeviceLinkDeviceList();
const name = deviceDisplayName(deviceId, undefined, devices ?? []);
const [opening, setOpening] = useState(false);
const mounted = useRef(true);
useEffect(
() => () => {
mounted.current = false;
},
[],
);
return (
<Button
variant="secondary"
palette="confirmation"
size="lg"
compact
type="button"
loading={opening}
disabled={opening}
onClick={() => {
setOpening(true);
void window.electronAPI
.openRemoteDesktop({ deviceId, name })
.catch(() => toast.error(t('remoteDesktop.connectionError')))
.finally(() => {
if (mounted.current) setOpening(false);
});
}}
>
{t('remoteDesktop.shortcut.open')}
</Button>
);
}