Skip to content

Commit 22535cd

Browse files
Merge pull request #184 from zenml-io/stack_creation_story_ahsan
Stack creation story ahsan
2 parents d06dada + 68734b5 commit 22535cd

File tree

5 files changed

+46
-60
lines changed

5 files changed

+46
-60
lines changed

src/ui/layouts/common/CustomStackBox/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export const CustomStackBox: React.FC<{
88
image: any;
99
stackName: string;
1010
stackDesc: string;
11-
value?: boolean;
12-
onCheck: () => void;
11+
value?: any;
12+
onCheck: any;
1313
}> = ({ image, stackName, stackDesc, value, onCheck }) => {
1414

1515
return (
@@ -18,20 +18,20 @@ export const CustomStackBox: React.FC<{
1818
paddingVertical="sm2"
1919
className={styles.stackBox}
2020
>
21-
<input type='checkbox' className={styles.checkbox} onClick={onCheck} />
21+
<input type='checkbox' className={styles.checkbox} checked={value} onClick={onCheck} />
2222
<Box className={styles.imageWrapper}>
2323
<Box className={styles.imageContainer}>
2424
<img src={image} alt="by Zenml" />
2525
</Box>
2626
</Box>
2727

2828
<Box style={{ marginTop: '8px' }}>
29-
<Paragraph className={styles.stackName}>{stackName}</Paragraph>
29+
<Paragraph className={styles.stackName}>{stackName?.slice(0, 15)}</Paragraph>
3030
</Box>
3131

3232
<Box marginTop="xs">
3333
<Paragraph className={styles.stackDesc}>
34-
{titleCase(stackDesc)}
34+
{titleCase(stackDesc?.slice(0, 15))}
3535
</Paragraph>
3636
</Box>
3737
</Box>

src/ui/layouts/common/StackBox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ export const StackBox: React.FC<{
5555

5656
<Box style={{ marginTop: '8px' }}>
5757
<Paragraph className={styles.stackName}>
58-
{titleCase(stackName)}
58+
{titleCase(stackName?.slice(0, 15))}
5959
</Paragraph>
6060
</Box>
6161

6262
<Box marginTop="xs">
6363
<Paragraph className={styles.stackDesc}>
64-
{titleCase(stackDesc)}
64+
{titleCase(stackDesc?.slice(0, 15))}
6565
</Paragraph>
6666
</Box>
6767
</Box>

src/ui/layouts/stacks/CreateStack/ListForAll/GetList/index.tsx

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useEffect, useState } from 'react';
22

33
import { Box, FlexBox, H3, FullWidthSpinner } from '../../../../../components';
4+
import { SidePopup } from '../SidePopup';
45

56
import { StackBox } from '../../../../common/StackBox';
67
import { CustomStackBox } from '../../../../common/CustomStackBox';
@@ -31,6 +32,7 @@ export const GetList: React.FC<Props> = ({
3132
const locationPath = useLocation() as any;
3233
const [fetching, setFetching] = useState(false);
3334
const [list, setlist] = useState([]);
35+
const [showPopup, setShowPopup] = useState<boolean>(false);
3436
const selectedWorkspace = useSelector(workspaceSelectors.selectedWorkspace);
3537

3638
useEffect(() => {
@@ -105,15 +107,21 @@ export const GetList: React.FC<Props> = ({
105107
<StackBox stackName="Create" stackDesc="Create a stack" />
106108
</div>
107109
</Box>
108-
{list?.map((item: any) => (
109-
<Box marginLeft="md">
110+
{list?.map((item: any) => {
111+
112+
const checkboxValue = selectedStack.filter((s: any) => {
113+
return s.id === item.id;
114+
});
115+
116+
return (
117+
<Box marginLeft="md" style={{ cursor: 'pointer' }} onClick={() => setShowPopup(true)}>
110118
<CustomStackBox
111119
image={item?.logoUrl}
112120
stackName={item.name}
113-
stackDesc={item?.flavor}
114-
value={false}
115-
onCheck={() => {
116-
// var selectedList = selectedStack;
121+
stackDesc={item?.flavor.name}
122+
value={checkboxValue?.length > 0 ? true : false}
123+
onCheck={(e: any) => {
124+
e.stopPropagation()
117125
var index = selectedStack.findIndex(function (s: any) {
118126
return s.id === item.id;
119127
});
@@ -126,8 +134,29 @@ export const GetList: React.FC<Props> = ({
126134
}}
127135
/>
128136
</Box>
129-
))}
137+
)
138+
})}
130139
</FlexBox.Row>
140+
141+
142+
{showPopup && (
143+
<SidePopup
144+
isCreate={false}
145+
onSeeExisting={() => {}}
146+
onClose={() => setShowPopup(false)}
147+
>
148+
<Box marginTop="md">
149+
{/* <FormTextField
150+
onChange={(e: any) => {}}
151+
placeholder=""
152+
label='Stack Name'
153+
value={selectedStackBox.name}
154+
/> */}
155+
</Box>
156+
</SidePopup>
157+
)}
158+
159+
131160
</>
132161
);
133162
};

src/ui/layouts/stacks/CreateStack/ListForAll/SidePopup/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const SidePopup: React.FC<{
4343
{children}
4444
</Box>
4545

46-
<Box
46+
<Box
4747
paddingVertical="lg"
4848
paddingHorizontal="md"
4949
className={styles.actionSection}
@@ -63,6 +63,7 @@ export const SidePopup: React.FC<{
6363
)}
6464
</FlexBox.Row>
6565
</Box>
66+
6667
</OutsideClickHandler>
6768
</Box>
6869
</FlexBox>

src/ui/layouts/stacks/CreateStack/ListForAll/index.tsx

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export const ListForAll: React.FC<Props> = () => {
216216

217217
{showPopup && (
218218
<SidePopup
219+
isCreate={true}
219220
registerStack={() => {
220221
onCreateStack();
221222
}}
@@ -231,51 +232,6 @@ export const ListForAll: React.FC<Props> = () => {
231232
</SidePopup>
232233
)}
233234

234-
{/* <Box marginTop="lg" style={{ overflowX: 'auto' }}>
235-
<FlexBox.Row alignItems="center">
236-
<H3 style={{ fontWeight: 'bold' }}>Artifact Store</H3>
237-
<span style={helperTextStyle}>&#40;5 Components&#41;</span>
238-
</FlexBox.Row>
239-
<FlexBox.Row>
240-
<Box style={{ width: '171px' }}>
241-
<StackBox stackName="Create" stackDesc="Create a stack" />
242-
</Box>
243-
{Array(5)
244-
.fill(null)
245-
?.map(() => (
246-
<Box marginLeft="md">
247-
<CustomStackBox
248-
image={logo}
249-
stackName="Sample"
250-
stackDesc="example text"
251-
/>
252-
</Box>
253-
))}
254-
</FlexBox.Row>
255-
</Box> */}
256-
257-
{/* <Box marginTop="lg" style={{ overflowX: 'auto' }}>
258-
<FlexBox.Row alignItems="center">
259-
<H3 style={{ fontWeight: 'bold' }}>Secret Manager</H3>
260-
<span style={helperTextStyle}>&#40;7 Components&#41;</span>
261-
</FlexBox.Row>
262-
<FlexBox.Row>
263-
<Box style={{ width: '171px' }}>
264-
<StackBox stackName="Create" stackDesc="Create a stack" />
265-
</Box>
266-
{Array(7)
267-
.fill(null)
268-
?.map(() => (
269-
<Box marginLeft="md">
270-
<CustomStackBox
271-
image={logo}
272-
stackName="Sample"
273-
stackDesc="example text"
274-
/>
275-
</Box>
276-
))}
277-
</FlexBox.Row>
278-
</Box> */}
279235
</Box>
280236
);
281237
};

0 commit comments

Comments
 (0)