From dc91615b43caeca3e18e5c4592821dcefd459df8 Mon Sep 17 00:00:00 2001 From: JanetEne Date: Sat, 9 Sep 2023 04:06:16 +0100 Subject: [PATCH 1/3] add helper text and tooltip for secret path --- .../components/v2/FormControl/FormControl.tsx | 13 +++-- .../src/components/v2/Tooltip/Tooltip.tsx | 4 +- .../components/WebhooksTab/AddWebhookForm.tsx | 49 +++++++++++++++++-- 3 files changed, 59 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/v2/FormControl/FormControl.tsx b/frontend/src/components/v2/FormControl/FormControl.tsx index 2493cdb54..086cf2e76 100644 --- a/frontend/src/components/v2/FormControl/FormControl.tsx +++ b/frontend/src/components/v2/FormControl/FormControl.tsx @@ -8,12 +8,17 @@ export type FormLabelProps = { id?: string; isRequired?: boolean; label?: ReactNode; + icon?: ReactNode; }; -export const FormLabel = ({ id, label, isRequired }: FormLabelProps) => ( - +export const FormLabel = ({ id, label, isRequired, icon }: FormLabelProps) => ( + {label} {isRequired && *} + {icon && {icon}} ); @@ -47,6 +52,7 @@ export type FormControlProps = { errorText?: ReactNode; children: JSX.Element; className?: string; + icon?: ReactNode; }; export const FormControl = ({ @@ -57,12 +63,13 @@ export const FormControl = ({ errorText, id, isError, + icon, className }: FormControlProps): JSX.Element => { return (
{typeof label === "string" ? ( - + ) : ( label )} diff --git a/frontend/src/components/v2/Tooltip/Tooltip.tsx b/frontend/src/components/v2/Tooltip/Tooltip.tsx index f6f697f38..9d1285aa0 100644 --- a/frontend/src/components/v2/Tooltip/Tooltip.tsx +++ b/frontend/src/components/v2/Tooltip/Tooltip.tsx @@ -10,6 +10,7 @@ export type TooltipProps = Omit void; defaultOpen?: boolean; + position?: "top" | "bottom" | "left" | "right"; }; export const Tooltip = ({ @@ -20,6 +21,7 @@ export const Tooltip = ({ defaultOpen, className, asChild = true, + position = "top", ...props }: TooltipProps) => ( {children} ({ resolver: yupResolver(formSchema) }); + const [showTip, setShowTip] = useState(false); useEffect(() => { if (!isOpen) { @@ -85,11 +89,50 @@ export const AddWebhookForm = ({ /> setShowTip(false)} + content={ +
+

Here are some examples of glob patterns:

+
+
  • + / - Matches all files and + directories in the current directory +
  • +
  • + **/* - Matches all files and + directories in the current directory and its subdirectories +
  • +
  • + {"/{dir1,dir2}"} - Matches all files + and directories in dir1 and dir2 +
  • +
    +
    + } + position="right" + className="text-xs" + > +
    + setShowTip(true)} + className="h-2 w-2" + /> +
    + + } isRequired isError={Boolean(errors?.secretPath)} errorText={errors?.secretPath?.message} + helperText="Glob patterns are used to match multiple files or directories" > - +
    Date: Sat, 9 Sep 2023 22:35:55 +0100 Subject: [PATCH 2/3] show tooltip on hover of icon and not onclick --- .../components/WebhooksTab/AddWebhookForm.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx index d7f9c0e78..10157eae7 100644 --- a/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx +++ b/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx @@ -92,7 +92,7 @@ export const AddWebhookForm = ({ icon={ setShowTip(false)} + onOpenChange={setShowTip} content={

    Here are some examples of glob patterns:

    @@ -115,12 +115,11 @@ export const AddWebhookForm = ({ position="right" className="text-xs" > -
    - setShowTip(true)} - className="h-2 w-2" - /> +
    setShowTip(true)} + > +
    } From ad710f4860ff3f29da9a56b6566a7b152169ec94 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Sat, 9 Sep 2023 18:10:02 -0700 Subject: [PATCH 3/3] fixed the style of the webhook tooltip --- frontend/src/components/v2/FormControl/FormControl.tsx | 2 +- .../components/WebhooksTab/AddWebhookForm.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/v2/FormControl/FormControl.tsx b/frontend/src/components/v2/FormControl/FormControl.tsx index 086cf2e76..91dfd4139 100644 --- a/frontend/src/components/v2/FormControl/FormControl.tsx +++ b/frontend/src/components/v2/FormControl/FormControl.tsx @@ -18,7 +18,7 @@ export const FormLabel = ({ id, label, isRequired, icon }: FormLabelProps) => ( > {label} {isRequired && *} - {icon && {icon}} + {icon && {icon}} ); diff --git a/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx b/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx index 10157eae7..b1d73356a 100644 --- a/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx +++ b/frontend/src/views/Settings/ProjectSettingsPage/components/WebhooksTab/AddWebhookForm.tsx @@ -116,7 +116,7 @@ export const AddWebhookForm = ({ className="text-xs" >
    setShowTip(true)} >