Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jemeza/gtwy 2.5 history #1007

Merged
merged 67 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5776762
made fixes to local fraud detector
jemeza Jun 28, 2023
b675eea
minor revert
jemeza Jun 28, 2023
16488bf
Merge branch 'develop' into fraud-detector-local-fix
jemeza Jun 28, 2023
0b9041a
minor update
jemeza Jun 29, 2023
52efabd
Merge branch 'fraud-detector-local-fix' of https://github.com/bobanet…
jemeza Jun 29, 2023
ea0069d
reverted changes to docker compose
jemeza Jun 29, 2023
52e51d7
reverted changes to docker-compose.yml
jemeza Jun 29, 2023
1139ebd
revert file back to original docker-compose.yml
jemeza Jun 29, 2023
cfef16a
working on history
jemeza Jul 3, 2023
c81c6dc
minor updates
jemeza Jul 3, 2023
997dd97
minor clean up
jemeza Jul 3, 2023
2f01d17
updates to history
jemeza Jul 5, 2023
f3c78fa
Merge branch 'develop' of https://github.com/bobanetwork/boba into je…
jemeza Jul 5, 2023
8b446af
added click out functionality for dropdown
jemeza Jul 5, 2023
53f6bab
refactored
jemeza Jul 6, 2023
084ea81
revert
jemeza Jul 6, 2023
431aca3
adding a transactions table
jemeza Jul 11, 2023
b581614
configured transactions
jemeza Jul 12, 2023
9e3749e
work on transactions table
jemeza Jul 12, 2023
1fc6ab7
Merge branch 'develop' into jemeza/gtwy-2.5-history
jemeza Jul 12, 2023
26842a7
updates
jemeza Jul 15, 2023
4c76c4d
Merge branch 'develop' into jemeza/gtwy-2.5-history
jemeza Jul 15, 2023
5ca9381
almost done
jemeza Jul 15, 2023
22ed939
added filter, optimized history page
jemeza Jul 18, 2023
b1be7a2
bringing branch up to date
jemeza Jul 19, 2023
9821f28
changed methods to get chain icons
jemeza Jul 19, 2023
790da0d
styling date components
jemeza Jul 19, 2023
852aa11
added connect button and no history icon for history page
jemeza Jul 19, 2023
25a5f01
fixed connect button, simplified transaction resolver filter, refacto…
jemeza Jul 19, 2023
9f068c2
Merge branch 'develop' into jemeza/gtwy-2.5-history
jemeza Jul 19, 2023
6d8d4c9
removing unnecessary files
jemeza Jul 19, 2023
64347ac
refactored constants to seperate file
jemeza Jul 19, 2023
571e9f4
Merge branch 'develop' into jemeza/gtwy-2.5-history
jemeza Jul 20, 2023
3ef746b
removed alt attribute from svg component and updated test/stories
jemeza Jul 20, 2023
ff24a18
refactored History.styles.js into styles.ts and added responsive tags…
jemeza Jul 21, 2023
1482544
refactored History.styles.js into styles.ts and added responsive tags…
jemeza Jul 21, 2023
d2da547
refactored
jemeza Jul 21, 2023
d258930
Merge branch 'jemeza/gtwy-2.5-history' of https://github.com/bobanetw…
jemeza Jul 21, 2023
165886a
removing unnecessary hook
jemeza Jul 21, 2023
986f5de
adding types to history/constants
jemeza Jul 21, 2023
6f13719
added test for history page and transaction resolver
jemeza Jul 21, 2023
24b5eae
refactoring style sheets
jemeza Jul 21, 2023
eb62df8
added hooks for different screen size and refactored styles
jemeza Jul 24, 2023
89ee7e5
Merge branch 'develop' into jemeza/gtwy-2.5-history
jemeza Jul 24, 2023
8c13dfa
migrated history to typescript
jemeza Jul 25, 2023
c55b0c2
reverted yarn to fix errors
jemeza Jul 25, 2023
46c9455
refactoring dropdown to finishing history
jemeza Jul 25, 2023
0635936
fixing bug
jemeza Jul 26, 2023
8cc4836
refactored dropdown and fixed date picker styles
jemeza Jul 26, 2023
ca241af
fixing z-index for dropdown components
jemeza Jul 26, 2023
6ba1124
Functionality Complete
jemeza Jul 28, 2023
71e917f
made dropdown filter mobile friendly, adjusted network names
jemeza Jul 28, 2023
8d67346
network connection dependencies
jemeza Jul 28, 2023
81cc5e8
Merge branch 'develop' of https://github.com/bobanetwork/boba into je…
jemeza Jul 28, 2023
29df0d5
refactored network names
jemeza Jul 28, 2023
240fbc5
Merge branch 'develop' into jemeza/gtwy-2.5-history
sk-enya Jul 29, 2023
b667ca4
Merge branch 'develop' into jemeza/gtwy-2.5-history
sk-enya Jul 29, 2023
ef3496b
partial clean up of historypage
sk-enya Jul 29, 2023
f21cb47
attempting to use date picker hooks
jemeza Jul 31, 2023
fd67e94
fixing types issues hook
Alvarriti Jul 31, 2023
834482e
fixing mobile view for History page
Alvarriti Aug 1, 2023
550826f
fixing yarnlock
Alvarriti Aug 1, 2023
87e7f22
Merge branch 'develop' into jemeza/gtwy-2.5-history
sk-enya Aug 1, 2023
add0218
disable date picker for history page
sk-enya Aug 1, 2023
0fd9e96
Merge branch 'develop' of github.com-enya:bobanetwork/boba into jemez…
sk-enya Aug 1, 2023
288c995
change:
sk-enya Aug 1, 2023
5d08f96
update snapshots for unit test
sk-enya Aug 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions packages/boba/gateway/src/components/filter/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import React, {
useState,
useCallback,
useEffect,
useRef,
ReactNode,
} from 'react'
import {
DropdownContainer,
Header,
IconContainer,
Option,
DefaultIcon,
DropdownBody,
Icon,
DropdownContent,
} from './styles'
export interface IFilterDropdownItem {
value: string
label: string | ReactNode
}

export interface IFilterDropdownProps {
error: boolean
imgSrc: string
items: IFilterDropdownItem[]
defaultItem: IFilterDropdownItem
onItemSelected?: (item: IFilterDropdownItem) => void
className?: string
}

export const FilterDropDown: React.FC<IFilterDropdownProps> = ({
items,
defaultItem,
error = false,
imgSrc,
onItemSelected,
className,
}) => {
const [selectedItem, setSelectedItem] =
useState<IFilterDropdownItem>(defaultItem)
const [isOpen, setIsOpen] = useState<boolean>(false)

const handleDropdown = useCallback(() => {
setIsOpen(!isOpen)
}, [isOpen])

const selectItem = useCallback((item: IFilterDropdownItem) => {
onItemSelected && onItemSelected(item)
setSelectedItem(item)
setIsOpen(false)
}, [])

const dropdownRef = useRef<HTMLDivElement>(null)

useEffect(() => {
const handleClickOutside = (e: Event) => {
if (
dropdownRef.current &&
!dropdownRef.current.contains(e.target as Node)
) {
setIsOpen(false)
}
}
// Bind the event listener
document.addEventListener('mousedown', handleClickOutside)
return () => {
// Unbind the event listener on clean up
document.removeEventListener('mousedown', handleClickOutside)
}
}, [dropdownRef])

return (
<DropdownContainer className={`dropdown ${className}`} ref={dropdownRef}>
<Header onClick={handleDropdown} error={error} isOpen={isOpen}>
{imgSrc && (
<IconContainer>
{imgSrc !== 'default' && <Icon src={imgSrc} />}
{imgSrc === 'default' && <DefaultIcon />}
</IconContainer>
)}
</Header>
{isOpen && (
<DropdownBody>
<DropdownContent>
{items.map((item, index) => (
<Option
key={index}
isSelected={item?.value === selectedItem?.value}
onClick={() => {
selectItem(item)
}}
>
{item.label}
</Option>
))}
</DropdownContent>
</DropdownBody>
)}
</DropdownContainer>
)
}
219 changes: 219 additions & 0 deletions packages/boba/gateway/src/components/filter/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
import styled, { css } from 'styled-components'
import { Svg } from 'components/global/svg'
import { screen } from 'themes/screens'

export const DropdownContainer = styled.div`
display: inline-flex;
flex-direction: column;
position: relative;
cursor: pointer;
transition: 0.25s all;
box-sizing: border-box;
${(props) =>
props.theme.name === 'light' &&
css`
color: ${props.theme.colors.gray[800]};
`}
${(props) =>
props.theme.name === 'dark' &&
css`
color: ${props.theme.colors.gray[50]};
`}
`

