Merge branch 'dev' into test
This commit is contained in:
@@ -23,7 +23,6 @@ import {
|
|||||||
ChatQuotaExhaustedBanner,
|
ChatQuotaExhaustedBanner,
|
||||||
ExternalBrowserDialog,
|
ExternalBrowserDialog,
|
||||||
PwaInstallOverlay,
|
PwaInstallOverlay,
|
||||||
VoiceUnlockOptionsDialog,
|
|
||||||
} from "./components";
|
} from "./components";
|
||||||
import styles from "./components/chat-screen.module.css";
|
import styles from "./components/chat-screen.module.css";
|
||||||
|
|
||||||
@@ -41,7 +40,6 @@ export function ChatScreen() {
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [showExternalBrowserDialog, setShowExternalBrowserDialog] =
|
const [showExternalBrowserDialog, setShowExternalBrowserDialog] =
|
||||||
useState(false);
|
useState(false);
|
||||||
const [showVoiceUnlockDialog, setShowVoiceUnlockDialog] = useState(false);
|
|
||||||
|
|
||||||
// isGuest 派生(chat-screen 是唯一知道这个值的地方 —— chat 机器无 isGuest 字段)
|
// isGuest 派生(chat-screen 是唯一知道这个值的地方 —— chat 机器无 isGuest 字段)
|
||||||
const isGuest = deriveIsGuest(authState.loginStatus);
|
const isGuest = deriveIsGuest(authState.loginStatus);
|
||||||
@@ -62,20 +60,6 @@ export function ChatScreen() {
|
|||||||
returnTo: "chat",
|
returnTo: "chat",
|
||||||
});
|
});
|
||||||
|
|
||||||
function navigateToSubscription(type: "vip" | "voice"): void {
|
|
||||||
const subscriptionUrl = ROUTE_BUILDERS.subscription(type, {
|
|
||||||
returnTo: "chat",
|
|
||||||
});
|
|
||||||
|
|
||||||
setShowVoiceUnlockDialog(false);
|
|
||||||
if (isGuest) {
|
|
||||||
router.push(ROUTE_BUILDERS.authWithRedirect(subscriptionUrl));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
router.push(subscriptionUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!authState.hasInitialized || authState.isLoading) return;
|
if (!authState.hasInitialized || authState.isLoading) return;
|
||||||
const isDev = AppEnvUtil.isDevelopment();
|
const isDev = AppEnvUtil.isDevelopment();
|
||||||
@@ -170,7 +154,11 @@ export function ChatScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleUnlockVoiceMessage(): void {
|
function handleUnlockVoiceMessage(): void {
|
||||||
setShowVoiceUnlockDialog(true);
|
if (isGuest) {
|
||||||
|
router.push(ROUTE_BUILDERS.authWithRedirect(chatPaywallSubscriptionUrl));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
router.push(chatPaywallSubscriptionUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -230,12 +218,6 @@ export function ChatScreen() {
|
|||||||
onClose={() => setShowExternalBrowserDialog(false)}
|
onClose={() => setShowExternalBrowserDialog(false)}
|
||||||
onConfirm={() => void handleOpenExternalBrowser()}
|
onConfirm={() => void handleOpenExternalBrowser()}
|
||||||
/>
|
/>
|
||||||
<VoiceUnlockOptionsDialog
|
|
||||||
open={showVoiceUnlockDialog}
|
|
||||||
onClose={() => setShowVoiceUnlockDialog(false)}
|
|
||||||
onBuyVoicePackage={() => navigateToSubscription("voice")}
|
|
||||||
onActivateVip={() => navigateToSubscription("vip")}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</MobileShell>
|
</MobileShell>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,14 +13,12 @@ import {
|
|||||||
UserHeader,
|
UserHeader,
|
||||||
type SidebarUserState,
|
type SidebarUserState,
|
||||||
VipBenefitsCard,
|
VipBenefitsCard,
|
||||||
VoicePackageCard,
|
|
||||||
} from "./components";
|
} from "./components";
|
||||||
|
|
||||||
import styles from "./components/sidebar-screen.module.css";
|
import styles from "./components/sidebar-screen.module.css";
|
||||||
|
|
||||||
const FALLBACK_USERNAME = "User name";
|
const FALLBACK_USERNAME = "User name";
|
||||||
const VIP_SUBSCRIPTION_URL = `${ROUTES.subscription}?type=vip`;
|
const VIP_SUBSCRIPTION_URL = `${ROUTES.subscription}?type=vip`;
|
||||||
const VOICE_SUBSCRIPTION_URL = `${ROUTES.subscription}?type=voice`;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 侧边栏主屏幕
|
* 侧边栏主屏幕
|
||||||
@@ -82,6 +80,7 @@ export function SidebarScreen() {
|
|||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
{/*
|
||||||
<section className={styles.cardSlot}>
|
<section className={styles.cardSlot}>
|
||||||
<VoicePackageCard
|
<VoicePackageCard
|
||||||
usedMinutes={0}
|
usedMinutes={0}
|
||||||
@@ -89,6 +88,7 @@ export function SidebarScreen() {
|
|||||||
onBuyPackage={() => router.push(VOICE_SUBSCRIPTION_URL)}
|
onBuyPackage={() => router.push(VOICE_SUBSCRIPTION_URL)}
|
||||||
/>
|
/>
|
||||||
</section>
|
</section>
|
||||||
|
*/}
|
||||||
|
|
||||||
{sidebarState !== "guest" ? (
|
{sidebarState !== "guest" ? (
|
||||||
<section className={styles.settingsSlot}>
|
<section className={styles.settingsSlot}>
|
||||||
|
|||||||
Reference in New Issue
Block a user