Skip to content

Commit

Permalink
Merge pull request #3883 from JoinColony/feat/3869-decision-header-ti…
Browse files Browse the repository at this point in the history
…me-tags

Add time and tags to objection section
  • Loading branch information
jakubcolony authored Sep 22, 2022
2 parents d5b5c57 + 8aace2a commit 49a2118
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
}

.leftContent {
flex-grow: 1;
margin-top: 17px;
margin-bottom: 15px;
padding-bottom: 15px;
Expand All @@ -50,21 +51,36 @@
background-color: color-mod(var(--temp-grey-blue-7) alpha(15%));
}

.userinfo {
.header {
composes: inlineEllipsis from '~styles/text.css';
display: flex;
align-items: center;
font-size: var(--size-normal);
margin-bottom: 16px;
gap: 5px;
}

.nameAndTime {
display: flex;
flex-direction: column;
font-size: var(--size-tiny);
font-weight: var(--weight-bold);
color: var(--pink);
line-height: 18px;
}

.userName {
margin-left: 5px;
color: var(--pink);
}

.time {
color: color-mod(var(--dark) alpha(65%));
}

.tag {
align-self: flex-start;
margin-left: auto;
}

.title {
margin-top: 16px;
margin-bottom: 15px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ export const objectionContentContainer: string;
export const tagWrapper: string;
export const leftContent: string;
export const divider: string;
export const userinfo: string;
export const header: string;
export const nameAndTime: string;
export const userName: string;
export const time: string;
export const tag: string;
export const title: string;
export const details: string;
export const titleDecoration: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import HookedUserAvatar from '~users/HookedUserAvatar';
import { useDataFetcher } from '~utils/hooks';
import { Colony, AnyUser } from '~data/index';
import { DecisionDetails } from '~types/index';
import TimeRelative from '~core/TimeRelative';
import Tag, { Appearance as TagAppearance } from '~core/Tag';
import { MotionState, MOTION_TAG_MAP } from '~utils/colonyMotions';

import { ipfsDataFetcher } from '../../../../core/fetchers';

Expand Down Expand Up @@ -38,6 +41,7 @@ interface Props {
username: string;
walletAddress: string;
hash: string;
createdAt: number;
isObjection?: boolean;
}
// @NOTE For a Decision motions, the annotation stores the decision details.
Expand All @@ -47,6 +51,7 @@ const ActionPageDecisionWithIPFS = ({
username,
walletAddress,
hash,
createdAt,
isObjection = false,
}: Props) => {
const { data: ipfsDataJSON } = useDataFetcher(
Expand Down Expand Up @@ -117,7 +122,7 @@ const ActionPageDecisionWithIPFS = ({
}
>
<div className={styles.leftContent}>
<span className={styles.userinfo}>
<div className={styles.header}>
<UserAvatar
colony={colony}
size="s"
Expand All @@ -138,8 +143,28 @@ const ActionPageDecisionWithIPFS = ({
],
}}
/>
<span className={styles.userName}>{`@${username}`}</span>
</span>

<div className={styles.nameAndTime}>
<span className={styles.userName}>{`@${username}`}</span>
<span className={styles.time}>
<TimeRelative value={new Date(createdAt)} />
</span>
</div>

{isObjection && (
<div className={styles.tag}>
<Tag
text={MOTION_TAG_MAP[MotionState.Objection].name}
appearance={{
theme: MOTION_TAG_MAP[MotionState.Objection]
.theme as TagAppearance['theme'],
colorSchema: MOTION_TAG_MAP[MotionState.Objection]
.colorSchema as TagAppearance['colorSchema'],
}}
/>
</div>
)}
</div>
{!isObjection && (
<div className={styles.title}>
<Heading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ const DefaultMotion = ({
newVersion,
tokenAddress,
reputationChange,
createdAt,
},
colonyAction,
token,
Expand Down Expand Up @@ -413,6 +414,7 @@ const DefaultMotion = ({
user={initiator}
username={currentUserName || ''}
walletAddress={walletAddress}
createdAt={createdAt}
hash={annotationHash || ''}
/>
) : (
Expand All @@ -437,6 +439,7 @@ const DefaultMotion = ({
user={objectionAnnotationUser}
username={currentUserName || ''}
walletAddress={walletAddress}
createdAt={createdAt}
hash={objectionAnnotation?.motionObjectionAnnotation?.metadata}
isObjection
/>
Expand Down Expand Up @@ -495,6 +498,7 @@ const DefaultMotion = ({
annotationHash,
colony,
colonyAction,
createdAt,
currentUserName,
events,
initiator,
Expand Down

0 comments on commit 49a2118

Please sign in to comment.