-
Notifications
You must be signed in to change notification settings - Fork 10
CAS-664: User Profile Page Layout #694
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
base: release-v2.0.0
Are you sure you want to change the base?
Changes from all commits
f333b17
87fa29c
d034473
0a18216
ff78619
7fc72ee
661fb87
0b74aac
1668060
5f5f604
ef6e355
b12c9c3
c04f00a
1942a93
af79128
0f0569d
2fb699e
272f4fd
625ec59
8a48809
214448f
5511a37
4373828
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import { forwardRef } from 'react'; | ||
| import { Svg } from '@cast/shared-components'; | ||
| import { | ||
| Flex, | ||
| HStack, | ||
| Tab, | ||
| useMultiStyleConfig, | ||
| useTab, | ||
| } from '@chakra-ui/react'; | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const CustomTab = forwardRef<HTMLElement, any>((props, ref) => { | ||
| // 1. Reuse the `useTab` hook | ||
| const tabProps = useTab({ ...props, ref }); | ||
| const isSelected = !!tabProps['aria-selected']; | ||
|
|
||
| // 2. Hook into the Tabs `size`, `variant`, props | ||
| const styles = useMultiStyleConfig('Tabs', tabProps); | ||
|
|
||
| return ( | ||
| <Tab __css={styles.tab} {...tabProps}> | ||
| <HStack spacing={2}> | ||
| <Flex {...(isSelected ? { fontWeight: 'bold' } : {})}> | ||
| {tabProps.children} | ||
| </Flex> | ||
| {isSelected ? ( | ||
| <Svg name="Star" width="13" height="13" fill="black" /> | ||
| ) : null} | ||
|
Comment on lines
+26
to
+28
Contributor
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. Instead of ternary here you could use |
||
| </HStack> | ||
| </Tab> | ||
| ); | ||
| }); | ||
|
|
||
| export default CustomTab; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { ShareDropdown } from 'components'; | ||
| import { FRONTEND_URL } from 'const'; | ||
| import { Box } from '@chakra-ui/react'; | ||
|
|
||
| interface ShareProposalDropdownProps { | ||
| communityId: string; | ||
| proposalId: string; | ||
| proposalName: string; | ||
| userVoted: boolean; | ||
| } | ||
| const ShareProposalDropdown: React.FC<ShareProposalDropdownProps> = ( | ||
| { | ||
| communityId, | ||
| proposalId, | ||
| proposalName = '', | ||
| userVoted, | ||
| } = {} as ShareProposalDropdownProps | ||
| ) => { | ||
| const proposalUrl = `${FRONTEND_URL}/#/community/${communityId}/proposal/${proposalId}`; | ||
|
|
||
| const twitterPost = `https://twitter.com/intent/tweet?text=${encodeURIComponent( | ||
| userVoted | ||
| ? `I just voted on ${proposalName} on CAST! ${proposalUrl}` | ||
| : `Check out ${proposalName} on CAST! ${proposalUrl}` | ||
| )} `; | ||
|
Comment on lines
+21
to
+25
Contributor
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. This should just be because below in the component you using the twitter intent url again |
||
|
|
||
| return ( | ||
| <Box ml={4}> | ||
| <ShareDropdown | ||
| isIconOnly={false} | ||
| twitterShareString={twitterPost} | ||
| copyString={proposalUrl} | ||
| offset={[-85, 2]} | ||
| direction="rtl" | ||
| /> | ||
| </Box> | ||
| ); | ||
| }; | ||
| export default ShareProposalDropdown; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import { CopyToClipboard } from 'react-copy-to-clipboard'; | ||
| import { Svg } from '@cast/shared-components'; | ||
| import { useMediaQuery } from 'hooks'; | ||
| import { | ||
| Flex, | ||
| Link, | ||
| Menu, | ||
| MenuButton, | ||
| MenuDivider, | ||
| MenuItem, | ||
| MenuList, | ||
| Text, | ||
| } from '@chakra-ui/react'; | ||
|
|
||
| interface ShareDropdownProps { | ||
| twitterShareString: string; | ||
| copyString: string; | ||
| isIconOnly?: boolean; | ||
| offset?: [number, number]; | ||
| direction?: 'ltr' | 'rtl'; | ||
| } | ||
| const ShareDropdown: React.FC<ShareDropdownProps> = ({ | ||
| isIconOnly = true, | ||
| twitterShareString = '', | ||
| copyString = '', | ||
| offset, | ||
| direction, | ||
| }) => { | ||
| const isBiggerThanMobile = useMediaQuery(); | ||
|
|
||
| const twitterPost = `https://twitter.com/intent/tweet?text=${encodeURIComponent( | ||
| twitterShareString | ||
| )} `; | ||
|
|
||
| return ( | ||
| <> | ||
| <Menu offset={offset} direction={direction}> | ||
| <MenuButton | ||
| transition="all 0.2s" | ||
| borderWidth="1px" | ||
| borderColor="black" | ||
| _hover={{ borderColor: 'blackAlpha.600' }} | ||
| maxH={isBiggerThanMobile ? '40px' : '32px'} | ||
| {...(isIconOnly | ||
| ? { px: '13px', py: '21px', borderRadius: 'full' } | ||
| : { | ||
| px: 4, | ||
| py: 2, | ||
| borderRadius: '3xl', | ||
| })} | ||
| > | ||
| <Flex alignItems="center"> | ||
| <Svg name="Share" /> | ||
| {!isIconOnly ? ( | ||
| <Text | ||
| fontWeight="bold" | ||
| ml={3} | ||
| fontSize={isBiggerThanMobile ? 'md' : 'sm'} | ||
| > | ||
| Share | ||
| </Text> | ||
| ) : null} | ||
| </Flex> | ||
| </MenuButton> | ||
| <MenuList borderRadius="2xl" maxW="192px" minW="192px"> | ||
| <MenuItem display="flex" alignItems="center" minHeight="48px" pl={3}> | ||
| <CopyToClipboard text={copyString} onCopy={() => {}}> | ||
|
Contributor
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. Maybe we should utilize |
||
| <Flex alignItems="center"> | ||
| <Svg name="Copy" /> | ||
| <Text fontWeight="bold" ml={3}> | ||
| Copy Link | ||
| </Text> | ||
| </Flex> | ||
| </CopyToClipboard> | ||
| </MenuItem> | ||
| <MenuDivider border="light" borderColor="grey.300" my={0} /> | ||
| <MenuItem display="flex" alignItems="center" minHeight="48px" pl={3}> | ||
| <Svg name="Twitter" /> | ||
| <Link | ||
| href={twitterPost} | ||
| target="_blank" | ||
| rel="noreferrer noopenner" | ||
| className="twitter-share-button" | ||
| fontWeight="bold" | ||
| ml={3} | ||
| _hover={{ textDecoration: 'none' }} | ||
| > | ||
| Tweet | ||
| </Link> | ||
| </MenuItem> | ||
| </MenuList> | ||
| </Menu> | ||
| </> | ||
| ); | ||
| }; | ||
| export default ShareDropdown; | ||
|
Contributor
Author
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. This component is reused in the proposal copy and in the user profile |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,19 @@ | ||
| export default function Tooltip({ | ||
| interface TooltipProps { | ||
| enabled: boolean; | ||
| position: 'left' | 'right' | 'top' | 'bottom'; | ||
| text: string; | ||
| children?: React.ReactNode; | ||
| classNames: string; | ||
| alwaysVisible: boolean; | ||
| } | ||
| const Tooltip: React.FC<TooltipProps> = ({ | ||
| enabled = true, | ||
| position, | ||
| text, | ||
| children, | ||
| classNames = '', | ||
| alwaysVisible = false, | ||
| }) { | ||
| }) => { | ||
| const positionConfig = { | ||
| left: 'has-tooltip-left', | ||
| right: 'has-tooltip-right', | ||
|
|
@@ -23,4 +31,6 @@ export default function Tooltip({ | |
| {children} | ||
| </span> | ||
| ); | ||
| } | ||
| }; | ||
|
|
||
| export default Tooltip; | ||
|
Contributor
Author
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. Turning into TS |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||
| import { ShareDropdown } from 'components'; | ||||||
| import { FRONTEND_URL } from 'const'; | ||||||
| import { Box } from '@chakra-ui/react'; | ||||||
|
|
||||||
| interface ShareProfileDropdownProps { | ||||||
| userAddr: string; | ||||||
| } | ||||||
| const ShareProfileDropdown: React.FC<ShareProfileDropdownProps> = ({ | ||||||
| userAddr, | ||||||
| }) => { | ||||||
| const profileUrl = `${FRONTEND_URL}/#/profile?addr=${userAddr}`; | ||||||
|
|
||||||
| const twitterPost = `https://twitter.com/intent/tweet?text=${encodeURIComponent( | ||||||
| `Check at my profile in ${profileUrl} on CAST! ` | ||||||
|
Contributor
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.
Suggested change
Check with product they may have better copy that we can use for the tweet
Contributor
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. Same thing here as well I don't think you need the url in the string because |
||||||
| )} `; | ||||||
|
|
||||||
| return ( | ||||||
| <Box ml={4}> | ||||||
| <ShareDropdown | ||||||
| isIconOnly={true} | ||||||
| twitterShareString={twitterPost} | ||||||
| copyString={profileUrl} | ||||||
| /> | ||||||
| </Box> | ||||||
| ); | ||||||
| }; | ||||||
| export default ShareProfileDropdown; | ||||||
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.
Should we add an interface above to define the props for the component instead of using any?