Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Jan 26, 2025
1 parent 4af88e1 commit 0a69816
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 18 deletions.
11 changes: 7 additions & 4 deletions src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ declare namespace App {

declare const VITE_APP_VERSION: string;

// eslint window checks for custom events
/* eslint-disable */

declare namespace svelteHTML {
interface HTMLAttributes {
'on:submit'?: (event: CustomEvent) => void;
'on:openAddCanister'?: (event: CustomEvent) => void;
'on:addCanister'?: (event: CustomEvent) => void;
onopenAddCanister?: (event: CustomEvent<any>) => void;
onaddCanister?: (event: CustomEvent<any>) => void;
onaddSnsCanister?: (event: CustomEvent<any>) => void;
}
}

/* eslint-enable */
13 changes: 10 additions & 3 deletions src/lib/components/canisters/CanisterEdit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let validConfirm = false;
let saving = false;
const handleSubmit = async ($event: MouseEvent | TouchEvent) => {
const handleSubmit = async ($event: SubmitEvent) => {
$event.preventDefault();
if (!validConfirm || canisterName === undefined || canisterName === '') {
Expand All @@ -38,12 +38,19 @@
$: validConfirm = canisterName !== undefined && canisterName !== '';
</script>

<button on:click|stopPropagation={() => (visible = true)} aria-label="Edit" class="toolbar small">
<button
onclick={($event) => {
$event.stopPropagation();
visible = true;
}}
aria-label="Edit"
class="toolbar small"
>
<IconEdit size="small" />
</button>

<Popover bind:visible center>
<form class="container" on:submit={async ($event) => await handleSubmit($event)}>
<form class="container" onsubmit={handleSubmit}>
<label for="canisterName">Canister name</label>

<input
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/canisters/CanisterId.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
canisterId !== '' &&
$canistersUniqueGroups.find(({ id }: Canister) => id === canisterId) === undefined;
const handleSubmit = async ($event: MouseEvent | TouchEvent) => {
const handleSubmit = async ($event: SubmitEvent) => {
$event.preventDefault();
if (!validConfirm || canisterId === undefined) {
Expand All @@ -34,7 +34,7 @@

<slot />

<form on:submit={async ($event) => await handleSubmit($event)}>
<form onsubmit={handleSubmit}>
<input
bind:value={canisterId}
type="text"
Expand Down
3 changes: 0 additions & 3 deletions src/lib/components/canisters/CanisterName.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
margin: 0;
}
.canister-id {
}
.name {
min-height: 1.2rem;
margin-bottom: 0.15rem;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/core/Back.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<nav>
<button class="toolbar" on:click={async () => await back()} title="Back">
<IconBack slot="icon" />
<IconBack />
<span class="visually-hidden">Back</span>
</button>
</nav>
4 changes: 3 additions & 1 deletion src/lib/components/core/SignIn.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script lang="ts">
import IconInternetComputer from '$lib/components/icons/IconInternetComputer.svelte';
import { signIn } from '@junobuild/core';
const onclick = async () => await signIn();
</script>

<button type="button" on:click={signIn} class="primary">
<button type="button" {onclick} class="primary">
<IconInternetComputer />
Continue with Internet Identity
</button>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/core/Worker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
})();
</script>

<svelte:window on:addCanister={addCanister} on:addSnsCanister={addSnsCanister} />
<svelte:window onaddCanister={addCanister} onaddSnsCanister={addSnsCanister} />

<slot />
2 changes: 1 addition & 1 deletion src/lib/components/overlays/Add.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$: back = step !== 'type';
</script>

<svelte:window on:openAddCanister={() => (open = true)} />
<svelte:window onopenAddCanister={() => (open = true)} />

{#if open}
<Modal on:papyClose={onClose} on:papyBack={onBack} {back}>
Expand Down
7 changes: 5 additions & 2 deletions src/lib/components/ui/Button.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
<script lang="ts">
import type { Component } from 'svelte';
import { nonNullish } from '$lib/utils/utils';
export let display: 'inline' | 'card' = 'card';
export let text: string;
export let icon: Component;
export let icon: Component | undefined = undefined;
export let card = true;
$: card = display === 'card';
</script>

<div class={card ? 'card' : 'inline'}>
<button type="button" class={card ? 'toolbar' : 'primary'} title={text} on:click>
<svelte:component this={icon} slot="icon" />
{#if nonNullish(icon)}
<svelte:component this={icon} slot="icon" />
{/if}
<span class={card ? 'visually-hidden' : ''}>{text}</span>
</button>

Expand Down
2 changes: 2 additions & 0 deletions src/lib/components/ui/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
position: absolute;
inset: 0;
@include overlay.backdrop-button;
@include overlay.backdrop('light');
@include interaction.tappable;
Expand Down

0 comments on commit 0a69816

Please sign in to comment.