Limit work

This commit is contained in:
binwiederhier 2022-12-18 14:35:05 -05:00
parent 56ab34a57f
commit 42e46a7c22
9 changed files with 114 additions and 62 deletions

View file

@ -141,6 +141,10 @@
"subscribe_dialog_login_button_login": "Login",
"subscribe_dialog_error_user_not_authorized": "User {{username}} not authorized",
"subscribe_dialog_error_user_anonymous": "anonymous",
"account_type_default": "Default",
"account_type_unlimited": "Unlimited",
"account_type_none": "None",
"account_type_hobbyist": "Hobbyist",
"prefs_notifications_title": "Notifications",
"prefs_notifications_sound_title": "Notification sound",
"prefs_notifications_sound_description_none": "Notifications do not play any sound when they arrive",

View file

@ -53,7 +53,9 @@ const Stats = () => {
const { t } = useTranslation();
const { account } = useOutletContext();
const admin = account?.role === "admin"
const accountType = account?.plan?.name ?? "Free";
const usage = account?.usage;
const plan = account?.plan;
const accountType = plan?.code ?? "none";
return (
<Card sx={{p: 3}} aria-label={t("xxxxxxxxx")}>
<Typography variant="h5" sx={{marginBottom: 2}}>
@ -64,13 +66,13 @@ const Stats = () => {
<div>
{account?.role === "admin"
? <>Unlimited <Tooltip title={"You are Admin"}><span style={{cursor: "default"}}>👑</span></Tooltip></>
: accountType}
: t(`account_type_${accountType}`)}
</div>
</Pref>
<Pref labelId={"dailyMessages"} title={t("Daily messages")}>
<div>
<Typography variant="body2" sx={{float: "left"}}>123</Typography>
<Typography variant="body2" sx={{float: "right"}}>of 1000</Typography>
<Typography variant="body2" sx={{float: "left"}}>{usage?.requests ?? 0}</Typography>
<Typography variant="body2" sx={{float: "right"}}>{plan?.request_limit > 0 ? t("of {{limit}}", { limit: plan.request_limit }) : t("Unlimited")}</Typography>
</div>
<LinearProgress variant="determinate" value={10} />
</Pref>