Fix reward code modal and mobile viewport dock
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-30 16:25:46 +08:00
parent 22f3f963de
commit 4ef1d27021
8 changed files with 177 additions and 16 deletions

View File

@@ -464,6 +464,18 @@ test('wallet ledger modal shows empty and error states', async () => {
expect(screen.getByText('重新加载')).toBeTruthy();
});
test('opens reward code modal from profile action on mobile', async () => {
const user = userEvent.setup();
renderProfileView();
await user.click(screen.getByRole('button', { name: //u }));
const modal = await screen.findByPlaceholderText('输入兑换码');
expect(modal).toBeTruthy();
expect(screen.getByRole('button', { name: '兑换' })).toBeTruthy();
expect(screen.getByLabelText('关闭兑换码')).toBeTruthy();
});
test('shows a reachable login entry in logged out mobile shell', async () => {
const user = userEvent.setup();
const openLoginModal = vi.fn();

View File

@@ -1788,7 +1788,7 @@ function RewardCodeRedeemModal({
onClose: () => void;
}) {
return (
<div className="platform-modal-backdrop fixed inset-0 z-50 flex items-center justify-center px-4 py-6">
<div className="platform-modal-backdrop fixed inset-0 z-[80] flex items-center justify-center px-4 py-6">
<div className="platform-recharge-modal w-full max-w-sm overflow-hidden rounded-[1.4rem]">
<div className="flex items-center justify-between border-b border-white/10 px-5 py-4">
<div className="text-base font-black"></div>
@@ -3448,6 +3448,17 @@ export function RpgEntryHomeView({
) : null}
</>
);
const rewardCodeModal: ReactNode = isRewardCodeOpen ? (
<RewardCodeRedeemModal
value={rewardCodeInput}
isSubmitting={isSubmittingRewardCode}
error={rewardCodeError}
success={rewardCodeSuccess}
onChange={setRewardCodeInput}
onSubmit={submitRewardCode}
onClose={() => setIsRewardCodeOpen(false)}
/>
) : null;
if (!isDesktopLayout) {
return (
@@ -3471,10 +3482,9 @@ export function RpgEntryHomeView({
</div>
<div
className="mt-3 min-w-0 shrink-0 border-t pt-2"
className="platform-mobile-bottom-dock mt-3 min-w-0 shrink-0 border-t pt-2"
style={{
borderColor: 'var(--platform-line-soft)',
paddingBottom: 'calc(env(safe-area-inset-bottom) + 0.2rem)',
}}
>
<div
@@ -3507,6 +3517,7 @@ export function RpgEntryHomeView({
onSubmitRedeem={submitReferralInviteCode}
/>
) : null}
{rewardCodeModal}
{isProfilePlayStatsOpen ? (
<ProfilePlayedWorksModal
stats={profilePlayStats}
@@ -3604,17 +3615,7 @@ export function RpgEntryHomeView({
</div>
</div>
</div>
{isRewardCodeOpen ? (
<RewardCodeRedeemModal
value={rewardCodeInput}
isSubmitting={isSubmittingRewardCode}
error={rewardCodeError}
success={rewardCodeSuccess}
onChange={setRewardCodeInput}
onSubmit={submitRewardCode}
onClose={() => setIsRewardCodeOpen(false)}
/>
) : null}
{rewardCodeModal}
{profilePopupPanel ? (
<ProfileReferralModal
panel={profilePopupPanel}