mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-18 23:19:39 +02:00
Send requests with active environment
This commit is contained in:
@@ -23,6 +23,8 @@ import { useActiveEnvironmentId } from '../hooks/useActiveEnvironmentId';
|
||||
import { WorkspaceActionsDropdown } from './WorkspaceActionsDropdown';
|
||||
import { IconButton } from './core/IconButton';
|
||||
import { useCreateRequest } from '../hooks/useCreateRequest';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
import { invoke } from '@tauri-apps/api';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
@@ -48,6 +50,9 @@ export const Sidebar = memo(function Sidebar({ className }: Props) {
|
||||
const [hasFocus, setHasFocus] = useState<boolean>(false);
|
||||
const [selectedIndex, setSelectedIndex] = useState<number>();
|
||||
|
||||
// TODO: Move these listeners to a central place
|
||||
useListenToTauriEvent('create_request', async () => createRequest.mutate({}));
|
||||
|
||||
const focusActiveRequest = useCallback(
|
||||
(forcedIndex?: number) => {
|
||||
const index = forcedIndex ?? requests.findIndex((r) => r.id === activeRequestId);
|
||||
@@ -169,7 +174,12 @@ export const Sidebar = memo(function Sidebar({ className }: Props) {
|
||||
className="text-left mb-0"
|
||||
justify="start"
|
||||
/>
|
||||
<IconButton size="sm" icon="plusCircle" title="Create Request" onClick={() => createRequest.mutate({})} />
|
||||
<IconButton
|
||||
size="sm"
|
||||
icon="plusCircle"
|
||||
title="Create Request"
|
||||
onClick={() => createRequest.mutate({})}
|
||||
/>
|
||||
</HStack>
|
||||
<VStack
|
||||
as="ul"
|
||||
|
||||
Reference in New Issue
Block a user