-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from alonkeyval/TASK-143-add-new-source-btn
Task 143 add new source btn
- Loading branch information
Showing
8 changed files
with
111 additions
and
6 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
11 changes: 11 additions & 0 deletions
11
frontend/webapp/components/overview/sources/action.menu/sources.action.menu.styled.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,11 @@ | ||
import styled from "styled-components"; | ||
|
||
export const SourcesMenuWrapper = styled.div` | ||
width: 100%; | ||
margin-top: 32px; | ||
padding-top: 88px; | ||
display: flex; | ||
justify-content: space-between; | ||
`; | ||
|
||
export const InputsWrapper = styled.div``; |
25 changes: 25 additions & 0 deletions
25
frontend/webapp/components/overview/sources/action.menu/sources.action.menu.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,25 @@ | ||
import React from "react"; | ||
import { | ||
InputsWrapper, | ||
SourcesMenuWrapper, | ||
} from "./sources.action.menu.styled"; | ||
import { KeyvalButton, KeyvalText } from "@/design.system"; | ||
import { Plus } from "@/assets/icons/overview"; | ||
import { OVERVIEW } from "@/utils/constants"; | ||
import theme from "@/styles/palette"; | ||
|
||
const BUTTON_STYLES = { gap: 10, height: 36 }; | ||
|
||
export function SourcesActionMenu({ onAddClick }) { | ||
return ( | ||
<SourcesMenuWrapper> | ||
<InputsWrapper></InputsWrapper> | ||
<KeyvalButton onClick={onAddClick} style={BUTTON_STYLES}> | ||
<Plus /> | ||
<KeyvalText size={16} weight={700} color={theme.text.dark_button}> | ||
{OVERVIEW.ADD_NEW_SOURCE} | ||
</KeyvalText> | ||
</KeyvalButton> | ||
</SourcesMenuWrapper> | ||
); | ||
} |
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
28 changes: 28 additions & 0 deletions
28
frontend/webapp/containers/overview/sources/new.source.flow.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,28 @@ | ||
import React from "react"; | ||
import { useSectionData } from "@/hooks"; | ||
import { SourcesSectionWrapper, ButtonWrapper } from "./sources.styled"; | ||
import { SourcesSection } from "@/containers/setup/sources/sources.section"; | ||
import { KeyvalButton, KeyvalText } from "@/design.system"; | ||
import theme from "@/styles/palette"; | ||
import { SETUP } from "@/utils/constants"; | ||
|
||
export function NewSourceFlow() { | ||
const { sectionData, setSectionData, totalSelected } = useSectionData({}); | ||
|
||
return ( | ||
<SourcesSectionWrapper> | ||
<ButtonWrapper> | ||
<KeyvalText>{`${totalSelected} ${SETUP.SELECTED}`}</KeyvalText> | ||
<KeyvalButton style={{ width: 110 }}> | ||
<KeyvalText weight={600} color={theme.text.dark_button}> | ||
Connect | ||
</KeyvalText> | ||
</KeyvalButton> | ||
</ButtonWrapper> | ||
<SourcesSection | ||
sectionData={sectionData} | ||
setSectionData={setSectionData} | ||
/> | ||
</SourcesSectionWrapper> | ||
); | ||
} |
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
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,27 +1,49 @@ | ||
"use client"; | ||
import React from "react"; | ||
import React, { useState } from "react"; | ||
import { KeyvalLoader } from "@/design.system"; | ||
import { OVERVIEW, QUERIES } from "@/utils/constants"; | ||
import { useQuery } from "react-query"; | ||
import { getSources } from "@/services"; | ||
import { OverviewHeader, SourcesManagedList } from "@/components/overview"; | ||
import { SourcesContainerWrapper } from "./sources.styled"; | ||
import { | ||
OverviewHeader, | ||
SourcesActionMenu, | ||
SourcesManagedList, | ||
} from "@/components/overview"; | ||
import { SourcesContainerWrapper, MenuWrapper } from "./sources.styled"; | ||
import { NewSourceFlow } from "./new.source.flow"; | ||
|
||
export function SourcesContainer() { | ||
const [displayNewSourceFlow, setDisplayNewSourceFlow] = useState(false); | ||
|
||
const { | ||
data: sources, | ||
refetch, | ||
isLoading, | ||
} = useQuery([QUERIES.API_SOURCES], getSources); | ||
|
||
function renderNewSourceFlow() { | ||
return <NewSourceFlow />; | ||
} | ||
|
||
function renderSources() { | ||
return ( | ||
<> | ||
<MenuWrapper> | ||
<SourcesActionMenu onAddClick={() => setDisplayNewSourceFlow(true)} /> | ||
</MenuWrapper> | ||
<SourcesManagedList data={sources} /> | ||
</> | ||
); | ||
} | ||
|
||
if (isLoading) { | ||
return <KeyvalLoader />; | ||
} | ||
|
||
return ( | ||
<SourcesContainerWrapper> | ||
<OverviewHeader title={OVERVIEW.MENU.SOURCES} /> | ||
<SourcesManagedList data={sources} /> | ||
{displayNewSourceFlow ? renderNewSourceFlow() : renderSources()} | ||
</SourcesContainerWrapper> | ||
); | ||
} |
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