This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/app/components/DocumentTasks.js
2021-07-27 11:31:27 +05:30

34 lines
818 B
JavaScript

// @flow
import * as React from "react";
import { useTranslation } from "react-i18next";
import CircularProgressBar from "components/CircularProgressBar";
import Document from "../models/Document";
type Props = {|
document: Document,
|};
function DocumentTasks({ document }: Props) {
const { tasks, tasksPercentage } = document;
const { t } = useTranslation();
const { completed, total } = tasks;
const message =
completed === 0
? t(`{{ total }} tasks`, { total })
: completed === total
? t(`{{ completed }} tasks done`, { completed })
: t(`{{ completed }} of {{ total }} tasks`, {
total,
completed,
});
return (
<>
<CircularProgressBar percentage={tasksPercentage} />
&nbsp;{message}
</>
);
}
export default DocumentTasks;