-
Notifications
You must be signed in to change notification settings - Fork 11
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 #1038 from boxwise/feature/boxview-history-overaly
BoxView: Add History Overlay
- Loading branch information
Showing
21 changed files
with
400 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { | ||
Modal, | ||
ModalBody, | ||
ModalCloseButton, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
ModalOverlay, | ||
} from "@chakra-ui/react"; | ||
import Timeline, { IGroupedRecordEntry } from "../Timeline/Timeline"; | ||
|
||
interface IHistoryOverlay { | ||
data: IGroupedRecordEntry[]; | ||
isOpen: boolean; | ||
onClose: () => void; | ||
} | ||
|
||
function HistoryOverlay({ data, isOpen, onClose }: IHistoryOverlay) { | ||
return ( | ||
<Modal | ||
isOpen={isOpen} | ||
onClose={onClose} | ||
blockScrollOnMount={false} | ||
size="3xl" | ||
scrollBehavior="inside" | ||
> | ||
<ModalOverlay /> | ||
<ModalContent borderRadius="0"> | ||
<ModalHeader>Box History</ModalHeader> | ||
<ModalCloseButton /> | ||
<ModalBody> | ||
<Timeline records={data as IGroupedRecordEntry[]} /> | ||
</ModalBody> | ||
<ModalFooter /> | ||
</ModalContent> | ||
</Modal> | ||
); | ||
} | ||
|
||
export default HistoryOverlay; |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Box, Flex, Text } from "@chakra-ui/react"; | ||
import { User } from "types/generated/graphql"; | ||
import TimelineEntry from "./components/TimelineEntry"; | ||
|
||
export interface ITimelineEntry { | ||
action: string; | ||
createdOn: Date; | ||
createdBy: User; | ||
} | ||
|
||
export interface IGroupedRecordEntry { | ||
date: string; | ||
entries: (ITimelineEntry | null | undefined)[]; | ||
} | ||
|
||
export interface ITimelineProps { | ||
records: IGroupedRecordEntry[]; | ||
} | ||
|
||
function Timeline({ records }: ITimelineProps) { | ||
return ( | ||
<Box position="relative"> | ||
{records.map(({ date, entries }, index) => ( | ||
<Box key={date}> | ||
<Flex | ||
border={1} | ||
borderColor="red.500" | ||
background="red.500" | ||
padding={1} | ||
alignContent="center" | ||
alignItems="center" | ||
justifyContent="center" | ||
maxWidth={120} | ||
rounded={4} | ||
> | ||
<Text fontWeight="bold" color="white" alignItems="center" justifyContent="center"> | ||
{date} | ||
</Text> | ||
</Flex> | ||
<Box> | ||
{entries?.map((entry, indx) => ( | ||
<TimelineEntry | ||
key={`${index + indx}_${new Date().getTime()}}`} | ||
content={entry?.action} | ||
time={entry?.createdOn} | ||
/> | ||
))} | ||
</Box> | ||
</Box> | ||
))} | ||
</Box> | ||
); | ||
} | ||
|
||
export default Timeline; |
File renamed without changes.
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
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
Oops, something went wrong.