Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip to inform of reason for disabled action (continued) #4306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 20 additions & 17 deletions client/src/components/SidePanel/Builder/AssistantPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { Spinner } from '~/components/svg';
import Knowledge from './Knowledge';
import { Panel } from '~/common';
import Action from './Action';
import { TooltipAnchor } from '~/components/ui/Tooltip';

const labelClass = 'mb-2 text-token-text-primary block font-medium';
const inputClass = cn(
Expand Down Expand Up @@ -420,24 +421,26 @@ export default function AssistantPanel({
</button>
)}
{actionsEnabled === true && (
<button
type="button"
disabled={!assistant_id}
onClick={() => {
if (!assistant_id) {
return showToast({
message: localize('com_assistants_actions_disabled'),
status: 'warning',
});
}
setActivePanel(Panel.actions);
}}
className="btn btn-neutral border-token-border-light relative h-8 w-full rounded-lg font-medium"
<TooltipAnchor
description={localize('com_assistants_actions_disabled')}
className="relative w-full"
showOnHover={!assistant_id}
tabIndex={0}
accessibleWhenDisabled
>
<div className="flex w-full items-center justify-center gap-2">
{localize('com_assistants_add_actions')}
</div>
</button>
<button
type="button"
disabled={!assistant_id}
onClick={() => {
setActivePanel(Panel.actions);
}}
className="btn btn-neutral border-token-border-light relative h-8 w-full rounded-lg font-medium"
>
<div className="flex w-full items-center justify-center gap-2">
{localize('com_assistants_add_actions')}
</div>
</button>
</TooltipAnchor>
)}
</div>
</div>
Expand Down