Skip to content

Commit ed24f05

Browse files
authored
chore: hide share pro plan (#171)
1 parent d3810b8 commit ed24f05

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/components/app/publish-manage/PublishManage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import PublishedPages from '@/components/app/publish-manage/PublishedPages';
1212
import PublishPagesSkeleton from '@/components/app/publish-manage/PublishPagesSkeleton';
1313
import UpdateNamespace from '@/components/app/publish-manage/UpdateNamespace';
1414
import { useCurrentUser, useService } from '@/components/main/app.hooks';
15+
import { isOfficialHost } from '@/utils/subscription';
1516
import { openUrl } from '@/utils/url';
1617

1718
export function PublishManage({ onClose }: { onClose?: () => void }) {
@@ -175,6 +176,11 @@ export function PublishManage({ onClose }: { onClose?: () => void }) {
175176
const { getSubscriptions } = useAppHandlers();
176177
const [activeSubscription, setActiveSubscription] = React.useState<SubscriptionPlan | null>(null);
177178
const loadSubscription = useCallback(async () => {
179+
if (!isOfficialHost()) {
180+
setActiveSubscription(SubscriptionPlan.Pro);
181+
return;
182+
}
183+
178184
try {
179185
const subscriptions = await getSubscriptions?.();
180186

src/components/app/share/SharePanel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { InviteGuest } from '@/components/app/share/InviteGuest';
1010
import { PeopleWithAccess } from '@/components/app/share/PeopleWithAccess';
1111
import { UpgradeBanner } from '@/components/app/share/UpgradeBanner';
1212
import { useCurrentUser, useService } from '@/components/main/app.hooks';
13+
import { isOfficialHost } from '@/utils/subscription';
1314

1415
function SharePanel({ viewId }: { viewId: string }) {
1516
const currentUser = useCurrentUser();
@@ -122,6 +123,11 @@ function SharePanel({ viewId }: { viewId: string }) {
122123
}, [getSubscriptions]);
123124

124125
useEffect(() => {
126+
if (!isOfficialHost()) {
127+
setActiveSubscriptionPaln(SubscriptionPlan.Pro);
128+
return;
129+
}
130+
125131
if (isOwner || isMember) {
126132
void loadSubscription();
127133
}
@@ -141,7 +147,7 @@ function SharePanel({ viewId }: { viewId: string }) {
141147
hasFullAccess={hasFullAccess}
142148
activeSubscriptionPlan={activeSubscriptionPlan}
143149
/>
144-
<UpgradeBanner activeSubscriptionPlan={activeSubscriptionPlan} />
150+
{isOfficialHost() && <UpgradeBanner activeSubscriptionPlan={activeSubscriptionPlan} />}
145151
<PeopleWithAccess viewId={viewId} people={people} isLoading={isLoading} onPeopleChange={refreshPeople} />
146152
<GeneralAccess viewId={viewId} />
147153
<CopyLink />

src/components/app/workspaces/InviteMember.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '
1212
import { Input } from '@/components/ui/input';
1313
import { Label } from '@/components/ui/label';
1414
import { Progress } from '@/components/ui/progress';
15+
import { isOfficialHost } from '@/utils/subscription';
1516

1617
function InviteMember({
1718
workspace,
@@ -48,6 +49,11 @@ function InviteMember({
4849
const [activeSubscriptionPlan, setActiveSubscriptionPaln] = React.useState<SubscriptionPlan | null>(null);
4950

5051
const loadSubscription = useCallback(async () => {
52+
if (!isOfficialHost()) {
53+
setActiveSubscriptionPaln(SubscriptionPlan.Pro);
54+
return;
55+
}
56+
5157
try {
5258
const subscriptions = await getSubscriptions?.();
5359

src/utils/subscription.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import { getConfigValue } from '@/utils/runtime-config';
88

9-
const OFFICIAL_HOSTNAMES = new Set(['beta.appflowy.cloud', 'test.appflowy.cloud', 'localhost:8000']);
9+
const OFFICIAL_HOSTNAMES = new Set(['beta.appflowy.cloud', 'test.appflowy.cloud', 'localhost']);
1010

1111
function getBaseUrlHostname(): string | null {
1212
const baseUrl = getConfigValue('APPFLOWY_BASE_URL', '').trim();

0 commit comments

Comments
 (0)