-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PSP-9268 Sub-files tab skeleton view and container (#4395)
* Remove dead code * Skeleton view and container for Sub-Files tab * Update snapshots
- Loading branch information
Showing
7 changed files
with
103 additions
and
5 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
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
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
27 changes: 27 additions & 0 deletions
27
source/frontend/src/features/mapSideBar/acquisition/tabs/subFiles/SubFileListContainer.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,27 @@ | ||
import { ApiGen_Concepts_AcquisitionFile } from '@/models/api/generated/ApiGen_Concepts_AcquisitionFile'; | ||
|
||
import { ISubFileListViewProps } from './SubFileListView'; | ||
|
||
export interface ISubFileListContainerProps { | ||
View: React.FC<ISubFileListViewProps>; | ||
acquisitionFile: ApiGen_Concepts_AcquisitionFile; | ||
} | ||
|
||
export const SubFileListContainer: React.FunctionComponent<ISubFileListContainerProps> = ({ | ||
View, | ||
acquisitionFile, | ||
}) => { | ||
// TODO: Add an "useEffect" to fetch the list of linked files from the backend API | ||
// Use this loading flag to render a spinner in the view while loading | ||
const loading = false; | ||
|
||
const onAddSubFile = (): void => { | ||
// TODO: Here we will copy some data from main file into sub-file and redirect to "Create Acquisition File" for sub-file | ||
// This will be done in another pull-request. | ||
throw new Error('Function not implemented yet.'); | ||
}; | ||
|
||
return <View loading={loading} acquisitionFile={acquisitionFile} onAdd={onAddSubFile} />; | ||
}; | ||
|
||
export default SubFileListContainer; |
45 changes: 45 additions & 0 deletions
45
source/frontend/src/features/mapSideBar/acquisition/tabs/subFiles/SubFileListView.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,45 @@ | ||
import { FaPlus } from 'react-icons/fa'; | ||
|
||
import LoadingBackdrop from '@/components/common/LoadingBackdrop'; | ||
import { Section } from '@/components/common/Section/Section'; | ||
import { StyledSummarySection } from '@/components/common/Section/SectionStyles'; | ||
import { SimpleSectionHeader } from '@/components/common/SimpleSectionHeader'; | ||
import { StyledSectionAddButton } from '@/components/common/styles'; | ||
import { Claims } from '@/constants'; | ||
import useKeycloakWrapper from '@/hooks/useKeycloakWrapper'; | ||
import { ApiGen_Concepts_AcquisitionFile } from '@/models/api/generated/ApiGen_Concepts_AcquisitionFile'; | ||
import { exists } from '@/utils'; | ||
|
||
export interface ISubFileListViewProps { | ||
loading: boolean; | ||
acquisitionFile: ApiGen_Concepts_AcquisitionFile; | ||
onAdd: () => void; | ||
} | ||
|
||
export const SubFileListView: React.FunctionComponent<ISubFileListViewProps> = ({ | ||
loading, | ||
onAdd, | ||
}) => { | ||
const { hasClaim } = useKeycloakWrapper(); | ||
|
||
return ( | ||
<StyledSummarySection> | ||
<LoadingBackdrop show={loading} parentScreen={true} /> | ||
|
||
<Section | ||
header={ | ||
<SimpleSectionHeader title="Linked Files"> | ||
{hasClaim(Claims.ACQUISITION_ADD) && exists(onAdd) && ( | ||
<StyledSectionAddButton onClick={onAdd}> | ||
<FaPlus size="2rem" className="mr-2" /> | ||
Add Sub-interest File | ||
</StyledSectionAddButton> | ||
)} | ||
</SimpleSectionHeader> | ||
} | ||
></Section> | ||
</StyledSummarySection> | ||
); | ||
}; | ||
|
||
export default SubFileListView; |
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