-
Notifications
You must be signed in to change notification settings - Fork 50
feat: Add reconfiguration support for GitHub trigger callsign and labels #2019
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
base: main
Are you sure you want to change the base?
Changes from all commits
6f55d9e
834533d
e4d5af3
886d9c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,26 +10,41 @@ interface LabelsInputStepProps { | |
| eventId: GitHubTriggerEventId; | ||
| owner: string; | ||
| repo: string; | ||
| initialLabels?: string[]; | ||
| onBack: () => void; | ||
| onSubmit: ( | ||
| e: FormEvent<HTMLFormElement>, | ||
| rawLabels: { id: number; value: string }[], | ||
| ) => void; | ||
| errorMessage?: string; | ||
| isPending: boolean; | ||
| labelsError: string | null; | ||
| showBackButton?: boolean; | ||
| } | ||
|
|
||
| export function LabelsInputStep({ | ||
| eventId, | ||
| owner, | ||
| repo, | ||
| initialLabels, | ||
| onBack, | ||
| onSubmit, | ||
| errorMessage, | ||
| isPending, | ||
| labelsError, | ||
| showBackButton = true, | ||
| }: LabelsInputStepProps) { | ||
| const [labels, setLabels] = useState([{ id: 1, value: "" }]); | ||
| const [nextId, setNextId] = useState(2); | ||
| const [labels, setLabels] = useState(() => | ||
| initialLabels !== undefined && initialLabels.length > 0 | ||
| ? initialLabels.map((value, index) => ({ | ||
| id: index + 1, | ||
| value, | ||
| })) | ||
| : [{ id: 1, value: "" }], | ||
| ); | ||
| const [nextId, setNextId] = useState( | ||
| initialLabels !== undefined && initialLabels.length > 0 | ||
| ? initialLabels.length + 1 | ||
| : 2, | ||
| ); | ||
|
|
||
| return ( | ||
| <form | ||
|
|
@@ -71,12 +86,12 @@ export function LabelsInputStep({ | |
| ) | ||
| } | ||
| className={clsx( | ||
| "flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none", | ||
| labelsError | ||
| ? "border border-red-500 focus:border-red-400" | ||
| "flex-1 rounded-[8px] py-[8px] px-[12px] outline-none focus:outline-none text-[14px] bg-transparent", | ||
| errorMessage !== undefined | ||
| ? "border border-[#FF3D71] focus:border-[#FF3D71]" | ||
| : "border border-white-400 focus:border-border", | ||
| "text-[14px] bg-transparent", | ||
| )} | ||
| required={true} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: HTML5 Validation Conflicts with Custom LogicThe |
||
| placeholder="bug" | ||
| /> | ||
| {labels.length > 1 && ( | ||
|
|
@@ -93,14 +108,15 @@ export function LabelsInputStep({ | |
| )} | ||
| </div> | ||
| ))} | ||
| {labelsError ? ( | ||
| <p className="text-[12px] text-red-400 pl-2">{labelsError}</p> | ||
| ) : ( | ||
| <p className="text-[12px] text-inverse pl-2"> | ||
| Labels are required for issue labeled triggers. Examples: bug, | ||
| feature, urgent | ||
| {errorMessage !== undefined && ( | ||
| <p className="text-[12px] text-[#FF3D71] pl-2" role="alert"> | ||
| {errorMessage} | ||
| </p> | ||
| )} | ||
| <p className="text-[12px] text-inverse pl-2"> | ||
| Labels are required for issue labeled triggers. Examples: bug, | ||
| feature, urgent | ||
| </p> | ||
| <button | ||
| type="button" | ||
| onClick={() => { | ||
|
|
@@ -116,17 +132,22 @@ export function LabelsInputStep({ | |
| </fieldset> | ||
|
|
||
| <div className="pt-[8px] flex gap-[8px] mt-[12px] px-[4px]"> | ||
| <button | ||
| type="button" | ||
| className="flex-1 bg-bg-700 hover:bg-bg-600 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative" | ||
| onClick={onBack} | ||
| disabled={isPending} | ||
| > | ||
| <span className={isPending ? "opacity-0" : ""}>Back</span> | ||
| </button> | ||
| {showBackButton && ( | ||
| <button | ||
| type="button" | ||
| className="flex-1 bg-bg-700 hover:bg-bg-600 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative" | ||
| onClick={onBack} | ||
| disabled={isPending} | ||
| > | ||
| <span className={isPending ? "opacity-0" : ""}>Back</span> | ||
| </button> | ||
| )} | ||
| <button | ||
| type="submit" | ||
| className="flex-1 bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative" | ||
| className={clsx( | ||
| "bg-primary-900 hover:bg-primary-800 text-inverse font-medium px-4 py-2 rounded-md text-[14px] transition-colors disabled:opacity-50 relative", | ||
| showBackButton ? "flex-1" : "w-full", | ||
| )} | ||
| disabled={isPending} | ||
| > | ||
| <span className={isPending ? "opacity-0" : ""}> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
required={true}attribute is unnecessary sincetrueis the default value when the attribute is present. Userequiredinstead for cleaner JSX.