@@ -8,16 +8,14 @@ import {
88} from '@daml.js/splice-dso-governance/lib/Splice/DsoRules' ;
99import { ContractId } from '@daml/types' ;
1010import { ChevronLeft } from '@mui/icons-material' ;
11- import { Box , Button , Chip , Link , Stack , Tab , Tabs , Typography } from '@mui/material' ;
11+ import { Box , Button , Divider , Link , Stack , Tab , Tabs , Typography } from '@mui/material' ;
1212import React , { PropsWithChildren , useMemo , useState } from 'react' ;
1313import dayjs from 'dayjs' ;
1414import relativeTime from 'dayjs/plugin/relativeTime' ;
1515import {
1616 getAmuletConfigToCompareWith ,
1717 getDsoConfigToCompareWith ,
18- PartyId ,
1918 PrettyJsonDiff ,
20- theme ,
2119 useVotesHooks ,
2220} from '@lfdecentralizedtrust/splice-common-frontend' ;
2321import { sanitizeUrl } from '@lfdecentralizedtrust/splice-common-frontend-utils' ;
@@ -34,7 +32,7 @@ import { JsonDiffAccordion } from './JsonDiffAccordion';
3432import { useDsoInfos } from '../../contexts/SvContext' ;
3533import { DetailItem } from './proposal-details/DetailItem' ;
3634import { CreateUnallocatedUnclaimedActivityRecordSection } from './proposal-details/CreateUnallocatedUnclaimedActivityRecordSection' ;
37- import { CopyableIdentifier , MemberIdentifier } from '../beta' ;
35+ import { CopyableIdentifier , MemberIdentifier , VoteStats } from '../beta' ;
3836
3937dayjs . extend ( relativeTime ) ;
4038
@@ -348,6 +346,15 @@ export const ProposalDetailsContent: React.FC<ProposalDetailsContentProps> = pro
348346 onChange = { handleVoteTabChange }
349347 aria-label = "vote tabs"
350348 data-testid = "votes-tabs"
349+ sx = { {
350+ // after experimenting with it a little, this is probably the best way to put something akin to borderBottom
351+ // inside of the <Tab> components so it doesn't interfere with <Tabs> overflow: hidden property
352+ boxShadow : 'inset 0 -2px 0 0 rgba(255, 255, 255, 0.12)' ,
353+ '& .MuiTabs-indicator' : {
354+ backgroundColor : 'colors.tertiary' ,
355+ height : '2px' ,
356+ } ,
357+ } }
351358 >
352359 < Tab label = { `All (${ votes . length } )` } value = "all" data-testid = "all-votes-tab" />
353360 < Tab
@@ -373,7 +380,7 @@ export const ProposalDetailsContent: React.FC<ProposalDetailsContentProps> = pro
373380 </ Tabs >
374381
375382 < Box
376- sx = { { display : 'flex' , flexDirection : 'column' , gap : 2 , mb : 4 } }
383+ sx = { { display : 'flex' , flexDirection : 'column' , gap : 3 } }
377384 data-testid = "proposal-details-votes-list"
378385 >
379386 { getFilteredVotes ( ) . map ( ( vote , index ) => (
@@ -435,64 +442,34 @@ interface VoteItemProps {
435442 isYou ?: boolean ;
436443}
437444
438- const VoteItem = ( { voter, url, comment, status, isClosed, isYou = false } : VoteItemProps ) => {
439- const getStatusColor = ( ) => {
440- switch ( status ) {
441- case 'accepted' :
442- return theme . palette . success . main ;
443- case 'rejected' :
444- return theme . palette . error . main ;
445- case 'no-vote' :
446- return isClosed ? theme . palette . error . main : '#ff9800' ;
447- default :
448- return '#757575' ;
449- }
450- } ;
451-
452- const getStatusText = ( ) => {
453- switch ( status ) {
454- case 'accepted' :
455- return 'Accepted' ;
456- case 'rejected' :
457- return 'Rejected' ;
458- case 'no-vote' :
459- return isClosed ? 'No Vote' : 'Awaiting Response' ;
460- }
461- } ;
462-
463- return (
445+ const VoteItem : React . FC < VoteItemProps > = ( {
446+ voter,
447+ url,
448+ comment,
449+ status,
450+ isClosed,
451+ isYou = false ,
452+ } ) => (
453+ < >
464454 < Box
465455 sx = { {
466- p : 2 ,
467- border : '1px solid rgba(81, 81, 81, 1)' ,
468- borderRadius : 2 ,
469456 display : 'flex' ,
470457 justifyContent : 'space-between' ,
471- alignItems : 'flex-start ' ,
458+ alignItems : 'center ' ,
472459 } }
473460 data-testid = "proposal-details-vote"
474461 >
475462 < Box sx = { { flexGrow : 1 } } >
476- < Box sx = { { display : 'flex' , alignItems : 'center' , mb : 1 } } >
477- < PartyId
463+ < Box sx = { { display : 'flex' , alignItems : 'center' } } >
464+ < MemberIdentifier
478465 partyId = { voter }
479- className = "proposal-details-voter-party-id"
480- id = "proposal-details-voter-party-id"
466+ size = "large"
467+ isYou = { isYou }
468+ data-testid = "proposal-details-voter-party-id"
481469 />
482- { isYou && (
483- < Chip
484- label = "You"
485- size = "small"
486- sx = { {
487- ml : 1 ,
488- bgcolor : 'rgba(255, 255, 255, 0.1)' ,
489- } }
490- data-testid = "proposal-details-your-vote-chip"
491- />
492- ) }
493470 </ Box >
494471 { comment && (
495- < Typography variant = "body2" color = "text.secondary" >
472+ < Typography fontSize = { 16 } color = "text.secondary" >
496473 { comment }
497474 </ Typography >
498475 ) }
@@ -504,29 +481,15 @@ const VoteItem = ({ voter, url, comment, status, isClosed, isYou = false }: Vote
504481 </ Typography >
505482 ) }
506483 </ Box >
507- < Box sx = { { display : 'flex' , alignItems : 'center' } } >
508- < Box
509- component = "span"
510- sx = { {
511- display : 'inline-block' ,
512- width : 16 ,
513- height : 16 ,
514- borderRadius : '50%' ,
515- bgcolor : getStatusColor ( ) ,
516- mr : 1 ,
517- } }
518- />
519- < Typography
520- variant = "body2"
521- color = { getStatusColor ( ) }
522- data-testid = "proposal-details-vote-status-value"
523- >
524- { getStatusText ( ) }
525- </ Typography >
526- </ Box >
484+ < VoteStats
485+ vote = { status }
486+ noVoteMessage = { isClosed ? 'No Vote' : 'Awaiting Response' }
487+ data-testid = "proposal-details-vote-status"
488+ />
527489 </ Box >
528- ) ;
529- } ;
490+ < Divider sx = { { borderBottomWidth : 2 } } />
491+ </ >
492+ ) ;
530493
531494interface OffboardMemberSectionProps {
532495 memberPartyId : string ;
0 commit comments