mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
fix(core): handle unexpected hits to paywalls (#10215)
close AF-2232 fix(core): handle unexpected hits to paywalls chore: remove sent email action
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Loading,
|
||||
Menu,
|
||||
MenuItem,
|
||||
@@ -165,9 +164,11 @@ export const InviteMemberEditor = ({
|
||||
}
|
||||
return [...prev, member];
|
||||
});
|
||||
setSearchText('');
|
||||
memberSearchService.search('');
|
||||
focusInput();
|
||||
},
|
||||
[focusInput]
|
||||
[focusInput, memberSearchService]
|
||||
);
|
||||
|
||||
const handleRoleChange = useCallback((role: DocRole) => {
|
||||
@@ -211,9 +212,11 @@ export const InviteMemberEditor = ({
|
||||
onBlur={onBlur}
|
||||
autoFocus
|
||||
className={styles.searchInput}
|
||||
placeholder={t[
|
||||
'com.affine.share-menu.invite-editor.placeholder'
|
||||
]()}
|
||||
placeholder={
|
||||
selectedMembers.length
|
||||
? ''
|
||||
: t['com.affine.share-menu.invite-editor.placeholder']()
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{!selectedMembers.length ? null : (
|
||||
@@ -225,17 +228,6 @@ export const InviteMemberEditor = ({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{selectedMembers.length ? (
|
||||
<div className={styles.sentEmail}>
|
||||
<Checkbox
|
||||
className={styles.checkbox}
|
||||
checked={false}
|
||||
disabled // TODO(@JimmFly): implement this
|
||||
/>
|
||||
{t['com.affine.share-menu.invite-editor.sent-email']()}
|
||||
{` (coming soon)`}
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.resultContainer}>
|
||||
<Result onClickMember={handleClickMember} />
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Tabs, Tooltip, useConfirmModal } from '@affine/component';
|
||||
import { Button } from '@affine/component/ui/button';
|
||||
import { Menu } from '@affine/component/ui/menu';
|
||||
import {
|
||||
ServerService,
|
||||
WorkspaceSubscriptionService,
|
||||
} from '@affine/core/modules/cloud';
|
||||
import { ServerService } from '@affine/core/modules/cloud';
|
||||
import { WorkspaceDialogService } from '@affine/core/modules/dialogs';
|
||||
import { WorkspacePermissionService } from '@affine/core/modules/permissions';
|
||||
import { WorkspaceQuotaService } from '@affine/core/modules/quota';
|
||||
import { ShareInfoService } from '@affine/core/modules/share-doc';
|
||||
import type { WorkspaceMetadata } from '@affine/core/modules/workspace';
|
||||
import { ServerDeploymentType, SubscriptionPlan } from '@affine/graphql';
|
||||
@@ -20,6 +18,7 @@ import {
|
||||
type Ref,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
@@ -55,14 +54,18 @@ export const ShareMenuContent = (props: ShareMenuProps) => {
|
||||
c => c.type === ServerDeploymentType.Selfhosted
|
||||
)
|
||||
);
|
||||
|
||||
const workspaceSubscriptionService = useService(WorkspaceSubscriptionService);
|
||||
const subscription = useLiveData(
|
||||
workspaceSubscriptionService.subscription.subscription$
|
||||
);
|
||||
const hittingPaywall =
|
||||
(!subscription && !isSelfhosted) ||
|
||||
(subscription && subscription.plan === SubscriptionPlan.Free);
|
||||
const workspaceQuotaService = useService(WorkspaceQuotaService);
|
||||
const quota = useLiveData(workspaceQuotaService.quota.quota$);
|
||||
const hittingPaywall = useMemo(() => {
|
||||
if (isSelfhosted) {
|
||||
return false;
|
||||
}
|
||||
if (quota) {
|
||||
const { name } = quota;
|
||||
return name.toLowerCase() === SubscriptionPlan.Free.toLowerCase();
|
||||
}
|
||||
return true;
|
||||
}, [isSelfhosted, quota]);
|
||||
|
||||
const permissionService = useService(WorkspacePermissionService);
|
||||
const isOwner = useLiveData(permissionService.permission.isOwner$);
|
||||
@@ -74,8 +77,8 @@ export const ShareMenuContent = (props: ShareMenuProps) => {
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
workspaceSubscriptionService.subscription.revalidate();
|
||||
}, [workspaceSubscriptionService]);
|
||||
workspaceQuotaService.quota.revalidate();
|
||||
}, [workspaceQuotaService]);
|
||||
|
||||
const { openConfirmModal } = useConfirmModal();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user