Skip to content

Commit

Permalink
refacterz
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg committed Nov 14, 2024
1 parent 6b365a4 commit 15347f4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/bits/src/bits.challengePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,21 @@ export function initModule(opts: ChallengeOpts): void {
if (isTouchDevice() && typeof navigator.share === 'function') {
const inviteUrl = document.querySelector<HTMLElement>('.invite__url');
if (!inviteUrl) return;
inviteUrl.classList.add('none');

const instructions = document.querySelector<HTMLElement>(`.mobile-instructions`)!;
instructions.classList.remove('none');
inviteUrl.classList.add('none');
instructions.closest<HTMLElement>('.details-wrapper')!.onclick = () =>
if (isIOS()) instructions.classList.add('is-ios');

const details = instructions.closest<HTMLElement>('.details-wrapper')!;
details.role = 'button';
details.onclick = () =>
navigator
.share({
title: `Fancy a game of chess?`,
url: inviteUrl.querySelector<HTMLInputElement>('input')?.value,
})
.catch(() => {});
if (isIOS()) instructions.classList.add('is-ios');
}
}

Expand Down

0 comments on commit 15347f4

Please sign in to comment.