Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
chebizarro committed Nov 2, 2024
1 parent 2fe8058 commit f98dd23
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 41 deletions.
2 changes: 0 additions & 2 deletions src/components/BitcoinConnectElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,4 @@ export class BitcoinConnectElement extends InternalElement {
this._modalOpen = currentState.modalOpen;
});
}


}
14 changes: 1 addition & 13 deletions src/components/bc-currency-switcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CurrencySwitcher extends withTwind()(BitcoinConnectElement) {

override render() {
if (!this._isSwitchingCurrency) {
return html`<div class="flex justify-center items-center gap-2">
return html`<div class="flex justify-center items-center gap-2">
<div
class="${classes.interactive}"
role="button"
Expand Down Expand Up @@ -103,23 +103,11 @@ export class CurrencySwitcher extends withTwind()(BitcoinConnectElement) {

private _showSelectVisibility() {
this._isSwitchingCurrency = true;
// Focus the first currency option when switching is enabled
setTimeout(() => {
const firstCurrencyOption = this.shadowRoot?.querySelector(
'[role="option"]'
) as HTMLElement;
firstCurrencyOption?.focus();
}, 0);
}

private _selectCurrency(selectedCurrency: string) {
store.getState().setCurrency(selectedCurrency);
this._isSwitchingCurrency = false;
// Ensure focus returns to the triggering button
const triggerButton = this.shadowRoot?.querySelector(
'[role="button"]'
) as HTMLElement;
triggerButton?.focus();
}

// Handle keydown events for currency selection
Expand Down
10 changes: 0 additions & 10 deletions src/components/bc-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ import {closeModal} from '../api';

@customElement('bc-modal')
export class Modal extends withTwind()(BitcoinConnectElement) {
private _focusTrapElement: HTMLSlotElement | null | undefined;

override firstUpdated() {
this._focusTrapElement = this.shadowRoot?.querySelector('slot');
window.addEventListener('keydown', this._handleKeydown);
}

override disconnectedCallback() {
window.removeEventListener('keydown', this._handleKeydown);
}

override render() {
return html`<div
Expand Down
7 changes: 4 additions & 3 deletions src/components/connectors/ConnectorElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ export abstract class ConnectorElement extends withTwind()(
class="flex flex-col justify-between items-center w-32 -mx-4 cursor-pointer ${classes.interactive}"
role="button"
tabindex="0"
@click=${this._onClick} @keydown=${this._handleKeydown}
@click=${this._onClick}
@keydown=${this._handleKeydown}
aria-label="Connect to ${this._title}"
aria-pressed="${this._connected ? 'true' : 'false'}"
aria-busy="${this._connecting ? 'true' : 'false'}"
>
>
<div
class="w-16 h-16 drop-shadow rounded-2xl flex justify-center items-center overflow-hidden"
style="background: ${this._background};"
Expand All @@ -57,7 +58,7 @@ export abstract class ConnectorElement extends withTwind()(
public _handleKeydown(event: KeyboardEvent) {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault();
this._onClick(); // Simulate click when Enter or Space is pressed
this._onClick();
}
}

Expand Down
8 changes: 1 addition & 7 deletions src/components/flows/bc-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../bc-router-outlet';
import {classes} from '../css/classes';
import store from '../../state/store';
import {PaymentMethods} from '../../types/PaymentMethods';
import "./bc-connect";
import './bc-connect';

@customElement('bc-payment')
export class SendPaymentFlow extends withTwind()(BitcoinConnectElement) {
Expand Down Expand Up @@ -68,7 +68,6 @@ export class SendPaymentFlow extends withTwind()(BitcoinConnectElement) {
override render() {
return this._showConnect && !this.paid
? html`
<!-- Render the connect component -->
<bc-connect
?closable=${true}
role="dialog"
Expand All @@ -83,7 +82,6 @@ export class SendPaymentFlow extends withTwind()(BitcoinConnectElement) {
aria-labelledby="payment-modal-header"
aria-describedby="${this._error ? 'payment-error-message' : ''}"
>
<!-- Modal header -->
<bc-modal-header
id="payment-modal-header"
class="flex w-full"
Expand All @@ -95,8 +93,6 @@ export class SendPaymentFlow extends withTwind()(BitcoinConnectElement) {
Payment Request
</p>
</bc-modal-header>
<!-- Payment Section -->
<div class="flex flex-col justify-center items-center w-full pt-8">
<bc-send-payment
.invoice=${this.invoice}
Expand All @@ -105,8 +101,6 @@ export class SendPaymentFlow extends withTwind()(BitcoinConnectElement) {
@onclickconnectwallet=${this._onClickConnectWallet}
></bc-send-payment>
</div>
<!-- Error message -->
${this._error
? html`<p
id="payment-error-message"
Expand Down
4 changes: 0 additions & 4 deletions src/components/internal/InternalElement.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import {LitElement, PropertyValues, css} from 'lit';
import { property } from 'lit/decorators.js';

export class InternalElement extends LitElement {

@property({type: Boolean}) focusable = true;

static override styles = [
css`
:host {
Expand Down Expand Up @@ -50,7 +47,6 @@ export class InternalElement extends LitElement {
}
}
}


// TODO: move, only needed by the button?
protected _getBrandColorLuminance() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/pages/bc-send-payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export class SendPayment extends withTwind()(BitcoinConnectElement) {
private renderConnectWalletDesktop() {
let internalMethods = null;
if (this.paymentMethods === 'all' || this.paymentMethods === 'internal') {
internalMethods = html`
internalMethods = html`
<div class="${this.paymentMethods !== 'internal' ? 'mt-8' : ''}">
<bci-button variant="primary" @click=${this._onClickConnectWallet} aria-label="Connect wallet to pay">
<span class="-ml-0.5">${bcIcon}</span>
Expand All @@ -181,7 +181,7 @@ export class SendPayment extends withTwind()(BitcoinConnectElement) {

let externalMethods = null;
if (this.paymentMethods === 'all' || this.paymentMethods === 'external') {
externalMethods = html`
externalMethods = html`
<div
class="flex flex-col items-center ${this.paymentMethods === 'external'
? 'mt-8'
Expand Down

0 comments on commit f98dd23

Please sign in to comment.