Skip to content

Commit

Permalink
add: last seen
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuash committed Jul 30, 2021
1 parent 9c239fc commit 9907ed4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ type ValidatorProfile = {
commission: number;
signedBlockWindow: number;
missedBlockCounter: number;
lastSeen: string;
}
14 changes: 14 additions & 0 deletions src/components/desmos_profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Typography,
Divider,
} from '@material-ui/core';
import dayjs, { formatDayJs } from '@utils/dayjs';
import { useSettingsContext } from '@contexts';
import {
Box,
Avatar,
Expand All @@ -24,6 +26,7 @@ import {
const DesmosProfile: React.FC<{
className?: string;
} & DesmosProfile> = (props) => {
const { dateFormat } = useSettingsContext();
const { t } = useTranslation('accounts');
const classes = useStyles();
const {
Expand Down Expand Up @@ -147,6 +150,17 @@ const DesmosProfile: React.FC<{
</Typography>
)}
</div>
<div className={classnames(classes.item, 'last-seen')}>
<Typography variant="h4" className="label">
{t('validators:lastSeen')}
</Typography>
<Typography
variant="body1"
className="value"
>
{validator.lastSeen ? formatDayJs(dayjs.utc(validator.lastSeen), dateFormat) : t('validators:na')}
</Typography>
</div>
</div>
)}
{props.bio && (
Expand Down
11 changes: 11 additions & 0 deletions src/components/desmos_profile/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ export const useStyles = () => {
display: 'grid',
gridTemplateColumns: 'repeat(2, 1fr)',
gridTemplateRows: 'auto',
gridGap: theme.spacing(2),
[theme.breakpoints.up('md')]: {
gridTemplateColumns: 'repeat(4, 1fr)',
},
},
item: {
'& .label': {
Expand Down Expand Up @@ -116,6 +120,13 @@ export const useStyles = () => {
'& a': {
color: theme.palette.custom.fonts.highlight,
},

'&.last-seen': {
gridColumn: '1/3',
[theme.breakpoints.up('md')]: {
gridColumn: '3/5',
},
},
},
});
},
Expand Down
1 change: 1 addition & 0 deletions src/screens/validator_details/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const ValidatorDetails = () => {
commission: overview.commission,
signedBlockWindow: overview.signedBlockWindow,
missedBlockCounter: overview.missedBlockCounter,
lastSeen: overview.lastSeen,
}}
/>
) : (
Expand Down

0 comments on commit 9907ed4

Please sign in to comment.