Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
sameoldlab committed Jul 31, 2024
1 parent 92b8750 commit 5573362
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
25 changes: 16 additions & 9 deletions packages/ui/src/components/ConnectModal/ConnectModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
import copyEN from '../../copy/copy.EN.js'
import Modal from '../Common/Modal.svelte'
import Scannable from './Scannable.svelte'
import type { ConfigConnected, ConfigDisconnected, Connector, StateConnected, StateDisconnected } from '@fractl-ui/types'
import type { Readable} from 'svelte/store'
export let config: ConfigDisconnected
import type {
ConfigConnected,
ConfigDisconnected,
Connector,
StateDisconnected
} from '@fractl-ui/types'
import type { Readable } from 'svelte/store'
export let config: ConfigDisconnected<Connector>
export let state: Readable<StateDisconnected<Connector>>
export let btnClass = ''
export let triggerText = 'Connect Wallet'
export let onConnect: (status: StateConnected<Connector>) => void
export let onConnect: (fractl: ConfigConnected<Connector>) => void
export let onConnectFail: (error: Error) => void
let open: () => void
Expand All @@ -22,8 +27,10 @@
// export let accountStatus: string
// export let chainStatus
// export let showBalance: string
onMount(()=> open())
onDestroy(()=>{close()})
onMount(() => open())
onDestroy(() => {
close()
})
$: if ($state.status === 'connected') close()
let activeRequest: Connector | null = null //config.connectors[3]
Expand All @@ -36,7 +43,7 @@
// console.debug('config.state: ', $state.status)
activeRequest = connector
await config.connect(connector)
onConnect({config, accountData: config.accountData})
onConnect(config)
} catch (error) {
onConnectFail(error)
// console.error('caught: ', error)
Expand Down Expand Up @@ -151,8 +158,8 @@
{/if}
</div>
</Modal>
<style>

<style>
.hide {
display: none;
opacity: 0;
Expand Down
10 changes: 6 additions & 4 deletions packages/ui/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import AccountModal from './AccountModal.svelte'
import FractlModal from './FractlModal.svelte'
import type { Config, Connector, StateConnected } from '@fractl-ui/types'

export const create = async <C extends Connector>(config: Promise<Config<C>>) => {
let _config = await Promise.resolve(config)
export const create = async <C extends Connector>(
config: Promise<Config<C>>
) => {
const _config = await Promise.resolve(config)

//TODO: return singleton when modal is dismissed without completing connection
return () => {
const getTarget = () => document.body
const getTarget = () => document.body

return new Promise((resolve, reject) => {
const modal = new ConnectModal({
target: getTarget(),
Expand Down

0 comments on commit 5573362

Please sign in to comment.