Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "weekly"
interval: 'weekly'
3 changes: 3 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-10-27 - Search Input Accessibility
**Learning:** The `@smui/textfield` component relies on `on:keyup` in existing patterns, which misses non-keyboard inputs like paste. Using `on:input` is more robust. Also, `@smui/circular-progress` lacks default accessibility labels.
**Action:** When implementing search or text inputs, prefer `on:input`. Always add `aria-label` to loading indicators.
8 changes: 6 additions & 2 deletions src/components/DomainPayment.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@
<h4>{domainName}</h4>

<div class="years">
<IconButton on:click={() => addYears(-1)} disabled={years === 1 || feesApproved} aria-label="remove-year">
<IconButton
on:click={() => addYears(-1)}
disabled={years === 1 || feesApproved}
aria-label="remove-year"
>
<Icon icon="remove" />
</IconButton>
<span>{years} {yearsLabel}</span>
Expand All @@ -111,7 +115,7 @@
</IconButton>
</div>

<div class="coin">
<div class="coin">
<p class="title text-center">Payment token</p>
<div class="row centered">
<Select bind:value={$selectedCoin} label="Select Token" variant="outlined">
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadingButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
{:else if hasError}
<Icon icon="error" align="right" />
{:else if loading === false}
<Icon icon="done" align="right"/>
<Icon icon="done" align="right" />
{/if}
</Button>

Expand Down
14 changes: 11 additions & 3 deletions src/components/Record.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$: errors = invalid ? validator.getErrors() : [];
$: disabled = !edit;
$: validator = getValidator(klass);
$: maxLength = 'maxLength' in validator.rules ? validator.rules['maxLength'] as number : 64
$: maxLength = 'maxLength' in validator.rules ? (validator.rules['maxLength'] as number) : 64;

let edit = false;

Expand Down Expand Up @@ -99,10 +99,18 @@
</div>
{:else if editMode}
<div class="actions">
<IconButton on:click={() => toggleEdit()} disabled={!$walletConnected} aria-label="edit-record">
<IconButton
on:click={() => toggleEdit()}
disabled={!$walletConnected}
aria-label="edit-record"
>
<Icon icon="edit" />
</IconButton>
<IconButton on:click={() => (dialogOpen = true)} disabled={!$walletConnected} aria-label="delete-record">
<IconButton
on:click={() => (dialogOpen = true)}
disabled={!$walletConnected}
aria-label="delete-record"
>
<Icon icon="delete" />
</IconButton>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export const profileRecords = [
RecordClassEnum.Price
].map((v) => RecordClassEnum[v]);

export const getValidator = (klass: string) => getRecordValidator(getRecordClassFrom(klass))
export const getValidator = (klass: string) => getRecordValidator(getRecordClassFrom(klass));
1 change: 0 additions & 1 deletion src/lib/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ export const getStats = async (): Promise<DomainStats> => {
};
};


export const apiError = (message: string, status = 400) => json({ error: message }, { status });
8 changes: 4 additions & 4 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export interface DomainPaymentParams {
}

export interface DomainFeesResponse {
feesLabel: number
fees: string
symbol: string
address: string
feesLabel: number;
fees: string;
symbol: string;
address: string;
}
9 changes: 4 additions & 5 deletions src/lib/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ export const explorerAddressUrl = (address: string) => {
if (address.startsWith('00'))
// Account
url += `/accounts/${address}/assets`;
else
// Contract
url += `/contracts/${address}`;
// Contract
else url += `/contracts/${address}`;

return url
}
return url;
};

export const bridgeUrl = `${config.browserUrl}/bridge`;

Expand Down
1 change: 0 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,4 @@
align-items: center;
height: 100%;
}

</style>
64 changes: 35 additions & 29 deletions src/routes/DomainSearch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let domainName: string = '';
let nameSearched: string = '';
let isLoading: boolean = false;
let debounceTimer: NodeJS.Timeout;
let debounceTimer: ReturnType<typeof setTimeout>;

$: errors = invalid ? validator.getErrors() : [];
$: invalid = domainName !== '' && !validator.validate(domainName, { raiseError: false });
Expand Down Expand Up @@ -55,7 +55,7 @@
class="domain-input"
variant="outlined"
bind:value={domainName}
on:keyup={() => debounce()}
on:input={() => debounce()}
bind:invalid
label="Domain name"
withTrailingIcon
Expand All @@ -75,39 +75,45 @@
</svelte:fragment>
</Textfield>
</form>
{#if isLoading}
<Card class="domain-link">
<CardContent>
<div class="card-content">
<span>{nameSearchedLabel}</span>

<CircularProgress style="height: 32px; width: 32px;" indeterminate />
</div>
</CardContent>
</Card>
{:else if domain}
<a class="domain-link" href={`/domain/${domain.name}`}>
<Card>
<div role="status" aria-live="polite">
{#if isLoading}
<Card class="domain-link">
<CardContent>
<div class="card-content">
<span>{nameSearchedLabel}</span>
<span class="chip registered">Registered</span>
</div>
</CardContent>
</Card>
</a>
{:else if domain === null}
<a class="domain-link" href={`/register/${nameSearched}`}>
<Card>
<CardContent>
<div class="card-content">
<span>{nameSearchedLabel}</span>
<span class="chip available">Available</span>

<CircularProgress
style="height: 32px; width: 32px;"
indeterminate
aria-label="Loading domain availability"
/>
</div>
</CardContent>
</Card>
</a>
{/if}
{:else if domain}
<a class="domain-link" href={`/domain/${domain.name}`}>
<Card>
<CardContent>
<div class="card-content">
<span>{nameSearchedLabel}</span>
<span class="chip registered">Registered</span>
</div>
</CardContent>
</Card>
</a>
{:else if domain === null}
<a class="domain-link" href={`/register/${nameSearched}`}>
<Card>
<CardContent>
<div class="card-content">
<span>{nameSearchedLabel}</span>
<span class="chip available">Available</span>
</div>
</CardContent>
</Card>
</a>
{/if}
</div>
</div>

<style lang="scss">
Expand Down
19 changes: 11 additions & 8 deletions src/routes/api/register/[name]/fees/[coin]/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import { json } from '@sveltejs/kit';
import type { DomainFeesResponse } from 'src/lib/types';

export async function GET({ params: { name, coin } }) {
return handleError(async () => {
const validCoins = metaNamesSdk.config.byoc.map(byoc => byoc.symbol.toString())
if (!(validCoins.includes(coin))) return apiError('Invalid coin');
return handleError(async () => {
const validCoins = metaNamesSdk.config.byoc.map((byoc) => byoc.symbol.toString());
if (!validCoins.includes(coin)) return apiError('Invalid coin');

const normalizedDomain = metaNamesSdk.domainRepository.domainValidator.normalize(name)
const domainFees = await metaNamesSdk.domainRepository.calculateMintFees(normalizedDomain, coin as BYOCSymbol);
const fees = { ...domainFees, fees: domainFees.fees.toString() }
const normalizedDomain = metaNamesSdk.domainRepository.domainValidator.normalize(name);
const domainFees = await metaNamesSdk.domainRepository.calculateMintFees(
normalizedDomain,
coin as BYOCSymbol
);
const fees = { ...domainFees, fees: domainFees.fees.toString() };

return json(fees);
});
return json(fees);
});
}
1 change: 0 additions & 1 deletion src/routes/profile/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
</div>

<style lang="scss">

.domains {
margin-top: 1.5rem;
margin-bottom: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/styles/mixins.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "sass:string";
@use 'sass:string';

$amounts: (0, 1, 2, 3, 4);
$types: (top, bottom, left, right);
Expand Down
2 changes: 1 addition & 1 deletion src/theme/dark/_smui-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $text-color: #d5ccff;
@use '@material/theme/color-palette';
@use '@material/theme/index' as theme with (
$primary: #6849fe,
$secondary: #D0C7FF,
$secondary: #d0c7ff,
$surface: color.adjust(color-palette.$grey-900, $blue: +4),
$background: #363535,
$error: color-palette.$red-700
Expand Down