export const Header = styled.div<{ error: boolean; isOpen: boolean }>`
box-sizing: border-box;
position: relative;
color: inherit;
border-radius: 37px;
transition: all 0.3s ease;
background: none;
${(props) =>
props.theme.name === 'light' &&
css`
border: 2px solid ${props.theme.colors.gray[600]};
svg {
fill: ${props.theme.colors.gray[600]};
}
&:hover {
border-color: ${props.theme.colors.gray[800]};
svg {
fill: ${props.theme.colors.gray[800]};
}
}
`}
${(props) =>
props.theme.name === 'dark' &&
css`
border: 2px solid ${props.theme.colors.gray[200]};
svg {
fill: ${props.theme.colors.gray[100]};
}
&:hover {
color: ${props.theme.colors.gray[50]};
border-color: ${props.theme.colors.green[300]};
svg {
fill: ${props.theme.colors.gray[50]};
}
}
`}
${(props) =>
props.error &&
`
border-color:${props.theme.colors.red[300]}
`}
${({ isOpen, theme }) =>
isOpen &&
css`
color: ${theme.name === 'light' ? 'initial' : theme.colors.gray[50]};
border-color: ${theme.name === 'light'
? theme.colors.gray[800]
: theme.colors.green[300]};
svg {
fill: ${theme.name === 'light'
? theme.colors.gray[800]
: theme.colors.gray[50]};
}
`}
`

export const IconContainer = styled.div`
width: auto;
height: auto;
display: flex;
padding: 10px 11px;
align-items: center;
justify-content: center;
@media ${screen.mobile} {
width: 20px;
height: 20px;
}
`

export const Option = styled.div<{ isSelected: boolean }>`
display: flex;
align-items: center;
font-size: ${(props) => props.theme.text.body2};
font-weight: bold;
justify-content: flex-start;
text-align: left;
background: inherit;
color: inherit;
${({ isSelected, theme }) =>
isSelected &&
css`
background: ${theme.colors.gray[400]};
`}
@media ${screen.mobile} {
font-size: 10px;
}
`

export const DefaultIcon = styled.div`
width: 32px;
height: 32px;
border-radius: 50%;
${(props) =>
props.theme.name === 'light' &&
css`
background: ${props.theme.colors.gray[600]};
`}
${(props) =>
props.theme.name === 'dark' &&
css`
background: ${props.theme.colors.gray[200]};
`}
`
export const Icon = styled(Svg)`
height: 16px;
width: auto;
display: flex;
align-items: center;
justify-content: center;

svg {
max-width: 32px;
min-width: 10px;
height: auto;
}
`

export const DropdownBody = styled.div`
transition: 0.25s all;
background: inherit;
position: absolute;
width: 100%;
min-width: 139px;
right: 0px;
top: 45px;
z-index: 1;
padding: 8px 8px 8px 8px;
box-sizing: border-box;
border: inherit;
border-top: 0px;
border-radius: 14px;
box-shadow: ${(props) => props.theme.backShadow};
${(props) =>
props.theme.name === 'light' &&
css`
color: ${props.theme.colors.gray[800]};
border: 1px solid ${props.theme.colors.gray[400]};
background: ${props.theme.colors.gray[50]};
`}
${(props) =>
props.theme.name === 'dark' &&
css`
color: ${props.theme.colors.gray[100]};
border: 1px solid ${props.theme.colors.gray[400]};
background: ${props.theme.colors.gray[500]};
`}
`
export const DropdownContent = styled.div`
min-height: 80px;
max-height: 180px;
display: flex;
flex-direction: column;
gap: 5px 0px;
overflow-y: auto;
&::-webkit-scrollbar {
width: 4px;
margin-right: 4px;
}
&::-webkit-scrollbar-track {
background-color: #f1f1f1;
border-radius: 10px;
}
&::-webkit-scrollbar-thumb {
background-color: #888;
border-radius: 10px;
}

&::-webkit-scrollbar-thumb:hover {
background-color: #555;
}

& > ${Option} {
transition: 0.25s all;
border-radius: 8px;
padding: 8px;
box-sizing: border-box;
border: 1px solid rgba(0, 0, 0, 0);
&:hover {
background: ${(props) => props.theme.colors.gray[400]};
}
${(props) =>
props.theme.name === 'light' &&
css`
&:hover {
border: 1px solid ${props.theme.colors.gray[600]};
}
`}
${(props) =>
props.theme.name === 'dark' &&
css`
&:hover {
border: 1px solid ${props.theme.colors.gray[100]};
}
`};
}
`
Loading
Loading