Skip to content

Commit

Permalink
Merge pull request #1622 from kleros/refactor/evidence-tab-ui-updates
Browse files Browse the repository at this point in the history
refactor(web): refactor-date-and-file-viewer-styles
  • Loading branch information
jaybuidl authored Jun 19, 2024
2 parents de4c5d6 + f2021c8 commit ee63a5d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/src/components/EvidenceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const DesktopText = styled.span`
)}
`;

const Timestamp = styled.p`
const Timestamp = styled.label`
color: ${({ theme }) => theme.secondaryText};
`;

Expand Down Expand Up @@ -164,7 +164,7 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({ evidence, sender, index, timest
<Identicon size="24" string={sender} />
<p>{shortenAddress(sender)}</p>
</AccountContainer>
<Timestamp>{formatDate(Number(timestamp))}</Timestamp>
<Timestamp>{formatDate(Number(timestamp), true)}</Timestamp>
{data && typeof data.fileURI !== "undefined" && (
<StyledLink to={`attachment/?url=${getIpfsUrl(data.fileURI)}`}>
<AttachmentIcon />
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/FileViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Wrapper = styled.div`
background-color: ${({ theme }) => theme.whiteBackground};
border-radius: 3px;
box-shadow: 0px 2px 3px 0px rgba(0, 0, 0, 0.06);
max-height: 750px;
max-height: 1050px;
overflow: scroll;
${customScrollbar}
Expand Down
14 changes: 12 additions & 2 deletions web/src/utils/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ export function getOneYearAgoTimestamp(): number {
return currentTime - 31536000; // One year in seconds
}

export function formatDate(unixTimestamp: number): string {
export function formatDate(unixTimestamp: number, withTime = false): string {
const date = new Date(unixTimestamp * 1000);
const options: Intl.DateTimeFormatOptions = { month: "long", day: "2-digit", year: "numeric" };
const options: Intl.DateTimeFormatOptions = withTime
? {
month: "long",
day: "2-digit",
year: "numeric",
hour: "numeric",
minute: "numeric",
timeZone: "GMT",
timeZoneName: "short",
}
: { month: "long", day: "2-digit", year: "numeric" };
return date.toLocaleDateString("en-US", options);
}

0 comments on commit ee63a5d

Please sign in to comment.