use onPress() with heroui button

This commit is contained in:
ramnique 2025-03-06 13:49:08 +05:30
parent 8a6fd290c1
commit 5ef41748ca
19 changed files with 42 additions and 42 deletions

View file

@ -53,7 +53,7 @@ export function ProfileSelector({ projectId, isOpen, onOpenChange, onSelect }: P
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => fetchProfiles(page)}>Retry</Button> <Button size="sm" color="danger" onPress={() => fetchProfiles(page)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{profiles.length === 0 && <div className="text-gray-600 text-center">No profiles found</div>} {profiles.length === 0 && <div className="text-gray-600 text-center">No profiles found</div>}

View file

@ -53,7 +53,7 @@ export function ScenarioSelector({ projectId, isOpen, onOpenChange, onSelect }:
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => fetchScenarios(page)}>Retry</Button> <Button size="sm" color="danger" onPress={() => fetchScenarios(page)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{scenarios.length === 0 && <div className="text-gray-600 text-center">No scenarios found</div>} {scenarios.length === 0 && <div className="text-gray-600 text-center">No scenarios found</div>}

View file

@ -89,7 +89,7 @@ export function SimulationSelector({ projectId, isOpen, onOpenChange, onSelect,
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => fetchSimulations(page)}>Retry</Button> <Button size="sm" color="danger" onPress={() => fetchSimulations(page)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{simulations.length === 0 && <div className="text-gray-600 text-center">No simulations found</div>} {simulations.length === 0 && <div className="text-gray-600 text-center">No simulations found</div>}

View file

@ -58,7 +58,7 @@ export function WorkflowSelector({ projectId, isOpen, onOpenChange, onSelect }:
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => fetchWorkflows(page)}>Retry</Button> <Button size="sm" color="danger" onPress={() => fetchWorkflows(page)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{workflows.length === 0 && <div className="text-gray-600 text-center">No workflows found</div>} {workflows.length === 0 && <div className="text-gray-600 text-center">No workflows found</div>}

View file

@ -11,7 +11,7 @@ export function ThemeToggle() {
<Button <Button
variant="light" variant="light"
isIconOnly isIconOnly
onClick={toggleTheme} onPress={toggleTheme}
aria-label="Toggle theme" aria-label="Toggle theme"
className="text-foreground" className="text-foreground"
> >

View file

@ -223,7 +223,7 @@ export function ApiKeysSection({
API keys are used to authenticate requests to the Rowboat API. API keys are used to authenticate requests to the Rowboat API.
</p> </p>
<Button <Button
onClick={handleCreateKey} onPress={handleCreateKey}
size="sm" size="sm"
startContent={<PlusIcon className="w-4 h-4" />} startContent={<PlusIcon className="w-4 h-4" />}
variant="flat" variant="flat"
@ -359,7 +359,7 @@ export function SecretSection({
size="sm" size="sm"
variant="flat" variant="flat"
color="warning" color="warning"
onClick={handleRotateSecret} onPress={handleRotateSecret}
isDisabled={loading} isDisabled={loading}
> >
Rotate Rotate

View file

@ -320,7 +320,7 @@ export function Chat({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
setFetchResponseError(null); setFetchResponseError(null);
}} }}
> >
@ -340,7 +340,7 @@ export function Chat({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
setSimulationComplete(true); setSimulationComplete(true);
}} }}
> >

View file

@ -59,7 +59,7 @@ export function ComposeBox({
size="sm" size="sm"
isIconOnly isIconOnly
disabled={disabled} disabled={disabled}
onClick={handleInput} onPress={handleInput}
className="bg-default-100" className="bg-default-100"
> >
<CornerDownLeftIcon size={16} /> <CornerDownLeftIcon size={16} />

View file

@ -535,7 +535,7 @@ function MockToolCall({
> >
</Textarea> </Textarea>
<Button <Button
onClick={handleSubmit} onPress={handleSubmit}
disabled={generatingResponse} disabled={generatingResponse}
isLoading={generatingResponse} isLoading={generatingResponse}
size="sm" size="sm"

View file

@ -67,7 +67,7 @@ function EditProfile({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => formRef.current?.requestSubmit()}>Retry</Button> <Button size="sm" color="danger" onPress={() => formRef.current?.requestSubmit()}>Retry</Button>
</div>} </div>}
{!loading && profile && ( {!loading && profile && (
<form ref={formRef} action={handleSubmit} className="flex flex-col gap-2"> <form ref={formRef} action={handleSubmit} className="flex flex-col gap-2">
@ -214,7 +214,7 @@ function ViewProfile({
size="sm" size="sm"
color="danger" color="danger"
variant="flat" variant="flat"
onClick={() => setIsDeleteModalOpen(true)} onPress={() => setIsDeleteModalOpen(true)}
> >
Delete Delete
</Button> </Button>
@ -323,7 +323,7 @@ function NewProfile({
</Button> </Button>
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => formRef.current?.requestSubmit()}>Retry</Button> <Button size="sm" color="danger" onPress={() => formRef.current?.requestSubmit()}>Retry</Button>
</div>} </div>}
<form ref={formRef} action={handleSubmit} className="flex flex-col gap-2"> <form ref={formRef} action={handleSubmit} className="flex flex-col gap-2">
<Input <Input
@ -416,7 +416,7 @@ function ProfileList({
<h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Profiles</h1> <h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Profiles</h1>
<Button <Button
size="sm" size="sm"
onClick={() => router.push(`/projects/${projectId}/test/profiles/new`)} onPress={() => router.push(`/projects/${projectId}/test/profiles/new`)}
className="self-end" className="self-end"
startContent={<PlusIcon className="w-4 h-4" />} startContent={<PlusIcon className="w-4 h-4" />}
> >
@ -428,7 +428,7 @@ function ProfileList({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => setError(null)}>Retry</Button> <Button size="sm" color="danger" onPress={() => setError(null)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{profiles.length === 0 && <div className="text-gray-600 text-center">No profiles found</div>} {profiles.length === 0 && <div className="text-gray-600 text-center">No profiles found</div>}

View file

@ -68,7 +68,7 @@ function NewRun({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
formRef.current?.requestSubmit(); formRef.current?.requestSubmit();
}} }}
> >
@ -86,7 +86,7 @@ function NewRun({
)} )}
<Button <Button
size="sm" size="sm"
onClick={() => setIsWorkflowSelectorOpen(true)} onPress={() => setIsWorkflowSelectorOpen(true)}
type="button" type="button"
> >
{selectedWorkflow ? "Change" : "Select"} Workflow {selectedWorkflow ? "Change" : "Select"} Workflow
@ -96,7 +96,7 @@ function NewRun({
<div className="flex flex-col gap-2"> <div className="flex flex-col gap-2">
<Button <Button
size="sm" size="sm"
onClick={() => setIsSimulationSelectorOpen(true)} onPress={() => setIsSimulationSelectorOpen(true)}
type="button" type="button"
className="self-start" className="self-start"
> >
@ -338,7 +338,7 @@ function RunList({
<h1 className="text-xl font-semibold text-gray-800 dark:text-neutral-200">Test Runs</h1> <h1 className="text-xl font-semibold text-gray-800 dark:text-neutral-200">Test Runs</h1>
<Button <Button
size="sm" size="sm"
onClick={() => router.push(`/projects/${projectId}/test/runs/new`)} onPress={() => router.push(`/projects/${projectId}/test/runs/new`)}
startContent={<PlusIcon className="w-4 h-4" />} startContent={<PlusIcon className="w-4 h-4" />}
> >
New Run New Run
@ -351,7 +351,7 @@ function RunList({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => setError(null)}>Retry</Button> <Button size="sm" color="danger" onPress={() => setError(null)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{runs.length === 0 && <div className="text-gray-600 text-center">No test runs found</div>} {runs.length === 0 && <div className="text-gray-600 text-center">No test runs found</div>}

View file

@ -61,7 +61,7 @@ function EditScenario({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
formRef.current?.requestSubmit(); formRef.current?.requestSubmit();
}} }}
> >
@ -187,7 +187,7 @@ function ViewScenario({
size="sm" size="sm"
color="danger" color="danger"
variant="flat" variant="flat"
onClick={() => setIsDeleteModalOpen(true)} onPress={() => setIsDeleteModalOpen(true)}
> >
Delete Delete
</Button> </Button>
@ -292,7 +292,7 @@ function NewScenario({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
formRef.current?.requestSubmit(); formRef.current?.requestSubmit();
}} }}
> >
@ -375,7 +375,7 @@ function ScenarioList({
<h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Scenarios</h1> <h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Scenarios</h1>
<Button <Button
size="sm" size="sm"
onClick={() => router.push(`/projects/${projectId}/test/scenarios/new`)} onPress={() => router.push(`/projects/${projectId}/test/scenarios/new`)}
className="self-end" className="self-end"
startContent={<PlusIcon className="w-4 h-4" />} startContent={<PlusIcon className="w-4 h-4" />}
> >
@ -387,7 +387,7 @@ function ScenarioList({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => setError(null)}>Retry</Button> <Button size="sm" color="danger" onPress={() => setError(null)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{scenarios.length === 0 && <div className="text-gray-600 text-center">No scenarios found</div>} {scenarios.length === 0 && <div className="text-gray-600 text-center">No scenarios found</div>}

View file

@ -86,7 +86,7 @@ function EditSimulation({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => formRef.current?.requestSubmit()}>Retry</Button> <Button size="sm" color="danger" onPress={() => formRef.current?.requestSubmit()}>Retry</Button>
</div>} </div>}
{!loading && simulation && ( {!loading && simulation && (
<form ref={formRef} action={handleSubmit} className="flex flex-col gap-2"> <form ref={formRef} action={handleSubmit} className="flex flex-col gap-2">
@ -116,7 +116,7 @@ function EditSimulation({
)} )}
<Button <Button
size="sm" size="sm"
onClick={() => setIsScenarioModalOpen(true)} onPress={() => setIsScenarioModalOpen(true)}
type="button" type="button"
> >
{scenario ? "Change" : "Select"} Scenario {scenario ? "Change" : "Select"} Scenario
@ -134,7 +134,7 @@ function EditSimulation({
{profile && <Button size="sm" variant="bordered" onClick={() => setProfile(null)}>Remove</Button>} {profile && <Button size="sm" variant="bordered" onClick={() => setProfile(null)}>Remove</Button>}
<Button <Button
size="sm" size="sm"
onClick={() => setIsProfileModalOpen(true)} onPress={() => setIsProfileModalOpen(true)}
type="button" type="button"
> >
{profile ? "Change" : "Select"} Profile {profile ? "Change" : "Select"} Profile
@ -291,7 +291,7 @@ function ViewSimulation({
size="sm" size="sm"
color="danger" color="danger"
variant="flat" variant="flat"
onClick={() => setIsDeleteModalOpen(true)} onPress={() => setIsDeleteModalOpen(true)}
> >
Delete Delete
</Button> </Button>
@ -438,7 +438,7 @@ function NewSimulation({
)} )}
<Button <Button
size="sm" size="sm"
onClick={() => setIsScenarioModalOpen(true)} onPress={() => setIsScenarioModalOpen(true)}
type="button" type="button"
> >
{scenario ? "Change" : "Select"} Scenario {scenario ? "Change" : "Select"} Scenario
@ -456,7 +456,7 @@ function NewSimulation({
{profile && <Button size="sm" variant="bordered" onClick={() => setProfile(null)}>Remove</Button>} {profile && <Button size="sm" variant="bordered" onClick={() => setProfile(null)}>Remove</Button>}
<Button <Button
size="sm" size="sm"
onClick={() => setIsProfileModalOpen(true)} onPress={() => setIsProfileModalOpen(true)}
type="button" type="button"
> >
{profile ? "Change" : "Select"} Profile {profile ? "Change" : "Select"} Profile
@ -587,7 +587,7 @@ function SimulationList({
<h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Simulations</h1> <h1 className="text-medium font-bold text-gray-800 pb-2 border-b border-gray-200">Simulations</h1>
<Button <Button
size="sm" size="sm"
onClick={() => router.push(`/projects/${projectId}/test/simulations/new`)} onPress={() => router.push(`/projects/${projectId}/test/simulations/new`)}
className="self-end" className="self-end"
startContent={<PlusIcon className="w-4 h-4" />} startContent={<PlusIcon className="w-4 h-4" />}
> >
@ -599,7 +599,7 @@ function SimulationList({
</div>} </div>}
{error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm"> {error && <div className="bg-red-100 p-2 rounded-md text-red-800 flex items-center gap-2 text-sm">
{error} {error}
<Button size="sm" color="danger" onClick={() => setError(null)}>Retry</Button> <Button size="sm" color="danger" onPress={() => setError(null)}>Retry</Button>
</div>} </div>}
{!loading && !error && <> {!loading && !error && <>
{simulationList.length === 0 && <div className="text-gray-600 text-center">No simulation found</div>} {simulationList.length === 0 && <div className="text-gray-600 text-center">No simulation found</div>}

View file

@ -210,7 +210,7 @@ export function AgentConfig({
size="sm" size="sm"
variant="light" variant="light"
className="opacity-0 group-hover:opacity-100 transition-opacity text-gray-500 hover:text-red-500" className="opacity-0 group-hover:opacity-100 transition-opacity text-gray-500 hover:text-red-500"
onClick={() => { onPress={() => {
const newSources = agent.ragDataSources?.filter((s) => s !== source); const newSources = agent.ragDataSources?.filter((s) => s !== source);
handleUpdate({ handleUpdate({
...agent, ...agent,
@ -409,7 +409,7 @@ function GenerateInstructionsModal({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
setError(null); setError(null);
handleGenerate(); handleGenerate();
}} }}

View file

@ -91,7 +91,7 @@ function ComposeBox({
endContent={<Button endContent={<Button
size="sm" size="sm"
isIconOnly isIconOnly
onClick={handleInput} onPress={handleInput}
className="bg-gray-100 dark:bg-gray-800" className="bg-gray-100 dark:bg-gray-800"
> >
<CornerDownLeftIcon size={16} /> <CornerDownLeftIcon size={16} />
@ -464,7 +464,7 @@ function App({
<Button <Button
size="sm" size="sm"
color="danger" color="danger"
onClick={() => { onPress={() => {
setResponseError(null); setResponseError(null);
}} }}
> >

View file

@ -116,7 +116,7 @@ function PreviewModal({
{onApply && <Button {onApply && <Button
variant="solid" variant="solid"
color="primary" color="primary"
onClick={() => { onPress={() => {
onApply(); onApply();
onClose(); onClose();
}} }}

View file

@ -331,7 +331,7 @@ export function ToolConfig({
startContent={<svg className="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"> startContent={<svg className="w-6 h-6" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" d="M5 12h14m-7 7V5" /> <path stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1" d="M5 12h14m-7 7V5" />
</svg>} </svg>}
onClick={() => { onPress={() => {
const newParamName = `param${Object.keys(tool.parameters?.properties || {}).length + 1}`; const newParamName = `param${Object.keys(tool.parameters?.properties || {}).length + 1}`;
const newProperties = { const newProperties = {
...(tool.parameters?.properties || {}), ...(tool.parameters?.properties || {}),

View file

@ -786,7 +786,7 @@ export function WorkflowEditor({
<Button <Button
variant="bordered" variant="bordered"
size="sm" size="sm"
onClick={() => handleCloneVersion(state.present.workflow._id)} onPress={() => handleCloneVersion(state.present.workflow._id)}
> >
Clone this version Clone this version
</Button> </Button>

View file

@ -105,7 +105,7 @@ export function WorkflowSelector({
<Button <Button
color="primary" color="primary"
startContent={<PlusIcon size={16} />} startContent={<PlusIcon size={16} />}
onClick={handleCreateNewVersion} onPress={handleCreateNewVersion}
> >
Create new version Create new version
</Button> </Button>