Skip to content

Commit b59161a

Browse files
committed
change the logic for rendering resources explorer for 'none' state of storage selected
1 parent e4d0ec0 commit b59161a

File tree

1 file changed

+70
-67
lines changed

1 file changed

+70
-67
lines changed

src/components/AccountBottomBar.tsx

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ const StateContainer: React.FC<{ value?: any }> = ({ value }) => (
195195

196196
const AccountState: React.FC<{
197197
state: any;
198+
selectedResourcesAccount: string;
198199
renderDeployButton: () => JSX.Element;
199-
}> = ({ state }) => {
200+
}> = ({ state, selectedResourcesAccount }) => {
200201
if (!state) {
201202
state = '{}';
202203
}
@@ -277,65 +278,67 @@ const AccountState: React.FC<{
277278
return (
278279
<>
279280
{identifiers.length ? (
280-
<AccountStateContainer height={storageHeight + resultHeight}>
281-
<IdentifierList
282-
identifiers={identifiers}
283-
types={types}
284-
selected={selected}
285-
onSelect={setSelected}
286-
resize={() => toggleResizingStorage(true)}
287-
controls={() => {
288-
return (
289-
<SidebarItemInsert grab={false}>
290-
{storageHeight > 40 ? (
291-
<GoChevronDown
292-
size="16px"
293-
onClick={() => setStorageHeight(40)}
294-
/>
295-
) : (
296-
<GoChevronUp
297-
size="16px"
298-
onClick={() =>
299-
setStorageHeight(STORAGE_PANEL_MIN_HEIGHT * 2)
300-
}
301-
/>
302-
)}
303-
</SidebarItemInsert>
304-
);
305-
}}
306-
/>
307-
<StateContainer value={storage[selected]} />
308-
</AccountStateContainer>
281+
selectedResourcesAccount !== 'none' &&
282+
<AccountStateContainer height={storageHeight + resultHeight}>
283+
<IdentifierList
284+
identifiers={identifiers}
285+
types={types}
286+
selected={selected}
287+
onSelect={setSelected}
288+
resize={() => toggleResizingStorage(true)}
289+
controls={() => {
290+
return (
291+
<SidebarItemInsert grab={false}>
292+
{storageHeight > 40 ? (
293+
<GoChevronDown
294+
size="16px"
295+
onClick={() => setStorageHeight(40)}
296+
/>
297+
) : (
298+
<GoChevronUp
299+
size="16px"
300+
onClick={() =>
301+
setStorageHeight(STORAGE_PANEL_MIN_HEIGHT * 2)
302+
}
303+
/>
304+
)}
305+
</SidebarItemInsert>
306+
);
307+
}}
308+
/>
309+
<StateContainer value={storage[selected]} />
310+
</AccountStateContainer>
309311
) : (
310-
<AccountStateContainer height={storageHeight + resultHeight}>
311-
<IdentifierList
312-
identifiers={[]}
313-
types={{}}
314-
selected={selected}
315-
onSelect={setSelected}
316-
resize={() => toggleResizingStorage(true)}
317-
controls={() => {
318-
return (
319-
<SidebarItemInsert grab={false}>
320-
{storageHeight > 40 ? (
321-
<GoChevronDown
322-
size="16px"
323-
onClick={() => setStorageHeight(40)}
324-
/>
325-
) : (
326-
<GoChevronUp
327-
size="16px"
328-
onClick={() =>
329-
setStorageHeight(STORAGE_PANEL_MIN_HEIGHT * 2)
330-
}
331-
/>
332-
)}
333-
</SidebarItemInsert>
334-
);
335-
}}
336-
/>
337-
<StateContainer />
338-
</AccountStateContainer>
312+
selectedResourcesAccount !== 'none' &&
313+
<AccountStateContainer height={storageHeight + resultHeight}>
314+
<IdentifierList
315+
identifiers={[]}
316+
types={{}}
317+
selected={selected}
318+
onSelect={setSelected}
319+
resize={() => toggleResizingStorage(true)}
320+
controls={() => {
321+
return (
322+
<SidebarItemInsert grab={false}>
323+
{storageHeight > 40 ? (
324+
<GoChevronDown
325+
size="16px"
326+
onClick={() => setStorageHeight(40)}
327+
/>
328+
) : (
329+
<GoChevronUp
330+
size="16px"
331+
onClick={() =>
332+
setStorageHeight(STORAGE_PANEL_MIN_HEIGHT * 2)
333+
}
334+
/>
335+
)}
336+
</SidebarItemInsert>
337+
);
338+
}}
339+
/>
340+
<StateContainer />
341+
</AccountStateContainer>
339342
)}
340343
<DeploymentResultContainer height={resultHeight}>
341344
<ResizeHeading onMouseDown={() => toggleResizingResult(true)}>
@@ -367,19 +370,19 @@ const AccountBottomBar: React.FC = () => {
367370
"0x04": 3,
368371
"0x05": 4
369372
}
370-
373+
371374
return (
372375
<FeedbackRoot>
373376
{isLoading ? (
374377
<p>Loading...</p>
375378
) : (
376-
selectedResourceAccount !== 'none' &&
377-
<AccountState
378-
state={project.accounts[storageMap[selectedResourceAccount] || 0].state}
379-
renderDeployButton={() => {
380-
return <FeedbackActions />;
381-
}}
382-
/>
379+
<AccountState
380+
state={project.accounts[storageMap[selectedResourceAccount] || 0].state}
381+
selectedResourcesAccount={selectedResourceAccount}
382+
renderDeployButton={() => {
383+
return <FeedbackActions />;
384+
}}
385+
/>
383386
)}
384387
</FeedbackRoot>
385388
);

0 commit comments

Comments
 (0)