Revert "fix: hide download URL in in-app browser guide"
All checks were successful
Deploy Staging (terry-wallet-login) / deploy (push) Successful in 1m18s
All checks were successful
Deploy Staging (terry-wallet-login) / deploy (push) Successful in 1m18s
This reverts commit 3275aff121.
This commit is contained in:
@@ -47,13 +47,13 @@ export function InAppDownloadGuideProvider({
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const { showToast } = useToast();
|
||||
const [open, setOpen] = useState(false);
|
||||
const [detail, setDetail] = useState<InAppDownloadGuideDetail | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const onShow = (event: Event) => {
|
||||
const ce = event as CustomEvent<InAppDownloadGuideDetail>;
|
||||
if (!ce.detail) return;
|
||||
setOpen(true);
|
||||
setDetail(ce.detail);
|
||||
};
|
||||
window.addEventListener(IN_APP_DOWNLOAD_GUIDE_EVENT, onShow);
|
||||
return () =>
|
||||
@@ -61,19 +61,19 @@ export function InAppDownloadGuideProvider({
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
if (!detail) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === "Escape") setOpen(false);
|
||||
if (event.key === "Escape") setDetail(null);
|
||||
};
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [open]);
|
||||
}, [detail]);
|
||||
|
||||
const close = () => setOpen(false);
|
||||
const close = () => setDetail(null);
|
||||
|
||||
const handleCopyPageLink = async () => {
|
||||
if (typeof window === "undefined") return;
|
||||
const ok = await copyTextToClipboard(window.location.href);
|
||||
const handleCopy = async () => {
|
||||
if (!detail) return;
|
||||
const ok = await copyTextToClipboard(detail.url);
|
||||
if (ok) {
|
||||
showToast(t("inAppDownloadCopied"));
|
||||
} else {
|
||||
@@ -89,7 +89,7 @@ export function InAppDownloadGuideProvider({
|
||||
return (
|
||||
<>
|
||||
{children}
|
||||
{open
|
||||
{detail
|
||||
? createPortal(
|
||||
<div
|
||||
role="dialog"
|
||||
@@ -154,13 +154,19 @@ export function InAppDownloadGuideProvider({
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<div className="rounded-2xl border border-white/10 bg-black/30 p-3">
|
||||
<p className="break-all text-xs leading-5 text-neutral-300">
|
||||
{detail.url}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopyPageLink}
|
||||
onClick={handleCopy}
|
||||
className="flex h-11 w-full items-center justify-center gap-2 rounded-full bg-ark-gold px-4 text-sm font-semibold text-black transition hover:bg-ark-gold2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ark-gold/80 focus-visible:ring-offset-2 focus-visible:ring-offset-[#1c1c21]"
|
||||
>
|
||||
<Copy className="h-4 w-4" />
|
||||
{t("inAppDownloadCopyPageLink")}
|
||||
{t("copyLink")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user