refactor(frontend): enhance MobileCallPage layout and button accessibility

Refactor the layout of the MobileCallPage component to improve structure and accessibility. Replace the Button component with a native button element, adding appropriate aria-labels and titles for better screen reader support. Adjust the positioning of elements for a more cohesive user experience.
This commit is contained in:
Eric Wang
2026-08-05 15:15:54 +08:00
parent a9c70effae
commit 545536bdf3
@@ -12,7 +12,6 @@ import {
ScanLine, ScanLine,
Video, Video,
} from "lucide-react"; } from "lucide-react";
import { Button } from "@/components/ui/button";
import { NetworkQualityIndicator } from "@/components/network-quality-indicator"; import { NetworkQualityIndicator } from "@/components/network-quality-indicator";
import { import {
DropdownMenu, DropdownMenu,
@@ -542,12 +541,19 @@ export function MobileCallPage({ assistantId }: { assistantId: string }) {
</div> </div>
{!inCall && ( {!inCall && (
<div className="absolute inset-0 z-[2] flex items-center justify-center px-8"> <>
<div className="flex max-w-sm flex-col items-center text-center"> <div className="absolute inset-0 z-[2] flex items-center justify-center px-8">
<h1 className="text-2xl font-medium leading-tight text-white"> <div className="flex max-w-sm flex-col items-center text-center">
{assistantName || "助手"} <h1 className="text-2xl font-medium leading-tight text-white">
</h1> {assistantName || "助手"}
<div className="relative mt-10 inline-flex"> </h1>
{error && (
<p className="mt-4 text-xs leading-5 text-white/65">{error}</p>
)}
</div>
</div>
<div className="absolute bottom-[max(1.25rem,env(safe-area-inset-bottom))] left-1/2 z-10 flex -translate-x-1/2 flex-col items-center gap-2 landscape:bottom-[max(1rem,env(safe-area-inset-bottom))]">
<div className="relative flex size-14 items-center justify-center min-[380px]:size-16">
<span <span
aria-hidden aria-hidden
className="mobile-call-ripple pointer-events-none absolute inset-0 rounded-full bg-white/35" className="mobile-call-ripple pointer-events-none absolute inset-0 rounded-full bg-white/35"
@@ -556,23 +562,28 @@ export function MobileCallPage({ assistantId }: { assistantId: string }) {
aria-hidden aria-hidden
className="mobile-call-ripple mobile-call-ripple-delay pointer-events-none absolute inset-0 rounded-full bg-white/25" className="mobile-call-ripple mobile-call-ripple-delay pointer-events-none absolute inset-0 rounded-full bg-white/25"
/> />
<Button <button
type="button" type="button"
onClick={() => { onClick={() => {
setView("chat"); setView("chat");
void startCall(); void startCall();
}} }}
className="relative z-10 h-12 gap-2 rounded-full bg-white px-6 text-[#07101a] shadow-[0_0_24px_rgba(255,255,255,0.35)] hover:bg-white/90" aria-label={
status === "failed" || callEnded ? "重新开始通话" : "开始通话"
}
title={
status === "failed" || callEnded ? "重新开始通话" : "开始通话"
}
className="relative z-10 flex size-14 items-center justify-center rounded-full bg-white text-[#07101a] shadow-[0_0_24px_rgba(255,255,255,0.35)] transition-transform hover:scale-105 hover:bg-white/90 active:scale-95 min-[380px]:size-16"
> >
<Phone size={19} /> <Phone className="size-6 min-[380px]:size-7" />
{status === "failed" || callEnded ? "重新开始通话" : "开始通话"} </button>
</Button>
</div> </div>
{error && ( <span className="text-xs text-white/65">
<p className="mt-4 text-xs leading-5 text-white/65">{error}</p> {status === "failed" || callEnded ? "重新开始通话" : "开始通话"}
)} </span>
</div> </div>
</div> </>
)} )}
{inCall && ( {inCall && (