-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pipeline-builder): revamp the style of select component dialog (#…
…1199) Because - revamp the style of select component dialog This commit - revamp the style of select component dialog
- Loading branch information
Showing
10 changed files
with
294 additions
and
291 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
...oolkit/src/view/pipeline-builder/components/dialogs/select-component-dialog/AISection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Icons } from "@instill-ai/design-system"; | ||
import { ImageWithFallback } from "../../../../../components"; | ||
import { Section } from "./Section"; | ||
import { OnSelectComponent } from "./SelectComponentDialog"; | ||
import { | ||
InstillStore, | ||
useConnectorDefinitions, | ||
useInstillStore, | ||
useShallow, | ||
} from "../../../../../lib"; | ||
|
||
const selector = (store: InstillStore) => ({ | ||
accessToken: store.accessToken, | ||
enabledQuery: store.enabledQuery, | ||
}); | ||
|
||
export const AISection = ({ onSelect }: { onSelect: OnSelectComponent }) => { | ||
const { accessToken, enabledQuery } = useInstillStore(useShallow(selector)); | ||
|
||
const aiDefinitions = useConnectorDefinitions({ | ||
connectorType: "CONNECTOR_TYPE_AI", | ||
enabled: enabledQuery, | ||
accessToken, | ||
}); | ||
|
||
return ( | ||
<Section.Root title="AI"> | ||
{aiDefinitions.isSuccess | ||
? aiDefinitions.data.map((definition) => ( | ||
<Section.Item | ||
key={definition.id} | ||
onClick={() => { | ||
onSelect(definition); | ||
}} | ||
> | ||
<ImageWithFallback | ||
src={`/icons/${definition.id}.svg`} | ||
width={32} | ||
height={32} | ||
alt={`${definition.title}-icon`} | ||
fallbackImg={ | ||
<Icons.Box className="h-8 w-8 stroke-semantic-fg-primary" /> | ||
} | ||
/> | ||
<p className="my-auto text-left text-semantic-fg-primary product-headings-heading-5"> | ||
{definition.title} | ||
</p> | ||
</Section.Item> | ||
)) | ||
: null} | ||
</Section.Root> | ||
); | ||
}; |
57 changes: 57 additions & 0 deletions
57
...c/view/pipeline-builder/components/dialogs/select-component-dialog/ApplicationSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Icons } from "@instill-ai/design-system"; | ||
import { ImageWithFallback } from "../../../../../components"; | ||
import { Section } from "./Section"; | ||
import { OnSelectComponent } from "./SelectComponentDialog"; | ||
import { | ||
InstillStore, | ||
useConnectorDefinitions, | ||
useInstillStore, | ||
useShallow, | ||
} from "../../../../../lib"; | ||
|
||
const selector = (store: InstillStore) => ({ | ||
accessToken: store.accessToken, | ||
enabledQuery: store.enabledQuery, | ||
}); | ||
|
||
export const ApplicationSection = ({ | ||
onSelect, | ||
}: { | ||
onSelect: OnSelectComponent; | ||
}) => { | ||
const { accessToken, enabledQuery } = useInstillStore(useShallow(selector)); | ||
|
||
const applicationDefinitions = useConnectorDefinitions({ | ||
connectorType: "CONNECTOR_TYPE_APPLICATION", | ||
enabled: enabledQuery, | ||
accessToken, | ||
}); | ||
|
||
return ( | ||
<Section.Root title="Application"> | ||
{applicationDefinitions.isSuccess | ||
? applicationDefinitions.data.map((definition) => ( | ||
<Section.Item | ||
key={definition.id} | ||
onClick={() => { | ||
onSelect(definition); | ||
}} | ||
> | ||
<ImageWithFallback | ||
src={`/icons/${definition.id}.svg`} | ||
width={32} | ||
height={32} | ||
alt={`${definition.title}-icon`} | ||
fallbackImg={ | ||
<Icons.Box className="h-8 w-8 stroke-semantic-fg-primary" /> | ||
} | ||
/> | ||
<p className="my-auto text-left text-semantic-fg-primary product-headings-heading-5"> | ||
{definition.title} | ||
</p> | ||
</Section.Item> | ||
)) | ||
: null} | ||
</Section.Root> | ||
); | ||
}; |
53 changes: 53 additions & 0 deletions
53
...lkit/src/view/pipeline-builder/components/dialogs/select-component-dialog/DataSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Icons } from "@instill-ai/design-system"; | ||
import { ImageWithFallback } from "../../../../../components"; | ||
import { Section } from "./Section"; | ||
import { OnSelectComponent } from "./SelectComponentDialog"; | ||
import { | ||
InstillStore, | ||
useConnectorDefinitions, | ||
useInstillStore, | ||
useShallow, | ||
} from "../../../../../lib"; | ||
|
||
const selector = (store: InstillStore) => ({ | ||
accessToken: store.accessToken, | ||
enabledQuery: store.enabledQuery, | ||
}); | ||
|
||
export const DataSection = ({ onSelect }: { onSelect: OnSelectComponent }) => { | ||
const { accessToken, enabledQuery } = useInstillStore(useShallow(selector)); | ||
|
||
const dataDefinitions = useConnectorDefinitions({ | ||
connectorType: "CONNECTOR_TYPE_DATA", | ||
enabled: enabledQuery, | ||
accessToken, | ||
}); | ||
|
||
return ( | ||
<Section.Root title="Data"> | ||
{dataDefinitions.isSuccess | ||
? dataDefinitions.data.map((definition) => ( | ||
<Section.Item | ||
key={definition.id} | ||
onClick={() => { | ||
onSelect(definition); | ||
}} | ||
> | ||
<ImageWithFallback | ||
src={`/icons/${definition.id}.svg`} | ||
width={32} | ||
height={32} | ||
alt={`${definition.title}-icon`} | ||
fallbackImg={ | ||
<Icons.Box className="h-8 w-8 stroke-semantic-fg-primary" /> | ||
} | ||
/> | ||
<p className="my-auto text-left text-semantic-fg-primary product-headings-heading-5"> | ||
{definition.title} | ||
</p> | ||
</Section.Item> | ||
)) | ||
: null} | ||
</Section.Root> | ||
); | ||
}; |
39 changes: 39 additions & 0 deletions
39
...t/src/view/pipeline-builder/components/dialogs/select-component-dialog/GenericSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Icons } from "@instill-ai/design-system"; | ||
import { ImageWithFallback } from "../../../../../components"; | ||
import { Section } from "./Section"; | ||
import { OnSelectComponent } from "./SelectComponentDialog"; | ||
|
||
export const GenericSection = ({ | ||
onSelect, | ||
}: { | ||
onSelect: OnSelectComponent; | ||
}) => { | ||
return ( | ||
<Section.Root title="Generic"> | ||
<Section.Item | ||
onClick={() => { | ||
onSelect({ | ||
id: "iterator", | ||
title: "Iterator", | ||
icon: "iterator.svg", | ||
name: "iterator/iterator", | ||
uid: "uid", | ||
}); | ||
}} | ||
> | ||
<ImageWithFallback | ||
src="/icons/iterator.svg" | ||
width={32} | ||
height={32} | ||
alt="iterator-icon" | ||
fallbackImg={ | ||
<Icons.Box className="h-8 w-8 stroke-semantic-fg-primary" /> | ||
} | ||
/> | ||
<p className="my-auto text-left text-semantic-fg-primary product-headings-heading-5"> | ||
Iterator | ||
</p> | ||
</Section.Item> | ||
</Section.Root> | ||
); | ||
}; |
43 changes: 0 additions & 43 deletions
43
.../src/view/pipeline-builder/components/dialogs/select-component-dialog/IteratorSection.tsx
This file was deleted.
Oops, something went wrong.
126 changes: 0 additions & 126 deletions
126
.../view/pipeline-builder/components/dialogs/select-component-dialog/NewConnectorSection.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.