diff --git a/CHANGELOG.md b/CHANGELOG.md index e72017c859..a5d1c30a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.9.0] - 2023-11-03 + +### Added +- Linkedin to membership social profile + +### Fixed +- Proposal history blocks styles. +- Past election total staked value. +- Past election "My contributed votes value". + ## [1.8.0] - 2023-10-13 ### Added @@ -205,7 +215,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.1] - 2022-12-02 -[unreleased]: https://github.com/Joystream/pioneer/compare/v1.8.0...HEAD +[unreleased]: https://github.com/Joystream/pioneer/compare/v1.9.0...HEAD +[1.9.0]: https://github.com/Joystream/pioneer/compare/v1.8.0...v1.9.0 [1.8.0]: https://github.com/Joystream/pioneer/compare/v1.7.0...v1.8.0 [1.7.0]: https://github.com/Joystream/pioneer/compare/v1.6.0...v1.7.0 [1.6.0]: https://github.com/Joystream/pioneer/compare/v1.5.1...v1.6.0 diff --git a/packages/ui/package.json b/packages/ui/package.json index 47a5ba54cf..74652db825 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@joystream/pioneer", - "version": "1.8.0", + "version": "1.9.0", "license": "GPL-3.0-only", "scripts": { "build": "node --max_old_space_size=4096 ./build.js", @@ -27,7 +27,7 @@ "@hcaptcha/react-hcaptcha": "^1.4.4", "@joystream/js": "1.2.0", "@joystream/markdown-editor": "^0.1.0", - "@joystream/metadata-protobuf": "^2.0.0", + "@joystream/metadata-protobuf": "^2.10.0", "@joystream/types": "^2.0.0", "@nivo/bar": "^0.79.1", "@nivo/core": "^0.79.0", diff --git a/packages/ui/src/app/pages/Election/PastElections/PastElections.tsx b/packages/ui/src/app/pages/Election/PastElections/PastElections.tsx index 06e10b778a..34a371dd2b 100644 --- a/packages/ui/src/app/pages/Election/PastElections/PastElections.tsx +++ b/packages/ui/src/app/pages/Election/PastElections/PastElections.tsx @@ -49,7 +49,8 @@ export const PastElections = () => { Round Election ended at - Total staked + Total Candidates staked + Total Votes staked Revealed votes Total candidates @@ -65,7 +66,7 @@ export const PastElections = () => { return } -export const PastElectionsColLayout = '48px 176px 156px 100px 100px' +export const PastElectionsColLayout = '48px 176px 140px 140px 100px 100px' const PastElectionsListHeaders = styled(ListHeaders)` grid-column-gap: 24px; diff --git a/packages/ui/src/common/api/queries/__generated__/baseTypes.generated.ts b/packages/ui/src/common/api/queries/__generated__/baseTypes.generated.ts index 8207b61fed..7a40be9db4 100644 --- a/packages/ui/src/common/api/queries/__generated__/baseTypes.generated.ts +++ b/packages/ui/src/common/api/queries/__generated__/baseTypes.generated.ts @@ -15362,6 +15362,7 @@ export enum MembershipExternalResourceType { Wechat = 'WECHAT', Whatsapp = 'WHATSAPP', Youtube = 'YOUTUBE', + Linkedin = 'LINKEDIN', } export type MembershipExternalResourceUpdateInput = { diff --git a/packages/ui/src/common/api/schemas/schema.graphql b/packages/ui/src/common/api/schemas/schema.graphql index 93a5c5220e..3f4fac456a 100644 --- a/packages/ui/src/common/api/schemas/schema.graphql +++ b/packages/ui/src/common/api/schemas/schema.graphql @@ -429,6 +429,7 @@ enum MembershipExternalResourceType { IRC WECHAT WHATSAPP + LINKEDIN } type MemberMetadata implements BaseGraphQLObject { diff --git a/packages/ui/src/common/components/BlockTime/BlockHistoryLine.stories.tsx b/packages/ui/src/common/components/BlockTime/BlockHistoryLine.stories.tsx deleted file mode 100644 index 23b559ce86..0000000000 --- a/packages/ui/src/common/components/BlockTime/BlockHistoryLine.stories.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Meta, Story } from '@storybook/react' -import React from 'react' - -import { TemplateBlock } from '@/common/components/storybookParts/previewStyles' - -import { BlockHistoryLine } from './BlockHistoryLine' -import { BlockInfoProp } from './BlockInfo' - -export default { - title: 'Common/BlockTime/BlockHistoryLine', - component: BlockHistoryLine, -} as Meta - -const Template: Story = (args) => ( - - - -) - -export const Default = Template.bind({}) -Default.args = { - block: { - number: 1000, - network: 'OLYMPIA', - timestamp: '2012-01-26T13:51:50.417-07:00', - }, -} diff --git a/packages/ui/src/common/components/BlockTime/BlockHistoryLine.tsx b/packages/ui/src/common/components/BlockTime/BlockHistoryLine.tsx deleted file mode 100644 index dbfce90aa6..0000000000 --- a/packages/ui/src/common/components/BlockTime/BlockHistoryLine.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import React from 'react' -import styled from 'styled-components' - -import { Tooltip, TooltipDefault } from '@/common/components/Tooltip' -import { TextInlineSmall } from '@/common/components/typography' -import { Fonts } from '@/common/constants' -import { formatDateString } from '@/common/model/formatters' - -import { BlockInfo, BlockInfoProp } from './BlockInfo' - -export const BlockHistoryLine = ({ block }: BlockInfoProp) => ( - - {formatDateString(block.timestamp)} - }> - - - -) - -const BlockHistoryLineContainer = styled.div` - display: flex; - align-items: center; - column-gap: 8px; - - ${TextInlineSmall} { - font-family: ${Fonts.Inter}; - } -` diff --git a/packages/ui/src/common/components/BlockTime/BlockInfo.tsx b/packages/ui/src/common/components/BlockTime/BlockInfo.tsx index a4c37a4442..3cf805ec4f 100644 --- a/packages/ui/src/common/components/BlockTime/BlockInfo.tsx +++ b/packages/ui/src/common/components/BlockTime/BlockInfo.tsx @@ -19,6 +19,7 @@ export const BlockInfo = ({ block, lessInfo, inline }: BlockInfoProp) => { const [endpoints] = useNetworkEndpoints() return ( evt.stopPropagation()} href={`https://polkadot.js.org/apps/?rpc=${endpoints.nodeRpcEndpoint}/ws-rpc#/explorer/query/${block.number}`} > diff --git a/packages/ui/src/common/components/BlockTime/index.ts b/packages/ui/src/common/components/BlockTime/index.ts index 99f8989f41..446bef19c9 100644 --- a/packages/ui/src/common/components/BlockTime/index.ts +++ b/packages/ui/src/common/components/BlockTime/index.ts @@ -1,2 +1 @@ -export * from './BlockHistoryLine' export * from './BlockTime' diff --git a/packages/ui/src/common/components/Stepper/Stepper.stories.tsx b/packages/ui/src/common/components/Stepper/Stepper.stories.tsx index a9062408aa..783a41732b 100644 --- a/packages/ui/src/common/components/Stepper/Stepper.stories.tsx +++ b/packages/ui/src/common/components/Stepper/Stepper.stories.tsx @@ -1,7 +1,7 @@ import { Meta, Story } from '@storybook/react' import React from 'react' -import { BlockHistoryLine } from '@/common/components/BlockTime' +import { BlockTime } from '@/common/components/BlockTime' import { TemplateBlock } from '@/common/components/storybookParts/previewStyles' import { randomBlock } from '@/mocks/helpers/randomBlock' @@ -32,7 +32,7 @@ Simple.args = { ], } -const details = +const details = export const History = Template.bind({}) History.args = { theme: 'dark', diff --git a/packages/ui/src/common/components/icons/socials/Linkedin.tsx b/packages/ui/src/common/components/icons/socials/Linkedin.tsx new file mode 100644 index 0000000000..2b4a14afa1 --- /dev/null +++ b/packages/ui/src/common/components/icons/socials/Linkedin.tsx @@ -0,0 +1,9 @@ +import React from 'react' + +export const LinkedinIcon = ({ className }: { className?: string }) => { + return ( + + + + ) +} diff --git a/packages/ui/src/common/components/icons/socials/index.ts b/packages/ui/src/common/components/icons/socials/index.ts index 0d9f151076..8f8eb1c93d 100644 --- a/packages/ui/src/common/components/icons/socials/index.ts +++ b/packages/ui/src/common/components/icons/socials/index.ts @@ -9,3 +9,4 @@ export * from './Telegram' export * from './Youtube' export * from './Wechat' export * from './Whatsapp' +export * from './Linkedin' diff --git a/packages/ui/src/council/components/election/pastElection/PastElectionTabs.tsx b/packages/ui/src/council/components/election/pastElection/PastElectionTabs.tsx index eb3bff9de8..6c72c49062 100644 --- a/packages/ui/src/council/components/election/pastElection/PastElectionTabs.tsx +++ b/packages/ui/src/council/components/election/pastElection/PastElectionTabs.tsx @@ -3,6 +3,7 @@ import React, { useMemo, useState } from 'react' import { useMyAccounts } from '@/accounts/hooks/useMyAccounts' import { Account } from '@/accounts/types' import { TabProps, Tabs } from '@/common/components/Tabs' +import { sumStakes } from '@/common/utils/bn' import { CandidateVoteList } from '@/council/components/election/CandidateVote/CandidateVoteList' import { electionVotingResultComparator } from '@/council/model/electionVotingResultComparator' import { ElectionVotingResult, PastElectionWithDetails } from '@/council/types/PastElection' @@ -52,17 +53,20 @@ export const PastElectionTabs = ({ election }: PastElectionTabsProps) => { { const myVote = getMyVote(votingResult, allAccounts) + const myVotesTmp = votingResult.votes.filter((vote) => + allAccounts.some((otherObj) => otherObj.address === vote.castBy) + ) return { candidateId: votingResult.candidate.id, revealed: !!myVote, member: votingResult.candidate.member, sumOfAllStakes: votingResult.totalStake, - totalStake: election.totalStake, + totalStake: election.totalVoteStake, votes: votingResult.votes.length, index: index + 1, myVotes: [], - myStake: myVote?.stake, + myStake: sumStakes(myVotesTmp), } })} /> diff --git a/packages/ui/src/council/components/election/pastElection/PastElectionsList/PastElectionsListRow.tsx b/packages/ui/src/council/components/election/pastElection/PastElectionsList/PastElectionsListRow.tsx index 7db781f159..a12d25081e 100644 --- a/packages/ui/src/council/components/election/pastElection/PastElectionsList/PastElectionsListRow.tsx +++ b/packages/ui/src/council/components/election/pastElection/PastElectionsList/PastElectionsListRow.tsx @@ -29,7 +29,8 @@ export const PastElectionsListRow = ({ election }: PastElectionsListRowProps) => ) : ( <> )} - + + diff --git a/packages/ui/src/council/queries/__generated__/council.generated.tsx b/packages/ui/src/council/queries/__generated__/council.generated.tsx index b912f0ad1e..8186b0f3e5 100644 --- a/packages/ui/src/council/queries/__generated__/council.generated.tsx +++ b/packages/ui/src/council/queries/__generated__/council.generated.tsx @@ -394,7 +394,7 @@ export type PastElectionRoundFieldsFragment = { endedAtTime?: any | null endedAtNetwork?: Types.Network | null candidates: Array<{ __typename: 'Candidate'; stake: string }> - castVotes: Array<{ __typename: 'CastVote'; voteForId?: string | null }> + castVotes: Array<{ __typename: 'CastVote'; voteForId?: string | null; stake: string }> } export type PastElectionRoundDetailedFieldsFragment = { @@ -1132,7 +1132,7 @@ export type GetPastElectionsQuery = { endedAtTime?: any | null endedAtNetwork?: Types.Network | null candidates: Array<{ __typename: 'Candidate'; stake: string }> - castVotes: Array<{ __typename: 'CastVote'; voteForId?: string | null }> + castVotes: Array<{ __typename: 'CastVote'; voteForId?: string | null; stake: string }> }> } @@ -1635,6 +1635,7 @@ export const PastElectionRoundFieldsFragmentDoc = gql` } castVotes { voteForId + stake } } ` diff --git a/packages/ui/src/council/queries/council.graphql b/packages/ui/src/council/queries/council.graphql index 2ff730dbfb..641c6aed20 100644 --- a/packages/ui/src/council/queries/council.graphql +++ b/packages/ui/src/council/queries/council.graphql @@ -116,6 +116,7 @@ fragment PastElectionRoundFields on ElectionRound { } castVotes { voteForId + stake } } diff --git a/packages/ui/src/council/types/PastElection.ts b/packages/ui/src/council/types/PastElection.ts index 4faa5c584c..c39c134f3a 100644 --- a/packages/ui/src/council/types/PastElection.ts +++ b/packages/ui/src/council/types/PastElection.ts @@ -16,10 +16,11 @@ export interface PastElection { id: string cycleId: number finishedAtBlock?: Block - totalStake: BN + totalCandidatesStake: BN totalCandidates: number revealedVotes: number totalVotes: number + totalVoteStake: BN } export interface PastElectionWithDetails extends PastElection { @@ -30,17 +31,17 @@ export const asPastElection = (fields: PastElectionRoundFieldsFragment): PastEle id: fields.id, cycleId: fields.cycleId, finishedAtBlock: maybeAsBlock(fields.endedAtBlock, fields.endedAtTime, fields.endedAtNetwork), - totalStake: sumStakes(fields.candidates), + totalCandidatesStake: sumStakes(fields.candidates), totalCandidates: fields.candidates.length, revealedVotes: fields.castVotes.filter((castVote) => castVote.voteForId).length, totalVotes: fields.castVotes.length, + totalVoteStake: sumStakes(fields.castVotes), }) export const asPastElectionWithDetails = ( fields: PastElectionRoundDetailedFieldsFragment ): PastElectionWithDetails => ({ ...asPastElection(fields), - totalStake: sumStakes(fields.castVotes), votingResults: fields.candidates.map((candidate) => { const candidateVotes = fields.castVotes.filter(({ voteForId }) => voteForId === candidate.id) diff --git a/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx b/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx index 4423a8abeb..88badd68dd 100644 --- a/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx +++ b/packages/ui/src/memberships/components/MemberListFilters/MemberListFilters.tsx @@ -101,6 +101,7 @@ const searchFilterOptions: MemberSearchFilter[] = [ 'Wechat', 'Whatsapp', 'Youtube', + 'Linkedin', ] export interface MemberListFiltersProps { diff --git a/packages/ui/src/memberships/components/SocialMediaSelector.tsx b/packages/ui/src/memberships/components/SocialMediaSelector.tsx index 47b0d62715..da9a66213f 100644 --- a/packages/ui/src/memberships/components/SocialMediaSelector.tsx +++ b/packages/ui/src/memberships/components/SocialMediaSelector.tsx @@ -20,6 +20,7 @@ const socialToPlaceholder: Record = { TELEGRAM: 'Enter Username', TWITTER: 'Enter Username', EMAIL: 'Enter Email', + LINKEDIN: 'Enter Username', } interface Props { diff --git a/packages/ui/src/memberships/components/SocialMediaSelector/SocialMediaSelector.tsx b/packages/ui/src/memberships/components/SocialMediaSelector/SocialMediaSelector.tsx index 5b3cbcb4f7..4e9cc2e30d 100644 --- a/packages/ui/src/memberships/components/SocialMediaSelector/SocialMediaSelector.tsx +++ b/packages/ui/src/memberships/components/SocialMediaSelector/SocialMediaSelector.tsx @@ -21,6 +21,7 @@ const socialToPlaceholder: Record = { TELEGRAM: 'Enter Username', TWITTER: 'Enter Username', EMAIL: 'Enter Email', + LINKEDIN: 'Enter Username', } interface Props { diff --git a/packages/ui/src/memberships/components/SocialMediaTile/SocialMediaTile.tsx b/packages/ui/src/memberships/components/SocialMediaTile/SocialMediaTile.tsx index 894c4cf88e..7ce862932f 100644 --- a/packages/ui/src/memberships/components/SocialMediaTile/SocialMediaTile.tsx +++ b/packages/ui/src/memberships/components/SocialMediaTile/SocialMediaTile.tsx @@ -14,6 +14,7 @@ import { WhatsappIcon, YoutubeIcon, TelegramIcon, + LinkedinIcon, } from '@/common/components/icons/socials' import { RowGapBlock } from '@/common/components/page/PageContent' import { TextMedium } from '@/common/components/typography' @@ -34,6 +35,7 @@ export const socialToIcon: Record = { WECHAT: , WHATSAPP: , HYPERLINK: , + LINKEDIN: , } export const socialMediaList = Object.keys(socialToIcon) as (keyof typeof socialToIcon)[] diff --git a/packages/ui/src/proposals/components/ProposalHistory.tsx b/packages/ui/src/proposals/components/ProposalHistory.tsx index e390ec3fee..ca46f233bb 100644 --- a/packages/ui/src/proposals/components/ProposalHistory.tsx +++ b/packages/ui/src/proposals/components/ProposalHistory.tsx @@ -1,6 +1,6 @@ import React, { useMemo } from 'react' -import { BlockHistoryLine } from '@/common/components/BlockTime' +import { BlockTime } from '@/common/components/BlockTime' import { RowGapBlock } from '@/common/components/page/PageContent' import { Stepper, StepperStep } from '@/common/components/Stepper' import { Label } from '@/common/components/typography' @@ -24,7 +24,7 @@ export const ProposalHistory = ({ proposal }: ProposalHistoryProps) => { return steps.map(({ status, inBlock }, index) => ({ title: status, type: index === steps.length - 1 ? 'active' : 'past', - details: , + details: , })) }, [proposal.id]) diff --git a/yarn.lock b/yarn.lock index 9128de1a86..7979785d4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3623,7 +3623,23 @@ __metadata: languageName: unknown linkType: soft -"@joystream/metadata-protobuf@npm:^2.0.0, @joystream/metadata-protobuf@npm:^2.6.0": +"@joystream/metadata-protobuf@npm:^2.10.0": + version: 2.10.0 + resolution: "@joystream/metadata-protobuf@npm:2.10.0" + dependencies: + "@types/iso-3166-2": ^1.0.0 + "@types/long": ^4.0.1 + google-protobuf: ^3.14.0 + i18n-iso-countries: ^6.8.0 + iso-3166-2: ^1.0.0 + iso-639-1: ^2.1.9 + long: ^4.0.0 + protobufjs: ^6.11.2 + checksum: 4b56f02d6863d6f1e1cd91075606666224338066c078e77cb2b3bac090dc535a740279711106778c666befa8abc8b08b3f11bedf9b5e8c96f14d92887c8cc3ed + languageName: node + linkType: hard + +"@joystream/metadata-protobuf@npm:^2.6.0": version: 2.6.0 resolution: "@joystream/metadata-protobuf@npm:2.6.0" dependencies: @@ -3657,7 +3673,7 @@ __metadata: "@jest/types": ^27.2.5 "@joystream/js": 1.2.0 "@joystream/markdown-editor": ^0.1.0 - "@joystream/metadata-protobuf": ^2.0.0 + "@joystream/metadata-protobuf": ^2.10.0 "@joystream/types": ^2.0.0 "@miragejs/graphql": ^0.1.13 "@nivo/bar": ^0.79.1