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

Thomas/add block and review doc #543

Merged
merged 2 commits into from
Sep 16, 2024
Merged

Conversation

balzdur
Copy link
Collaborator

@balzdur balzdur commented Sep 16, 2024

Small PR to introduce doc ref inside the product :

  • missing rule snooze
  • add "blocking review" doc refs

Bonus: fix a css issue for Select
Screenshot 2024-09-16 at 16 19 57
image

NB: I added a ref directly inside Readme to discover the "Block and Review" usecase (accessible using the existing link inside the product)

Clicking here
image
Open this
image

diff --git a/packages/app-builder/public/locales/en/cases.json b/packages/app-builder/public/locales/en/cases.json
index d5111ba2..dabadf53 100644
--- a/packages/app-builder/public/locales/en/cases.json
+++ b/packages/app-builder/public/locales/en/cases.json
@@ -75,6 +75,7 @@
   "case_detail.add_a_comment.placeholder": "Write a note",
   "case_detail.add_a_comment.post": "post a comment",
   "case_detail.add_rule_snooze.title": "Snooze a rule",
+  "case_detail.add_rule_snooze.callout": "Snoozing a rule for a specific pivot value will prevent it from triggering for a certain amount of time (<DocLink>learn more</DocLink>)",
   "case_detail.add_rule_snooze.comment.label": "Comment",
   "case_detail.add_rule_snooze.comment.placeholder": "Explain why you are snoozing this rule",
   "case_detail.add_rule_snooze.duration_value": "Duration value",
@@ -84,6 +85,7 @@
   "case_detail.add_rule_snooze": "Snooze",
   "case_detail.add_rule_snooze.no_access": "You don't have the permission to snooze this rule",
   "case_detail.review_decision.title": "Review decision",
+  "case_detail.review_decision.callout": "Reviewing a decision will change its status and dispatch a webhook to trigger the next step in your workflow (<DocLink>learn more</DocLink>)",
   "case_detail.review_decision.comment.label": "Comment",
   "case_detail.review_decision.comment.placeholder": "Explain why you are choosing this review status",
   "case_detail.review_decision.review_status.label": "Review status",
diff --git a/packages/app-builder/src/routes/ressources+/cases+/add-rule-snooze.tsx b/packages/app-builder/src/routes/ressources+/cases+/add-rule-snooze.tsx
index 6cd2f68e..e93004bb 100644
--- a/packages/app-builder/src/routes/ressources+/cases+/add-rule-snooze.tsx
+++ b/packages/app-builder/src/routes/ressources+/cases+/add-rule-snooze.tsx
@@ -1,3 +1,5 @@
+import { Callout } from '@app-builder/components';
+import { ExternalLink } from '@app-builder/components/ExternalLink';
 import { FormErrorOrDescription } from '@app-builder/components/Form/FormErrorOrDescription';
 import { FormField } from '@app-builder/components/Form/FormField';
 import { FormInput } from '@app-builder/components/Form/FormInput';
@@ -8,6 +10,7 @@ import { setToastMessage } from '@app-builder/components/MarbleToaster';
 import { LoadingIcon } from '@app-builder/components/Spinner';
 import { adaptDateTimeFieldCodes } from '@app-builder/models/duration';
 import { isStatusConflictHttpError } from '@app-builder/models/http-errors';
+import { ruleSnoozesDocHref } from '@app-builder/services/documentation-href';
 import { serverServices } from '@app-builder/services/init.server';
 import { useFormatLanguage } from '@app-builder/utils/format';
 import { getRoute } from '@app-builder/utils/routes';
@@ -21,7 +24,7 @@ import { getZodConstraint, parseWithZod } from '@conform-to/zod';
 import { type ActionFunctionArgs, json } from '@remix-run/node';
 import { useFetcher } from '@remix-run/react';
 import * as React from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
 import { Temporal } from 'temporal-polyfill';
 import { Button, ModalV2 } from 'ui-design-system';
 import { z } from 'zod';
