-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tim/threads-semantics
# Conflicts: # packages/commonwealth/test/integration/api/createChain.spec.ts
- Loading branch information
Showing
70 changed files
with
265 additions
and
2,747 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
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
42 changes: 42 additions & 0 deletions
42
packages/commonwealth/client/scripts/views/components/UpvotePopover/UpvotePopover.scss
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,42 @@ | ||
@import '../../../../styles/shared.scss'; | ||
|
||
.Popover.UpvotePopover { | ||
padding: 8px 0; | ||
width: 256px; | ||
|
||
.popover-title { | ||
padding: 8px 16px; | ||
margin-bottom: 0; | ||
} | ||
|
||
.upvoters-list { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
.upvoter-row { | ||
display: flex; | ||
height: 40px; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 0 20px; | ||
align-self: stretch; | ||
|
||
.User { | ||
.user-display-name { | ||
font-size: 12px; | ||
font-weight: 500; | ||
line-height: 16px; | ||
letter-spacing: 0.24px; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.upvoter-count { | ||
height: 40px; | ||
padding: 0 20px; | ||
display: flex; | ||
align-items: center; | ||
color: $neutral-400; | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
packages/commonwealth/client/scripts/views/components/UpvotePopover/UpvotePopover.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,80 @@ | ||
import React from 'react'; | ||
import { isMobile } from 'react-device-detect'; | ||
import app from 'state'; | ||
import { CWText } from '../component_kit/cw_text'; | ||
import CWIconButton from '../component_kit/new_designs/CWIconButton'; | ||
import CWPopover, { | ||
UsePopoverProps, | ||
} from '../component_kit/new_designs/CWPopover/CWPopover'; | ||
import { User } from '../user/user'; | ||
import './UpvotePopover.scss'; | ||
|
||
type UpvotePopoverProps = { | ||
upvoters: string[]; | ||
} & UsePopoverProps; | ||
|
||
export const UpvotePopover = ({ | ||
upvoters = [], | ||
...popoverProps | ||
}: UpvotePopoverProps) => { | ||
const maxVisibleUpvotingAccounts = 3; | ||
|
||
const createUpvoterList = (upvoterAddresses: string[]) => { | ||
const slicedUpvoters = upvoterAddresses | ||
.slice(0, maxVisibleUpvotingAccounts) | ||
.map((upvoterAddress) => { | ||
return ( | ||
<div key={upvoterAddress} className="upvoter-row"> | ||
<User | ||
userAddress={upvoterAddress} | ||
// set to 1inch for use on components page | ||
userCommunityId={app.chain?.id || '1inch'} | ||
avatarSize={24} | ||
shouldLinkProfile | ||
/> | ||
<CWText className="vote-weight" type="b2"> | ||
5x | ||
</CWText> | ||
</div> | ||
); | ||
}); | ||
|
||
if (upvoterAddresses.length > maxVisibleUpvotingAccounts) { | ||
slicedUpvoters.push( | ||
<CWText | ||
type="caption" | ||
className="upvoter-count" | ||
key="final" | ||
>{`${upvoterAddresses.length} votes total`}</CWText>, | ||
); | ||
} | ||
|
||
return <div className="upvoters-list">{slicedUpvoters}</div>; | ||
}; | ||
|
||
return ( | ||
<> | ||
{upvoters.length > 0 && ( | ||
<CWPopover | ||
className="UpvotePopover" | ||
title={ | ||
<> | ||
Recent Upvotes | ||
{isMobile && ( | ||
<div className="close"> | ||
<CWIconButton | ||
iconName="close" | ||
buttonSize="sm" | ||
onClick={popoverProps.handleInteraction} | ||
/> | ||
</div> | ||
)} | ||
</> | ||
} | ||
body={createUpvoterList(upvoters)} | ||
{...popoverProps} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/commonwealth/client/scripts/views/components/UpvotePopover/index.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,3 @@ | ||
import { UpvotePopover } from './UpvotePopover'; | ||
|
||
export default UpvotePopover; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/sh | ||
# Generates a visualization of module dependencies | ||
madge -i out.png --exclude '^state\.ts$|^identifiers\.ts$|app\/notifications|(node_modules\/@types)|rxjs|construct-ui|models\/|stores\/|shared\/adapters\/|helpers' client/scripts/app.tsx | ||
madge -i out.png --exclude '^state\.ts$|^identifiers\.ts$|app\/notifications|(node_modules\/@types)|construct-ui|models\/|stores\/|shared\/adapters\/|helpers' client/scripts/app.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
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.