-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
35 changed files
with
1,626 additions
and
120 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,6 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// @ts-nocheck | ||
|
||
export { default as handWave } from './handWave.gif'; |
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
131 changes: 131 additions & 0 deletions
131
packages/extension-polkagate/src/assets/img/welcomeItems/Item1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions
85
packages/extension-polkagate/src/components/ActionButton.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,85 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* eslint-disable react/jsx-max-props-per-line */ | ||
|
||
import type { Icon } from 'iconsax-react'; | ||
|
||
import { Button, useTheme } from '@mui/material'; | ||
import React, { useCallback, useMemo, useState } from 'react'; | ||
|
||
interface Props { | ||
disabled?: boolean; | ||
isBusy?: boolean; | ||
onClick: React.MouseEventHandler<HTMLButtonElement>; | ||
StartIcon?: Icon; | ||
// endIcon?: React.ReactNode; | ||
text: string | { firstPart: string; secondPart: string; }; | ||
variant?: 'text' | 'contained' | 'outlined'; | ||
style?: React.CSSProperties; | ||
} | ||
|
||
export default function ActionButton ({ StartIcon, disabled, isBusy, onClick, style, text, variant }: Props): React.ReactElement<Props> { | ||
const theme = useTheme(); | ||
|
||
const [hovered, setHovered] = useState(false); | ||
|
||
const toggleHover = useCallback(() => setHovered(!hovered), [hovered]); | ||
|
||
const ButtonFontStyle = useMemo(() => ({ | ||
fontFamily: 'Inter', | ||
fontSize: '14px', | ||
fontWeight: 600, | ||
textTransform: 'none' | ||
} as React.CSSProperties), []); | ||
|
||
const GeneralButtonStyle = { | ||
'&:hover': { | ||
background: '#674394' | ||
}, | ||
background: '#2D1E4A', | ||
borderRadius: `${style?.borderRadius ?? '12px'}`, | ||
boxShadow: 'unset', | ||
justifyContent: 'flex-start', | ||
padding: '6px 24px', | ||
...ButtonFontStyle | ||
}; | ||
|
||
const StartIconStyle = { | ||
'& .MuiButton-startIcon': { | ||
marginLeft: 0, | ||
marginRight: '16px' | ||
}, | ||
'& .MuiButton-startIcon svg': { | ||
color: '#BEAAD8' | ||
} | ||
}; | ||
|
||
const renderText = useMemo(() => { | ||
if (typeof text === 'string') { | ||
return <span style={{ color: theme.palette.text.primary, ...ButtonFontStyle }}>{text}</span>; | ||
} else { | ||
return ( | ||
<> | ||
<span style={{ color: theme.palette.text.secondary, ...ButtonFontStyle }}>{text.firstPart}</span> <span style={{ color: theme.palette.text.primary, ...ButtonFontStyle }}>{text.secondPart}</span> | ||
</> | ||
); | ||
} | ||
}, [ButtonFontStyle, text, theme.palette.text.primary, theme.palette.text.secondary]); | ||
|
||
return ( | ||
<Button | ||
disabled={disabled || isBusy} | ||
onClick={onClick} | ||
onMouseEnter={toggleHover} | ||
onMouseLeave={toggleHover} | ||
startIcon={StartIcon | ||
? <StartIcon size={20} variant={hovered ? 'Bold' : 'Bulk'} /> | ||
: undefined} | ||
sx={{ ...GeneralButtonStyle, ...StartIconStyle, ...style }} | ||
variant={variant} | ||
> | ||
{renderText} | ||
</Button> | ||
); | ||
} |
121 changes: 121 additions & 0 deletions
121
packages/extension-polkagate/src/components/Carousel.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,121 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* eslint-disable react/jsx-max-props-per-line */ | ||
|
||
import { Box, Grid } from '@mui/material'; | ||
import { keyframes } from '@mui/system'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import { Item1 } from '../assets/img'; | ||
|
||
const INTERVAL = 30000; | ||
const DISPLAYED_ITEM_COLOR = '#AA83DC'; | ||
const UNDISPLAYED_ITEM_COLOR = 'rgba(190, 170, 216, 0.25)'; | ||
|
||
const fillAnimation = keyframes` | ||
from { | ||
width: 0%; | ||
} | ||
to { | ||
width: 40px; | ||
} | ||
`; | ||
|
||
const carouselItems = [ | ||
Item1, | ||
Item1, | ||
Item1, | ||
Item1, | ||
Item1 | ||
]; | ||
|
||
function Carousel () { | ||
const [currentIndex, setCurrentIndex] = useState(0); | ||
|
||
const handleIndicatorClick = (index: number) => () => { | ||
setCurrentIndex(index); | ||
}; | ||
|
||
// Auto Slide every INTERVAL seconds | ||
useEffect(() => { | ||
const timer = setInterval(() => { | ||
setCurrentIndex((prev) => (prev + 1) % carouselItems.length); | ||
}, INTERVAL); | ||
|
||
return () => clearInterval(timer); | ||
}, []); | ||
|
||
return ( | ||
<Box sx={{ pb: '15px', position: 'relative', width: '100%' }}> | ||
{/* Indicators */} | ||
<Box | ||
sx={{ | ||
alignItems: 'center', | ||
display: 'flex', | ||
gap: '10px', | ||
justifyContent: 'center', | ||
marginBottom: 2 | ||
}} | ||
> | ||
{carouselItems.map((_, index) => ( | ||
<Box | ||
key={index} | ||
onClick={handleIndicatorClick(index)} | ||
sx={{ | ||
backgroundColor: index >= currentIndex ? UNDISPLAYED_ITEM_COLOR : DISPLAYED_ITEM_COLOR, | ||
borderRadius: '2px', | ||
cursor: 'pointer', | ||
height: '4px', | ||
overflow: 'hidden', | ||
position: 'relative', | ||
...(index === currentIndex && { width: '100px' }), // Indicator fills for active slide | ||
width: '60px' | ||
}} | ||
> | ||
{index === currentIndex && ( | ||
<Box | ||
sx={{ | ||
animation: `${fillAnimation} ${INTERVAL}ms linear`, | ||
backgroundColor: DISPLAYED_ITEM_COLOR, | ||
height: '4px', | ||
left: 0, | ||
position: 'absolute', | ||
top: 0, | ||
width: '40px' | ||
}} | ||
/> | ||
)} | ||
</Box> | ||
))} | ||
</Box> | ||
{/* Carousel Container */} | ||
<Grid | ||
container | ||
sx={{ | ||
transform: `translateX(-${currentIndex * 100}%)`, | ||
transition: 'transform 500ms ease-in-out', | ||
width: '100%' | ||
}} | ||
wrap='nowrap' | ||
> | ||
{carouselItems.map((item, index) => ( | ||
<Box | ||
component='img' | ||
key={index} | ||
src={item as string} | ||
sx={{ | ||
flex: '0 0 100%', // Slide occupies 100% of the container's width | ||
height: 'auto', | ||
maxHeight: '155px', | ||
objectFit: 'contain', | ||
width: '100%' | ||
}} | ||
/> | ||
))} | ||
</Grid> | ||
</Box> | ||
); | ||
} | ||
|
||
export default React.memo(Carousel); |
76 changes: 76 additions & 0 deletions
76
packages/extension-polkagate/src/components/ExtensionPopup.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,76 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* eslint-disable react/jsx-max-props-per-line */ | ||
|
||
import type { TransitionProps } from '@mui/material/transitions'; | ||
import type { Icon } from 'iconsax-react'; | ||
|
||
import { Box, Container, Dialog, Grid, Slide, Typography } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
import CustomCloseSquare from '../popup/welcome/CustomCloseSquare'; | ||
import { RedGradient } from '../style'; | ||
import { GradientDivider } from '.'; | ||
|
||
export interface Props { | ||
children: React.ReactNode; | ||
handleClose?: () => void; | ||
openMenu: boolean; | ||
TitleIcon?: Icon; | ||
title: string; | ||
} | ||
|
||
const Transition = React.forwardRef(function Transition (props: TransitionProps & { children: React.ReactElement<unknown>; }, ref: React.Ref<unknown>) { | ||
return <Slide direction='up' ref={ref} {...props} />; | ||
}); | ||
|
||
function ExtensionPopup ({ TitleIcon, children, handleClose, openMenu, title }: Props): React.ReactElement<Props> { | ||
return ( | ||
<Dialog | ||
PaperProps={{ | ||
sx: { | ||
backgroundImage: 'unset', | ||
bgcolor: 'transparent', | ||
boxShadow: 'unset' | ||
} | ||
}} | ||
TransitionComponent={Transition} | ||
componentsProps={{ | ||
backdrop: { | ||
sx: { | ||
backdropFilter: 'blur(10px)', | ||
background: 'radial-gradient(50% 44.61% at 50% 50%, rgba(12, 3, 28, 0) 0%, rgba(12, 3, 28, 0.7) 100%)', | ||
bgcolor: 'transparent' | ||
} | ||
} | ||
}} | ||
fullScreen | ||
open={openMenu} | ||
> | ||
<Container disableGutters sx={{ height: '100%', width: '100%' }}> | ||
<Grid alignItems='center' container item justifyContent='center' sx={{ pb: '12px', pt: '18px' }}> | ||
<CustomCloseSquare color='#AA83DC' onClick={handleClose} size='48' style={{ cursor: 'pointer' }}/> | ||
</Grid> | ||
<Grid alignItems='center' container item justifyContent='center' sx={{ bgcolor: '#1B133C', border: '2px solid', borderColor: '#FFFFFF0D', borderTopLeftRadius: '32px', borderTopRightRadius: '32px', display: 'block', height: 'calc(100% - 78px)', overflow: 'scroll', p: '10px', pb: '10px', position: 'relative' }}> | ||
<Grid alignItems='center' columnGap='10px' container item justifyContent='center' p='10px'> | ||
{TitleIcon | ||
? <TitleIcon color='#AA83DC' size={28} variant='Bold' /> | ||
: undefined | ||
} | ||
<Typography color='text.primary' fontFamily='OdibeeSans' fontSize='24px' fontWeight={400} textTransform='uppercase'> | ||
{title} | ||
</Typography> | ||
</Grid> | ||
<GradientDivider /> | ||
<RedGradient style={{ top: '-140px' }} /> | ||
<Box sx={{ maxHeight: '440px', overflow: 'scroll', position: 'relative', width: '100%' }}> | ||
{children} | ||
</Box> | ||
</Grid> | ||
</Container> | ||
</Dialog> | ||
); | ||
} | ||
|
||
export default React.memo(ExtensionPopup); |
47 changes: 47 additions & 0 deletions
47
packages/extension-polkagate/src/components/GradientBox.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,47 @@ | ||
// Copyright 2019-2024 @polkadot/extension-polkagate authors & contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
/* eslint-disable react/jsx-max-props-per-line */ | ||
|
||
import { Box, Container, styled, type SxProps, type Theme } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
import { GradientBorder, RedGradient } from '../style'; | ||
|
||
const ContentWrapper = styled(Box)({ | ||
borderRadius: '32px', | ||
height: 'fit-content', | ||
margin: '0 auto', | ||
overflow: 'hidden', | ||
position: 'relative' | ||
}); | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
style?: SxProps<Theme>; | ||
} | ||
|
||
function GradientBox ({ children, style }: Props) { | ||
const ContainerStyle = { | ||
bgcolor: '#120D27', | ||
border: '2px solid rgba(255, 255, 255, 0.1)', | ||
borderRadius: '32px', | ||
boxShadow: '0px 0px 24px 8px #4E2B7259 inset', | ||
position: 'relative', | ||
...style | ||
} as SxProps<Theme>; | ||
|
||
return ( | ||
<Container disableGutters sx={ContainerStyle}> | ||
<GradientBorder /> | ||
<ContentWrapper> | ||
<RedGradient style={{ top: '-100px' }} /> | ||
<Box position='relative' zIndex={1}> | ||
{children} | ||
</Box> | ||
</ContentWrapper> | ||
</Container> | ||
); | ||
} | ||
|
||
export default React.memo(GradientBox); |
Oops, something went wrong.