TopicsLimit
This commit is contained in:
		
							parent
							
								
									2267d27c9b
								
							
						
					
					
						commit
						e650f813c5
					
				
					 7 changed files with 43 additions and 14 deletions
				
			
		|  | @ -168,7 +168,7 @@ const Stats = () => { | |||
|         return <></>; | ||||
|     } | ||||
|     const planCode = account.plan.code ?? "none"; | ||||
|     const normalize = (value, max) => (value / max * 100); | ||||
|     const normalize = (value, max) => Math.min(value / max * 100, 100); | ||||
|     return ( | ||||
|         <Card sx={{p: 3}} aria-label={t("account_usage_title")}> | ||||
|             <Typography variant="h5" sx={{marginBottom: 2}}> | ||||
|  | @ -182,6 +182,13 @@ const Stats = () => { | |||
|                             : t(`account_usage_plan_code_${planCode}`)} | ||||
|                     </div> | ||||
|                 </Pref> | ||||
|                 <Pref title={t("account_usage_topics_title")}> | ||||
|                     <div> | ||||
|                         <Typography variant="body2" sx={{float: "left"}}>{account.stats.topics}</Typography> | ||||
|                         <Typography variant="body2" sx={{float: "right"}}>{account.limits.topics > 0 ? t("account_usage_of_limit", { limit: account.limits.topics }) : t("account_usage_unlimited")}</Typography> | ||||
|                     </div> | ||||
|                     <LinearProgress variant="determinate" value={account.limits.topics > 0 ? normalize(account.stats.topics, account.limits.topics) : 100} /> | ||||
|                 </Pref> | ||||
|                 <Pref title={t("account_usage_messages_title")}> | ||||
|                     <div> | ||||
|                         <Typography variant="body2" sx={{float: "left"}}>{account.stats.messages}</Typography> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue