Skip to content

Commit

Permalink
fix: styles update
Browse files Browse the repository at this point in the history
fix: icon color, tooltips, outcome step

fix: style fixes

fix: types

fix: progress bar fonts, button margin

fix: removed not needed ifs

fix: margin

reverse config

bar width, reputation on mobile, scroll

fix: timer position, avatar shrink

reverse config
  • Loading branch information
joanna-pagepro authored and CzarekDryl committed May 7, 2024
1 parent b6c9d9f commit 6767240
Show file tree
Hide file tree
Showing 29 changed files with 292 additions and 165 deletions.
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"react-dropzone": "^14.2.1",
"react-helmet-async": "^2.0.3",
"react-hook-form": "^7.45.2",
"react-intersection-observer": "^9.8.2",
"react-intl": "^6.6.1",
"react-modal": "^3.15.1",
"react-popper": "^2.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const UserHubButton: FC = () => {
splitWalletAddress(walletAddress ?? ADDRESS_ZERO);

return (
<div ref={ref}>
<div ref={ref} className="flex-shrink-0">
<Button
mode="tertiary"
size="large"
Expand All @@ -136,11 +136,12 @@ const UserHubButton: FC = () => {
)}
onClick={handleButtonClick}
>
<div className="flex items-center">
<div className="flex flex-shrink-0 items-center">
{/* If there's a user, there's a wallet */}
{walletAddress ? (
<>
<UserAvatar
className="flex-shrink-0"
userAvatarSrc={user?.profile?.avatar ?? undefined}
userName={userName}
userAddress={wallet.address}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const MemberReputation: FC<MemberReputationProps> = ({
{percentageReputation === ZeroValue.NearZero && percentageReputation}
{percentageReputation &&
percentageReputation !== ZeroValue.NearZero && (
<Numeral value={percentageReputation} suffix=" %" />
<>
<Numeral value={percentageReputation} />%
</>
)}
</span>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/components/shared/Extensions/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const displayName = 'Extensions.Tooltip';
const Tooltip: FC<PropsWithChildren<TooltipProps>> = ({
children,
tooltipContent,
tooltipStyle,
placement = 'auto',
popperOptions,
interactive,
Expand Down Expand Up @@ -68,6 +69,7 @@ const Tooltip: FC<PropsWithChildren<TooltipProps>> = ({
'bg-gray-900 [&_a]:underline': !isSuccess,
},
),
style: tooltipStyle,
})}
>
<div
Expand Down
1 change: 1 addition & 0 deletions src/components/shared/Extensions/Tooltip/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { type PopperOptions, type TriggerType } from 'react-popper-tooltip';

export interface TooltipProps {
tooltipContent: ReactNode;
tooltipStyle?: React.CSSProperties;
trigger?: TriggerType | TriggerType[] | null;
placement?: PlacementType;
offset?: [number, number];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const PermissionSidebar: FC<PermissionSidebarProps> = ({ transactionId }) => {
id: 'action.executed.permissions.description',
}),
iconAlignment: 'top',
textClassName: 'text-4',
textClassName: 'text-4 text-gray-900',
}}
sections={[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,28 @@ const ExitRecoveryStep: FC = () => {
<MenuWithStatusText
statusTextSectionProps={{
status: StatusTypes.Info,
children: formatText(
{ id: 'motion.exitRecovery.statusText' },
{ signatures: 2 },
children: (
<>
<p className="text-4">
{formatText(
{ id: 'motion.exitRecovery.statusText' },
{ signatures: 2 },
)}
</p>
<ProgressBar
progress={0}
progressLabel={formatText(
{
id: 'motion.exitRecovery.additionalText',
},
{ signatures: 2 },
)}
max={2}
className="mt-2"
/>
</>
),
textClassName: 'text-4',
iconAlignment: 'top',
content: (
<ProgressBar
progress={0}
additionalText={formatText(
{
id: 'motion.exitRecovery.additionalText',
},
{ signatures: 2 },
)}
max={2}
className="ml-1"
/>
),
}}
sections={[
{
Expand Down Expand Up @@ -107,7 +110,7 @@ const ExitRecoveryStep: FC = () => {
children: formatText({
id: 'motion.exitRecovery.storageSlots.statusText',
}),
textClassName: 'text-4',
textClassName: 'text-4 text-gray-900',
iconAlignment: 'top',
}}
sections={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const FinalizeStep: FC<FinalizeStepProps> = ({
? 'motion.finalizeStep.failed.statusText'
: 'motion.finalizeStep.statusText',
}),
textClassName: 'text-4',
textClassName: 'text-4 text-gray-900',
iconAlignment: 'top',
content: (
<div />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const getOutcomeStepTitle = (

const OutcomeStep: FC<OutcomeStepProps> = ({ motionData }) => {
const { wallet } = useAppContext();
const { voteStatuses } = useOutcomeStep(motionData);
const { voteStatuses, stakingData } = useOutcomeStep(motionData);
const { stakers, stakeVoteStatuses } = stakingData || {};

const voters: UserAvatarsItem[] =
motionData?.voterRecord.map((voter) => ({
Expand All @@ -73,6 +74,8 @@ const OutcomeStep: FC<OutcomeStepProps> = ({ motionData }) => {
? MotionVote.Yay
: MotionVote.Nay;

const showVotingData = voters.length !== 0;

return (
<MenuWithSections
sections={[
Expand All @@ -83,7 +86,10 @@ const OutcomeStep: FC<OutcomeStepProps> = ({ motionData }) => {
<h3 className="mb-4 text-center text-1">
{formatText(getOutcomeStepTitle(currentUserVote, winningSide))}
</h3>
<VoteStatuses items={voteStatuses} voters={voters} />
<VoteStatuses
items={showVotingData ? voteStatuses : stakeVoteStatuses || []}
voters={showVotingData ? voters : stakers || []}
/>
</div>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useMemo } from 'react';

import { type ColonyMotion } from '~types/graphql.ts';
import { MotionVote } from '~utils/colonyMotions.ts';
import { type UserAvatarsItem } from '~v5/shared/UserAvatars/types.ts';

import { supportOption, opposeOption } from '../../consts.ts';

Expand Down Expand Up @@ -34,7 +35,55 @@ export const useOutcomeStep = (motionData: ColonyMotion | null | undefined) => {
];
}, [motionData]);

const stakingData = useMemo(() => {
if (!motionData) return undefined;

const { usersStakes } = motionData;

const stakers = usersStakes.flatMap((userStakes) => {
const { address, stakes } = userStakes;

const yay = Number(stakes.percentage.yay);
const nay = Number(stakes.percentage.nay);
const addresses: UserAvatarsItem[] = [];

if (yay > 0) {
addresses.push({ address, voteCount: '1', vote: MotionVote.Yay });
}

if (nay > 0) {
addresses.push({ address, voteCount: '1', vote: MotionVote.Nay });
}

return addresses;
});

// 100 is hardcoded because in userStakes total wasn't 100% (it was like 98%). Probably because of rounding.
const stakeVoteStatuses: VoteStatuses[] = [
{
key: supportOption.id,
icon: supportOption.icon,
label: supportOption.label || '',
progress: 100,
status: MotionVote.Yay,
},
{
key: opposeOption.id,
icon: opposeOption.icon,
label: opposeOption.label || '',
progress: 100,
status: MotionVote.Nay,
},
];

return {
stakers,
stakeVoteStatuses,
};
}, [motionData]);

return {
voteStatuses,
stakingData,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,34 @@ const VoteStatuses: FC<VoteStatusesProps> = ({ items, voters }) => {
);

return (
<div className="flex flex-col gap-5">
<div className="grid grid-cols-[1fr_auto] gap-8">
{items.map(({ key, icon: Icon, label, progress, status }) => (
<div key={key} className="flex w-full items-center gap-8">
<div className="flex max-w-[182px] grow flex-col gap-1">
<React.Fragment key={key}>
<div className="flex w-full grow flex-col gap-1">
<span className="flex items-start gap-[0.375rem]">
<Icon
className={clsx('h-[1em] w-[1em] text-[1.125rem]', {
'text-purple-400': status === MotionVote.Yay,
'text-red-400': status === MotionVote.Nay,
'text-negative-400': status === MotionVote.Nay,
})}
size={20}
/>
<span
className={clsx('text-3', {
'text-purple-400': status === MotionVote.Yay,
'text-red-400': status === MotionVote.Nay,
'text-negative-400': status === MotionVote.Nay,
})}
>
{label}
</span>
</span>
<ProgressBar
progress={progress}
progressLabel={`${progress}%`}
max={100}
additionalText="%"
barClassName={clsx({
'bg-purple-200': status === MotionVote.Yay,
'bg-red-300': status === MotionVote.Nay,
'bg-negative-300': status === MotionVote.Nay,
})}
/>
</div>
Expand All @@ -72,7 +72,7 @@ const VoteStatuses: FC<VoteStatusesProps> = ({ items, voters }) => {
size={26}
/>
)}
</div>
</React.Fragment>
))}
</div>
);
Expand Down
Loading

0 comments on commit 6767240

Please sign in to comment.