-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(meshconfig): implement EditConfiguration as modal
- Loading branch information
Showing
5 changed files
with
59 additions
and
75 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
plugins/lime-plugin-mesh-wide-config/src/containers/EditConfiguration.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 { Trans } from "@lingui/macro"; | ||
|
||
import { | ||
FullScreenModal, | ||
IFullScreenModalProps, | ||
} from "components/Modal/FullScreenModal"; | ||
|
||
import { | ||
AddNewSectionBtn, | ||
ConfigSection, | ||
} from "plugins/lime-plugin-mesh-wide-config/src/components/ConfigSection"; | ||
import { MeshStatus } from "plugins/lime-plugin-mesh-wide-config/src/components/MeshStatus"; | ||
import { useMeshWideConfig } from "plugins/lime-plugin-mesh-wide-config/src/meshConfigQueries"; | ||
|
||
const EditConfiguration = (props: Partial<IFullScreenModalProps>) => { | ||
const { data: meshWideConfig, isLoading } = useMeshWideConfig({}); | ||
|
||
return ( | ||
<FullScreenModal | ||
title={<Trans>Mesh wide config</Trans>} | ||
isLoading={isLoading} | ||
{...props} | ||
> | ||
{meshWideConfig && ( | ||
<> | ||
<div className={"flex flex-col gap-3"}> | ||
{meshWideConfig.map((dropdown, index) => ( | ||
<ConfigSection key={index} dropdown={dropdown} /> | ||
))} | ||
<AddNewSectionBtn /> | ||
</div> | ||
<MeshStatus /> | ||
</> | ||
)} | ||
</FullScreenModal> | ||
); | ||
}; | ||
|
||
export default EditConfiguration; |
37 changes: 10 additions & 27 deletions
37
plugins/lime-plugin-mesh-wide-config/src/meshConfigPage.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 |
---|---|---|
@@ -1,36 +1,19 @@ | ||
import { Trans } from "@lingui/macro"; | ||
import { useState } from "preact/hooks"; | ||
import React from "react"; | ||
|
||
import { FullScreenModal } from "components/Modal/FullScreenModal"; | ||
import { Button } from "components/elements/button"; | ||
|
||
import { | ||
AddNewSectionBtn, | ||
ConfigSection, | ||
} from "plugins/lime-plugin-mesh-wide-config/src/components/ConfigSection"; | ||
import { MeshStatus } from "plugins/lime-plugin-mesh-wide-config/src/components/MeshStatus"; | ||
import { useMeshWideConfig } from "plugins/lime-plugin-mesh-wide-config/src/meshConfigQueries"; | ||
import EditConfiguration from "plugins/lime-plugin-mesh-wide-config/src/containers/EditConfiguration"; | ||
|
||
const MeshConfigPage = () => { | ||
const { data: meshWideConfig, isLoading } = useMeshWideConfig({}); | ||
// State to show modal | ||
const [showEditConfig, setShowEditConfig] = useState(false); | ||
|
||
return ( | ||
<FullScreenModal | ||
title={<Trans>Mesh wide config</Trans>} | ||
isLoading={isLoading} | ||
> | ||
{meshWideConfig && ( | ||
<> | ||
<div className={"flex flex-col gap-3"}> | ||
{meshWideConfig.map((dropdown, index) => ( | ||
<ConfigSection key={index} dropdown={dropdown} /> | ||
))} | ||
<AddNewSectionBtn /> | ||
</div> | ||
<MeshStatus /> | ||
</> | ||
)} | ||
</FullScreenModal> | ||
); | ||
if (showEditConfig) { | ||
return <EditConfiguration onClose={() => setShowEditConfig(false)} />; | ||
} | ||
|
||
return <Button onClick={() => setShowEditConfig(true)}>Show modal</Button>; | ||
}; | ||
|
||
export default MeshConfigPage; |
40 changes: 0 additions & 40 deletions
40
plugins/lime-plugin-mesh-wide-config/src/screens/configPage.tsx
This file was deleted.
Oops, something went wrong.
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