@@ -189,6 +192,17 @@ function AddRuleSnoozeContent({
           {t('cases:case_detail.add_rule_snooze.title')}
         </ModalV2.Title>
         <div className="flex flex-col gap-6 p-6">
+          <ModalV2.Description render={<Callout variant="outlined" />}>
+            <p className="whitespace-pre text-wrap">
+              <Trans
+                t={t}
+                i18nKey="cases:case_detail.add_rule_snooze.callout"
+                components={{
+                  DocLink: <ExternalLink href={ruleSnoozesDocHref} />,
+                }}
+              />
+            </p>
+          </ModalV2.Description>
           <input
             {...getInputProps(fields.decisionId, {
               type: 'hidden',
diff --git a/packages/app-builder/src/routes/ressources+/cases+/review-decision.tsx b/packages/app-builder/src/routes/ressources+/cases+/review-decision.tsx
index b17a77b6..cc44b538 100644
--- a/packages/app-builder/src/routes/ressources+/cases+/review-decision.tsx
+++ b/packages/app-builder/src/routes/ressources+/cases+/review-decision.tsx
@@ -1,4 +1,6 @@
+import { Callout } from '@app-builder/components';
 import { ReviewStatusTag } from '@app-builder/components/Decisions/ReviewStatusTag';
+import { ExternalLink } from '@app-builder/components/ExternalLink';
 import { FormErrorOrDescription } from '@app-builder/components/Form/FormErrorOrDescription';
 import { FormField } from '@app-builder/components/Form/FormField';
 import { FormLabel } from '@app-builder/components/Form/FormLabel';
@@ -7,6 +9,7 @@ import { FormTextArea } from '@app-builder/components/Form/FormTextArea';
 import { setToastMessage } from '@app-builder/components/MarbleToaster';
 import { LoadingIcon } from '@app-builder/components/Spinner';
 import { nonPendingReviewStatuses } from '@app-builder/models/decision';
+import { blockingReviewDocHref } from '@app-builder/services/documentation-href';
 import { serverServices } from '@app-builder/services/init.server';
 import { getRoute } from '@app-builder/utils/routes';
 import type * as Ariakit from '@ariakit/react';
@@ -20,7 +23,7 @@ import { getZodConstraint, parseWithZod } from '@conform-to/zod';
 import { type ActionFunctionArgs, json } from '@remix-run/node';
 import { useFetcher } from '@remix-run/react';
 import * as React from 'react';
-import { useTranslation } from 'react-i18next';
+import { Trans, useTranslation } from 'react-i18next';
 import { Button, ModalV2 } from 'ui-design-system';
 import { z } from 'zod';

@@ -125,6 +128,18 @@ function ReviewDecisionContent({
           {t('cases:case_detail.review_decision.title')}
         </ModalV2.Title>
         <div className="flex flex-col gap-6 p-6">
+          <ModalV2.Description render={<Callout variant="outlined" />}>
+            <p className="whitespace-pre text-wrap">
+              <Trans
+                t={t}
+                i18nKey="cases:case_detail.review_decision.callout"
+                components={{
+                  DocLink: <ExternalLink href={blockingReviewDocHref} />,
+                }}
+              />
+            </p>
+          </ModalV2.Description>
+
           <input
             {...getInputProps(fields.decisionId, {
               type: 'hidden',
diff --git a/packages/ui-design-system/src/Select/Select.tsx b/packages/ui-design-system/src/Select/Select.tsx
index 432600e5..1ee51cac 100644
--- a/packages/ui-design-system/src/Select/Select.tsx
+++ b/packages/ui-design-system/src/Select/Select.tsx
@@ -62,7 +62,7 @@ function SelectViewport({
 }

 export const selectTrigger = cva(
-  'text-s text-grey-100 flex min-h-10 min-w-10 items-center justify-between border font-medium outline-none radix-state-open:border-purple-100 radix-state-open:text-purple-100 radix-disabled:border-grey-10 radix-disabled:bg-grey-05 radix-disabled:text-grey-50 radix-placeholder:text-grey-25',
+  'text-s text-grey-100 flex min-h-10 min-w-10 items-center justify-between border font-medium outline-none radix-state-open:border-purple-100 radix-state-open:text-purple-100 radix-disabled:border-grey-10 radix-disabled:bg-grey-05 radix-disabled:text-grey-50 radix-placeholder:text-grey-25 radix-placeholder:radix-state-open:text-grey-25',
   {
     variants: {
       backgroundColor: {
@@ -156,7 +156,7 @@ const SelectValue = forwardRef<HTMLDivElement, SelectValueProps>(

 const SelectArrow = () => (
   <SelectIcon
-    className="group-radix-state-open:rotate-180 size-6 shrink-0"
+    className="group-radix-state-open:rotate-180 text-grey-100 size-6 shrink-0"
     asChild
   >
     <Icon icon="arrow-2-down" />
@balzdur balzdur force-pushed the thomas/add-block-and-review-doc branch from 294dcf7 to 4ac66af Compare September 16, 2024 15:22
@balzdur balzdur enabled auto-merge (squash) September 16, 2024 15:24
@balzdur balzdur merged commit e0e1b97 into main Sep 16, 2024
3 checks passed
@balzdur balzdur deleted the thomas/add-block-and-review-doc branch September 16, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants