Skip to content

Commit

Permalink
instructions work
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanireland committed May 20, 2024
1 parent e57c5ea commit d654ae3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 5 deletions.
50 changes: 49 additions & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"casper-js-sdk": "^2.15.5",
"express": "^4.19.2",
"greenlock-express": "^4.0.3",
"prismjs": "^1.29.0"
"prismjs": "^1.29.0",
"react-device-detect": "^2.2.3"
},
"scripts": {
"start": "react-app-rewired start",
Expand Down
11 changes: 8 additions & 3 deletions client/src/components/Instructions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useClickRef } from '@make-software/csprclick-ui';
import { Dispatch, SetStateAction, useContext } from 'react';
import { ActiveAccountContext, StyledContentContainer } from '../App';
import { claim } from '../apiClient';
import { isMobile } from 'react-device-detect';

const StyledStepContainer = styled.div(({ theme }) =>
theme.withMedia({
Expand Down Expand Up @@ -43,10 +44,14 @@ export default function Instructions(props: InstructionsProps) {

async function connectWallet() {
if (!(await clickRef?.isProviderPresent('casper-wallet'))) {
alert('Please visit this website from the browser in the Casper Wallet app to sign in.');
return;
if (isMobile || 'ontouchstart' in document.documentElement) {
window.location.href = 'casperwallet://download?browse=casper.dariodesiena.com&click=connect';
} else {
await clickRef?.signIn();
}
} else {
await clickRef?.connect('casper-wallet');
}
console.log(await clickRef?.connect('casper-wallet'));
}

function openCasperWalletInstall() {
Expand Down

0 comments on commit d654ae3

Please sign in to comment.