1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

#25 getting github issues as tasks

This commit is contained in:
Fedor Katurov 2021-03-10 14:47:04 +07:00
parent f014e0b51e
commit 29ffeb6b48
7 changed files with 74 additions and 19 deletions

View file

@ -1,22 +1,33 @@
import React, { FC } from 'react';
import { IStatGitRow } from '~/redux/boris/reducer';
import React, { FC, useMemo } from 'react';
import styles from './styles.module.scss';
import { getPrettyDate } from '~/utils/dom';
import { IGithubIssue } from '~/redux/boris/types';
import classNames from 'classnames';
interface IProps {
data: Partial<IStatGitRow>;
data: IGithubIssue;
}
const BorisStatsGitCard: FC<IProps> = ({ data: { timestamp, subject } }) => {
if (!subject || !timestamp) return null;
const stateLabels: Record<IGithubIssue['state'], string> = {
open: 'Ожидает',
closed: 'Сделано',
};
const BorisStatsGitCard: FC<IProps> = ({ data: { created_at, title, html_url, state } }) => {
if (!title || !created_at) return null;
const date = useMemo(() => getPrettyDate(created_at), [created_at]);
return (
<div className={styles.wrap}>
<div className={styles.time}>
{getPrettyDate(new Date(parseInt(`${timestamp}000`)).toISOString())}
<span className={classNames(styles.icon, styles[state])}>{stateLabels[state]}</span>
{date}
</div>
<div className={styles.subject}>{subject}</div>
<a className={styles.subject} href={html_url} target="_blank">
{title}
</a>
</div>
);
};

View file

@ -12,10 +12,28 @@
.time {
font: $font_12_regular;
line-height: 17px;
opacity: 0.3;
color: transparentize(white, 0.7)
}
.subject {
font: $font_14_regular;
word-break: break-word;
text-decoration: none;
color: inherit;
}
.icon {
font: $font_10_semibold;
margin-right: 5px;
border-radius: 2px;
padding: 2px 0;
text-transform: uppercase;
&.open {
color: $red;
}
&.closed {
color: $green;
}
}