1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00
vault-frontend/src/components/boris/BorisStatsGit/index.tsx
2022-01-19 12:30:04 +07:00

63 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { FC, useMemo } from 'react';
import { Placeholder } from '~/components/placeholders/Placeholder';
import { GithubIssue } from '~/types/boris';
import { BorisStatsGitCard } from '../BorisStatsGitCard';
import styles from './styles.module.scss';
interface IProps {
issues: GithubIssue[];
isLoading: boolean;
}
const BorisStatsGit: FC<IProps> = ({ issues, isLoading }) => {
const open = useMemo(
() => issues.filter(el => !el.pull_request && el.state === 'open').slice(0, 5),
[issues]
);
const closed = useMemo(
() => issues.filter(el => !el.pull_request && el.state === 'closed').slice(0, 5),
[issues]
);
if (!issues.length) return null;
if (isLoading) {
return (
<>
<div className={styles.stats__title}>
<Placeholder width="50%" />
</div>
<Placeholder width="50%" />
<Placeholder width="100%" />
<Placeholder width="50%" />
<Placeholder width="70%" />
<Placeholder width="60%" />
<Placeholder width="100%" />
</>
);
}
return (
<div className={styles.wrap}>
<div className={styles.stats__title}>
<span>КОММИТС</span>
<img src="https://jenkins.vault48.org/api/badges/muerwre/vault-golang/status.svg" alt="" />
</div>
{open.map(data => (
<BorisStatsGitCard data={data} key={data.id} />
))}
{closed.map(data => (
<BorisStatsGitCard data={data} key={data.id} />
))}
</div>
);
};
export { BorisStatsGit };