mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-10 19:16:55 +02:00
Merge main into proxy branch (formatting and docs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import type { ActionInvocation } from '@yaakapp-internal/proxy-lib';
|
||||
import { IconButton, type IconButtonProps } from '@yaakapp-internal/ui';
|
||||
import { useCallback } from 'react';
|
||||
import { useRpcMutation } from '../hooks/useRpcMutation';
|
||||
import { useActionMetadata } from '../hooks/useActionMetadata';
|
||||
import type { ActionInvocation } from "@yaakapp-internal/proxy-lib";
|
||||
import { IconButton, type IconButtonProps } from "@yaakapp-internal/ui";
|
||||
import { useCallback } from "react";
|
||||
import { useRpcMutation } from "../hooks/useRpcMutation";
|
||||
import { useActionMetadata } from "../hooks/useActionMetadata";
|
||||
|
||||
type ActionIconButtonProps = Omit<IconButtonProps, 'onClick' | 'title'> & {
|
||||
type ActionIconButtonProps = Omit<IconButtonProps, "onClick" | "title"> & {
|
||||
action: ActionInvocation;
|
||||
title?: string;
|
||||
};
|
||||
|
||||
export function ActionIconButton({ action, ...props }: ActionIconButtonProps) {
|
||||
const meta = useActionMetadata(action);
|
||||
const { mutate, isPending } = useRpcMutation('execute_action');
|
||||
const { mutate, isPending } = useRpcMutation("execute_action");
|
||||
|
||||
const onClick = useCallback(() => {
|
||||
mutate(action);
|
||||
@@ -20,7 +20,7 @@ export function ActionIconButton({ action, ...props }: ActionIconButtonProps) {
|
||||
return (
|
||||
<IconButton
|
||||
{...props}
|
||||
title={props.title ?? meta?.label ?? '…'}
|
||||
title={props.title ?? meta?.label ?? "…"}
|
||||
disabled={props.disabled || isPending}
|
||||
isLoading={isPending}
|
||||
onClick={onClick}
|
||||
|
||||
Reference in New Issue
Block a user