-
Notifications
You must be signed in to change notification settings - Fork 464
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
fix: populate help section #2619
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,75 @@ | ||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore' | ||
import { Accordion, AccordionSummary, Typography, AccordionDetails, SvgIcon } from '@mui/material' | ||
import type { TypographyProps } from '@mui/material' | ||
import { | ||
Accordion, | ||
AccordionSummary, | ||
Avatar, | ||
Box, | ||
Typography, | ||
AccordionDetails, | ||
SvgIcon, | ||
List, | ||
ListItem, | ||
ListItemAvatar, | ||
ListItemText, | ||
} from '@mui/material' | ||
import { useMemo } from 'react' | ||
import type { ReactElement } from 'react' | ||
|
||
import { useCurrentChain } from '@/hooks/useChains' | ||
import Question from '@/public/images/common/question.svg' | ||
|
||
const AccordionTitle = ({ children }: { children: TypographyProps['children'] }): ReactElement => { | ||
import css from './styles.module.css' | ||
|
||
const HintAccordion = ({ title, items }: { title: string; items: Array<string> }): ReactElement => { | ||
return ( | ||
<Typography sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}> | ||
<SvgIcon | ||
component={Question} | ||
inheritViewBox | ||
sx={{ color: 'currentColor', verticalAlign: 'middle', mr: 1 }} | ||
fontSize="inherit" | ||
/> | ||
{children} | ||
</Typography> | ||
<Accordion> | ||
<AccordionSummary expandIcon={<ExpandMoreIcon />}> | ||
<Typography className={css.title}> | ||
<SvgIcon component={Question} inheritViewBox className={css.questionIcon} /> | ||
{title} | ||
</Typography> | ||
</AccordionSummary> | ||
|
||
<AccordionDetails sx={{ p: 0 }}> | ||
<List className={css.list}> | ||
{items.map((item, i) => ( | ||
<ListItem key={i} sx={{ p: 0 }}> | ||
<ListItemAvatar className={css.listItemAvatar}> | ||
<Avatar className={css.avatar}>{i + 1}</Avatar> | ||
</ListItemAvatar> | ||
<ListItemText primary={item} sx={{ m: 0 }} primaryTypographyProps={{ variant: 'body2' }} /> | ||
</ListItem> | ||
))} | ||
</List> | ||
</AccordionDetails> | ||
</Accordion> | ||
) | ||
} | ||
|
||
// TODO: Add content to the hints | ||
const ConnectionSteps = [ | ||
'Open a WalletConnect supported dApp', | ||
'Select WalletConnect as the connection method', | ||
'Copy the pairing URI and paste it into the input field above', | ||
'Approve the session', | ||
'dApp is now connected to the Safe', | ||
] | ||
|
||
export const Hints = (): ReactElement => { | ||
const chain = useCurrentChain() | ||
|
||
const InteractionSteps = useMemo(() => { | ||
return [ | ||
'Connect a dApp by following the above steps', | ||
`Ensure the dApp is connected to ${chain?.chainName ?? 'this chain'}`, | ||
'Initiate a transaction/signature request via the dApp', | ||
'Transact/sign as normal via the Safe', | ||
] | ||
}, [chain?.chainName]) | ||
|
||
return ( | ||
<> | ||
<Accordion sx={{ mb: 1 }}> | ||
<AccordionSummary expandIcon={<ExpandMoreIcon />}> | ||
<AccordionTitle>How do I connect to a dApp?</AccordionTitle> | ||
</AccordionSummary> | ||
|
||
<AccordionDetails> | ||
<Typography> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit | ||
leo lobortis eget. | ||
</Typography> | ||
</AccordionDetails> | ||
</Accordion> | ||
|
||
<Accordion> | ||
<AccordionSummary expandIcon={<ExpandMoreIcon />}> | ||
<AccordionTitle>How do I interact with a dApp?</AccordionTitle> | ||
</AccordionSummary> | ||
|
||
<AccordionDetails> | ||
<Typography> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit | ||
leo lobortis eget. | ||
</Typography> | ||
</AccordionDetails> | ||
</Accordion> | ||
</> | ||
<Box display="flex" flexDirection="column" gap={1}> | ||
<HintAccordion title="How do I connect to a dApp?" items={ConnectionSteps} /> | ||
<HintAccordion title="How do I interact with a dApp?" items={InteractionSteps} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please extract the hardcoded titles. |
||
</Box> | ||
) | ||
} |
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,30 @@ | ||
.title { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.questionIcon { | ||
color: currentColor; | ||
vertical-align: middle; | ||
margin-right: var(--space-1); | ||
font-size: inherit; | ||
} | ||
|
||
.list { | ||
padding: var(--space-2); | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--space-2); | ||
} | ||
|
||
.listItemAvatar { | ||
min-width: unset; | ||
margin-right: var(--space-2); | ||
} | ||
|
||
.avatar { | ||
width: 16px; | ||
height: 16px; | ||
font-size: 11px; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please exctract the hardcode to a const, you can use a replacement pattern for the chain name.