Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
feat(pipeline-builder): Make the array fields on start node start wit…
Browse files Browse the repository at this point in the history
…h only one field (#959)

Because

- Improve UX

This commit

- Make the array fields on start node start with only one field
  • Loading branch information
EiffelFly committed Oct 12, 2023
1 parent 780ee01 commit e203cde
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@instill-ai/toolkit",
"version": "0.68.3-rc.67",
"version": "0.68.3-rc.69",
"description": "Instill AI's frontend toolkit",
"repository": "https://github.com/instill-ai/design-system.git",
"bugs": "https://github.com/instill-ai/design-system/issues",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ export const PipelineTriggerCountsLineChart = ({
<Tooltip.Arrow
className="fill-semantic-bg-primary"
offset={10}
width={18}
height={12}
width={9}
height={6}
/>
</Tooltip.Content>
</Tooltip.Portal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const ReleasePipelineModal = (props: ReleasePipelineModalProps) => {
<Dialog.Trigger asChild>
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger asChild={true}>
<Tooltip.Trigger asChild>
{/*
This will make tooltip work even with a disabled button
https://www.radix-ui.com/primitives/docs/components/tooltip#displaying-a-tooltip-from-a-disabled-button
Expand Down Expand Up @@ -162,8 +162,8 @@ export const ReleasePipelineModal = (props: ReleasePipelineModalProps) => {
<Tooltip.Arrow
className="fill-semantic-bg-primary"
offset={10}
width={18}
height={12}
width={9}
height={6}
/>
</Tooltip.Content>
</Tooltip.Portal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export const SharePipelineDialog = (props: SharePipelineDialogProps) => {
<Tooltip.Arrow
className="fill-semantic-bg-primary"
offset={10}
width={18}
height={12}
width={9}
height={6}
/>
</Tooltip.Content>
</Tooltip.Portal>
Expand Down Expand Up @@ -218,8 +218,8 @@ export const SharePipelineDialog = (props: SharePipelineDialogProps) => {
<Tooltip.Arrow
className="fill-semantic-bg-primary"
offset={10}
width={18}
height={12}
width={9}
height={6}
/>
</Tooltip.Content>
</Tooltip.Portal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Input,
LinkButton,
Textarea,
Tooltip,
useToast,
} from "@instill-ai/design-system";
import { shallow } from "zustand/shallow";
Expand Down Expand Up @@ -41,7 +42,7 @@ import {
ImageWithFallback,
} from "../../../../components";
import { ConnectorNodeControlPanel } from "./ConnectorNodeControlPanel";
import { ResourceNameTag } from "./ResourceNameTag";
import { ResourceIDTag } from "./ResourceIDTag";

const pipelineBuilderSelector = (state: PipelineBuilderStore) => ({
expandAllNodes: state.expandAllNodes,
Expand Down Expand Up @@ -525,15 +526,40 @@ export const ConnectorNode = ({ data, id }: NodeProps<ConnectorNodeData>) => {
/>
</form>
</Form.Root>
<button
onClick={(e) => {
e.stopPropagation();
connectorIDInputRef.current?.focus();
}}
type="button"
>
<Icons.Edit03 className="h-4 w-4 stroke-semantic-fg-primary" />
</button>
<Tooltip.Provider>
<Tooltip.Root>
<Tooltip.Trigger asChild>
{/*
eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
*/}
<span className="flex" tabIndex={0}>
<button
onClick={(e) => {
e.stopPropagation();
connectorIDInputRef.current?.focus();
}}
type="button"
>
<Icons.Edit03 className="h-4 w-4 stroke-semantic-fg-primary" />
</button>
</span>
</Tooltip.Trigger>
<Tooltip.Portal>
<Tooltip.Content
side="top"
className="!px-3 !py-2 rounded-sm !product-body-text-4-semibold bg-semantic-bg-primary"
>
Edit the component ID
<Tooltip.Arrow
className="fill-semantic-bg-primary"
offset={10}
width={9}
height={6}
/>
</Tooltip.Content>
</Tooltip.Portal>
</Tooltip.Root>
</Tooltip.Provider>
</div>
{isLatestVersion && isOwner ? (
<ConnectorNodeControlPanel
Expand Down Expand Up @@ -946,7 +972,13 @@ export const ConnectorNode = ({ data, id }: NodeProps<ConnectorNodeData>) => {
</>
)}
<div className="flex flex-row-reverse">
<ResourceNameTag resourceName={data.component.resource_name} />
<ResourceIDTag
resourceID={
data.component.resource_name
? data.component.resource_name.split("/")[3]
: null
}
/>
</div>
</div>
<CustomHandle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Tag, Tooltip } from "@instill-ai/design-system";
import { Nullable } from "../../../../lib";

export const ResourceNameTag = ({
resourceName,
export const ResourceIDTag = ({
resourceID,
}: {
resourceName: Nullable<string>;
resourceID: Nullable<string>;
}) => {
const resourceID = resourceName ? resourceName.split("/")[3] : null;
// const resourceID = resourceName ? resourceName.split("/")[3] : null;

return resourceID ? (
<Tooltip.Provider>
Expand All @@ -28,7 +28,7 @@ export const ResourceNameTag = ({
>
<div className="flex flex-col gap-y-1 text-left">
<p className="product-body-text-4-semibold bg-semantic-bg-primary">
resource name
resource ID
</p>
<p className="product-body-text-4-regular break-words text-semantic-fg-secondary">
{resourceID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export const NumbersField = (props: {
title: string;
}) => {
const [numberFieldsArray, setNumberFieldsArray] = React.useState<number[]>([
1, 1,
1,
]);

const [numberFieldsValue, setNumberFieldsValue] = React.useState<
(string | undefined)[]
>(["", ""]);
>([""]);

const { form, fieldKey, title } = props;
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ export const TextsField = (props: {
fieldKey: string;
title: string;
}) => {
const [textFieldsArray, setTextFieldsArray] = React.useState<number[]>([
1, 1,
]);
const [textFieldsArray, setTextFieldsArray] = React.useState<number[]>([1]);

const [textFieldsValue, setTextFieldsValue] = React.useState<
(string | undefined)[]
>(["", ""]);
>([""]);

const { form, fieldKey, title } = props;
return (
Expand Down

1 comment on commit e203cde

@vercel
Copy link

@vercel vercel bot commented on e203cde Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.