🎨: Updated Plugins Search Bar; 🌎: Added Translations (#1549)

* 🎨: layout search bar plugins: updated  / 🌎: translation update

* 🌎:Update Portuguese Translation

* fix: Refactored 'pluginstoredialog' code.

* chore(PopoverButtons): remove comments, re-organize imports

* chore: linting and reorganize useState declarations

* chore: linting and reorganize useState declarations

---------

Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
This commit is contained in:
Raí Santos 2024-01-16 15:15:39 -03:00 committed by GitHub
parent 406940490b
commit 7b4e31ecc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 51 deletions

View file

@ -3,6 +3,7 @@ import type { ReactNode } from 'react';
import { MessagesSquared, GPTIcon } from '~/components/svg';
import { useChatContext } from '~/Providers';
import { Button } from '~/components/ui';
import { useLocalize } from '~/hooks';
import { cn } from '~/utils/';
type TPopoverButton = {
@ -26,6 +27,7 @@ export default function PopoverButtons({
showAgentSettings,
setShowAgentSettings,
} = useChatContext();
const localize = useLocalize();
const { model, endpoint: _endpoint, endpointType } = conversation ?? {};
const endpoint = endpointType ?? _endpoint;
@ -42,7 +44,7 @@ export default function PopoverButtons({
const buttons: { [key: string]: TPopoverButton[] } = {
[EModelEndpoint.google]: [
{
label: (showExamples ? 'Hide' : 'Show') + ' Examples',
label: localize(showExamples ? 'com_hide_examples' : 'com_show_examples'),
buttonClass: isGenerativeModel || isTextModel ? 'disabled' : '',
handler: triggerExamples,
icon: <MessagesSquared className={cn('mr-1 w-[14px]', iconClass)} />,
@ -50,7 +52,9 @@ export default function PopoverButtons({
],
[EModelEndpoint.gptPlugins]: [
{
label: `Show ${showAgentSettings ? 'Completion' : 'Agent'} Settings`,
label: localize(
showAgentSettings ? 'com_show_completion_settings' : 'com_show_agent_settings',
),
buttonClass: '',
handler: () => setShowAgentSettings((prev) => !prev),
icon: <GPTIcon className={cn('mr-1 w-[14px]', iconClass)} size={24} />,
@ -71,7 +75,7 @@ export default function PopoverButtons({
<div>
{endpointButtons.map((button, index) => (
<Button
key={`${endpoint}-button-${index}`}
key={`button-${index}`}
type="button"
className={cn(
button.buttonClass,