Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3111-1: Wires up stale data from the API #8752

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Typography } from '@mui/material';
import { styled } from '@mui/material';
import { PrettifyLargeNumber } from 'component/common/PrettifyLargeNumber/PrettifyLargeNumber';
import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus';
import useLoading from 'hooks/useLoading';
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
import type { FC } from 'react';
import { Link } from 'react-router-dom';
Expand All @@ -19,7 +21,7 @@ const BigText = styled('span')(({ theme }) => ({

const BigNumber: FC<{ value?: number }> = ({ value }) => {
return (
<BigText>
<BigText data-loading-stale-flags>
<PrettifyLargeNumber
value={value ?? 0}
threshold={1000}
Expand All @@ -31,10 +33,13 @@ const BigNumber: FC<{ value?: number }> = ({ value }) => {

export const StaleFlags = () => {
const projectId = useRequiredPathParam('projectId');
const { data, loading } = useProjectStatus(projectId);
const loadingRef = useLoading(loading, '[data-loading-stale-flags=true]');

return (
<Wrapper>
<Wrapper ref={loadingRef}>
<Typography component='h4'>
<BigNumber value={6} />{' '}
<BigNumber value={data?.staleFlags.total ?? 0} />{' '}
<Link to={`/projects/${projectId}?state=IS%3Astale`}>
stale flags
</Link>
Expand Down
Loading