Не подтверждена Коммит baeb5cc7 создал по автору JimmFly's avatar JimmFly
Просмотр файлов

feat(core): get cloud workspace usage limit from user quota (#5518)

владелец d6dd837b
...@@ -68,7 +68,11 @@ export const StorageProgress = ({ ...@@ -68,7 +68,11 @@ export const StorageProgress = ({
{upgradable ? ( {upgradable ? (
<Tooltip <Tooltip
options={{ hidden: percent < 100 }} options={{ hidden: percent < 100 }}
content={t['com.affine.storage.maximum-tips']()} content={
plan === 'Free'
? t['com.affine.storage.maximum-tips']()
: t['com.affine.storage.maximum-tips.pro']()
}
> >
<span tabIndex={0}> <span tabIndex={0}>
<Button <Button
......
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
import { Avatar } from '@affine/component/ui/avatar'; import { Avatar } from '@affine/component/ui/avatar';
import { Button } from '@affine/component/ui/button'; import { Button } from '@affine/component/ui/button';
import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks'; import { useAsyncCallback } from '@affine/core/hooks/affine-async-hooks';
import { useUserQuota } from '@affine/core/hooks/use-quota';
import { import {
allBlobSizesQuery, allBlobSizesQuery,
removeAvatarMutation, removeAvatarMutation,
...@@ -177,10 +178,13 @@ const StoragePanel = () => { ...@@ -177,10 +178,13 @@ const StoragePanel = () => {
const [subscription] = useUserSubscription(); const [subscription] = useUserSubscription();
const plan = subscription?.plan ?? SubscriptionPlan.Free; const plan = subscription?.plan ?? SubscriptionPlan.Free;
// TODO(@JimmFly): get limit from user usage query directly after #4720 is merged const quota = useUserQuota();
const maxLimit = useMemo(() => { const maxLimit = useMemo(() => {
if (quota) {
return quota.storageQuota;
}
return bytes.parse(plan === SubscriptionPlan.Free ? '10GB' : '100GB'); return bytes.parse(plan === SubscriptionPlan.Free ? '10GB' : '100GB');
}, [plan]); }, [plan, quota]);
const setSettingModalAtom = useSetAtom(openSettingModalAtom); const setSettingModalAtom = useSetAtom(openSettingModalAtom);
const onUpgrade = useCallback(() => { const onUpgrade = useCallback(() => {
......
...@@ -912,6 +912,7 @@ ...@@ -912,6 +912,7 @@
"com.affine.storage.extend.hint": "The usage has reached its maximum capacity, AFFiNE Cloud is currently in early access phase and is not supported for upgrading, please be patient and wait for our pricing plan. ", "com.affine.storage.extend.hint": "The usage has reached its maximum capacity, AFFiNE Cloud is currently in early access phase and is not supported for upgrading, please be patient and wait for our pricing plan. ",
"com.affine.storage.extend.link": "To get more information click here.", "com.affine.storage.extend.link": "To get more information click here.",
"com.affine.storage.maximum-tips": "You have reached the maximum capacity limit for your current account", "com.affine.storage.maximum-tips": "You have reached the maximum capacity limit for your current account",
"com.affine.storage.maximum-tips.pro": "Pro users will have unlimited storage capacity during the alpha test period of the team version",
"com.affine.storage.plan": "Plan", "com.affine.storage.plan": "Plan",
"com.affine.storage.title": "AFFiNE Cloud Storage", "com.affine.storage.title": "AFFiNE Cloud Storage",
"com.affine.storage.upgrade": "Upgrade", "com.affine.storage.upgrade": "Upgrade",
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать