Skip to content

Commit

Permalink
#1253 add ellipsize text for drep name
Browse files Browse the repository at this point in the history
  • Loading branch information
Sworzen1 committed Jun 12, 2024
1 parent 5c5bb60 commit d7b34d1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box } from "@mui/material";
import { Box, SxProps } from "@mui/material";

import { Typography } from "@atoms";
import { Share } from "@molecules";
Expand All @@ -9,12 +9,14 @@ type DataMissingHeaderProps = {
isDataMissing: MetadataValidationStatus | null;
shareLink?: string;
title?: string;
titleStyle?: SxProps;
};

export const DataMissingHeader = ({
title,
isDataMissing,
shareLink,
titleStyle,
}: DataMissingHeaderProps) => (
<Box
sx={{
Expand All @@ -39,6 +41,7 @@ export const DataMissingHeader = ({
whiteSpace: "nowrap",
fontWeight: 600,
...(isDataMissing && { color: "errorRed" }),
...titleStyle,
}}
variant="title2"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";

import { Typography } from "@atoms";
import { gray } from "@consts";
import { ellipsizeText } from "@utils";

import { Card } from "./Card";
import { DirectVoterActionProps } from "./types";
Expand Down Expand Up @@ -31,7 +32,7 @@ export const DelegationAction = ({
>
<Box sx={{ width: "90%" }}>
<Typography fontWeight={600} variant="body2">
{drepName}
{ellipsizeText(drepName, 25)}
</Typography>
<Typography
sx={{
Expand Down
3 changes: 2 additions & 1 deletion govtool/frontend/src/components/organisms/DRepCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DRepData, DRepStatus } from "@models";
import { Card } from "@molecules";
import {
correctDRepDirectoryFormat,
ellipsizeText,
getMetadataDataMissingStatusTranslation,
} from "@utils";

Expand Down Expand Up @@ -103,7 +104,7 @@ export const DRepCard = ({
>
{metadataStatus
? getMetadataDataMissingStatusTranslation(metadataStatus)
: dRepName}
: ellipsizeText(dRepName ?? "", 25)}
</Typography>
<ButtonBase
data-testid={`${view}-copy-id-button`}
Expand Down
1 change: 1 addition & 0 deletions govtool/frontend/src/pages/DRepDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export const DRepDetails = ({ isConnected }: DRepDetailsProps) => {
title={dRepName ?? undefined}
isDataMissing={metadataStatus}
shareLink={!isMe ? window.location.href : undefined}
titleStyle={{ wordBreak: "break-word", whiteSpace: "wrap" }}
/>
{metadataStatus && (
<DataMissingInfoBox
Expand Down

0 comments on commit d7b34d1

Please sign in to comment.