mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 03:11:12 +01:00
(feat) Add ability to disable plugins and show bundled plugins (#337)
This commit is contained in:
@@ -5,6 +5,7 @@ import { useAtomValue } from 'jotai';
|
||||
import type { CSSProperties, ReactNode } from 'react';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { allRequestsAtom } from '../hooks/useAllRequests';
|
||||
import { useFolderActions } from '../hooks/useFolderActions';
|
||||
import { useLatestHttpResponse } from '../hooks/useLatestHttpResponse';
|
||||
import { sendAnyHttpRequest } from '../hooks/useSendAnyHttpRequest';
|
||||
import { showDialog } from '../lib/dialog';
|
||||
@@ -30,6 +31,12 @@ interface Props {
|
||||
export function FolderLayout({ folder, style }: Props) {
|
||||
const folders = useAtomValue(foldersAtom);
|
||||
const requests = useAtomValue(allRequestsAtom);
|
||||
const folderActions = useFolderActions();
|
||||
const sendAllAction = useMemo(
|
||||
() => folderActions.find((a) => a.label === 'Send All'),
|
||||
[folderActions],
|
||||
);
|
||||
|
||||
const children = useMemo(() => {
|
||||
return [
|
||||
...folders.filter((f) => f.folderId === folder.id),
|
||||
@@ -37,6 +44,10 @@ export function FolderLayout({ folder, style }: Props) {
|
||||
];
|
||||
}, [folder.id, folders, requests]);
|
||||
|
||||
const handleSendAll = useCallback(() => {
|
||||
sendAllAction?.call(folder);
|
||||
}, [sendAllAction, folder]);
|
||||
|
||||
return (
|
||||
<div style={style} className="p-6 pt-4 overflow-y-auto @container">
|
||||
<HStack space={2} alignItems="center">
|
||||
@@ -48,6 +59,8 @@ export function FolderLayout({ folder, style }: Props) {
|
||||
color="secondary"
|
||||
size="sm"
|
||||
variant="border"
|
||||
onClick={handleSendAll}
|
||||
disabled={sendAllAction == null}
|
||||
>
|
||||
Send All
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user