Skip to content

Commit

Permalink
add: showing error in modal
Browse files Browse the repository at this point in the history
  • Loading branch information
LukassF committed Feb 23, 2024
1 parent ae9b42a commit 7cff49a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const Error: Story = (args: NightlyModalArgs) => {

if (!args.sessionId)
setTimeout(() => {
updateArgs({ timeoutError: true })
updateArgs({ timeoutError: 'error' })
}, 5000)

return html`<nightly-desktop-main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class NightlyDesktopMain extends LitElement {
@property({ type: Object })
qrConfigOverride: Partial<XMLOptions> = {}

@property({ type: Boolean })
timeoutError = false
@property({ type: String })
timeoutError = ''

@state()
copyMessage = 'Copy'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export class NightlyMobileQr extends LitElement {
@property({ type: Object })
qrConfigOverride: Partial<XMLOptions> = {}

@property({ type: Boolean })
timeoutError = false
@property({ type: String })
timeoutError = ''

@state()
qrSource: string | undefined = undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const Error: Story = (args: NightlyModalArgs) => {

if (!args.sessionId)
setTimeout(() => {
updateArgs({ timeoutError: true })
updateArgs({ timeoutError: 'error' })
}, 5000)

return open
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export class NightlySelector extends LitElement {
@property({ type: Object })
qrConfigOverride: Partial<XMLOptions> = {}

@property({ type: Boolean })
timeoutError = false
@property({ type: String })
timeoutError = ''

// state

Expand Down
4 changes: 4 additions & 0 deletions sdk/packages/selector-base/src/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export class NightlyConnectSelectorModal {
if (this._modal && id) this._modal.sessionId = id
}

set timeoutError(error: string) {
if (this._modal && error) this._modal.timeoutError = error
}

createSelectorElement = (
variablesOverride?: object,
stylesOverride?: string,
Expand Down
4 changes: 2 additions & 2 deletions sdk/packages/selector-polkadot/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class NightlyConnectAdapter implements Injected {
)
if (!adapter._connectionOptions.disableModal) {
adapter._modal = new NightlyConnectSelectorModal(
adapter.walletsList as IWalletListItem[],
adapter.walletsList,
appInitData.url ?? 'https://nc2.nightly.app',
networkToData(adapter.network),
anchorRef,
Expand Down Expand Up @@ -553,7 +553,7 @@ export class NightlyConnectAdapter implements Injected {
if (checks > 500) {
clearInterval(loadingInterval)
// reject(new Error('Connecting takes too long'))
// TODO we need to have a way to show error on modal
if (this._modal) this._modal.timeoutError = 'Connecting is taking too long'
}
}, 10)
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/packages/selector-solana/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ export class NightlyConnectAdapter extends BaseMessageSignerWalletAdapter {
if (checks > 500) {
clearInterval(loadingInterval)
// reject(new Error('Connecting takes too long'))
// TODO we need to have a way to show error on modal
if (this._modal) this._modal.timeoutError = 'Connecting is taking too long'
}
}, 10)
}
Expand Down

0 comments on commit 7cff49a

Please sign in to comment.