diff --git a/src/app.html b/src/app.html index 0e1dc1a..be31b43 100644 --- a/src/app.html +++ b/src/app.html @@ -1,15 +1,13 @@ - + + + + + + %sveltekit.head% + - - - - - %sveltekit.head% - - - -
%sveltekit.body%
- - - \ No newline at end of file + +
%sveltekit.body%
+ + diff --git a/src/components/callsign-checker.svelte b/src/components/callsign-checker.svelte new file mode 100644 index 0000000..6a5fc09 --- /dev/null +++ b/src/components/callsign-checker.svelte @@ -0,0 +1,115 @@ + + +
+ +
+ +{#if rawDxcc?.matchLength === callsign.length && rawDxcc.isExact} +
+ +
+{:else if callsignData} + {@const { secondaryPrefix, fullDxcc, basePrefix, baseDxcc, secondarySuffixes } = callsignData} +
+ {#if secondaryPrefix && fullDxcc} +
+ +
+ {/if} + {#if baseDxcc && basePrefix} +
+ +
+ {/if} + {#if secondarySuffixes.length > 0} +
+ {#each secondarySuffixes as suffix} +
+
+
{suffix}
+
{getSecondarySuffixDescription(suffix)}
+
+
+ {/each} +
+ {/if} +
+{:else if rawDxcc} +
+ +
+{/if} + + diff --git a/src/routes/dxcc-entity-info.svelte b/src/components/dxcc-entity-info.svelte similarity index 100% rename from src/routes/dxcc-entity-info.svelte rename to src/components/dxcc-entity-info.svelte diff --git a/src/components/callsign-input.svelte b/src/components/styled-input.svelte similarity index 89% rename from src/components/callsign-input.svelte rename to src/components/styled-input.svelte index 1cb3695..76429dd 100644 --- a/src/components/callsign-input.svelte +++ b/src/components/styled-input.svelte @@ -2,6 +2,8 @@ import { onMount } from 'svelte'; export let inputText = ''; + export let inputRe: RegExp = /.*/; + let selectionStart: number | null = inputText.length; let selectionEnd: number | null = inputText.length; @@ -17,8 +19,12 @@ }); +
{ const t = e.currentTarget; @@ -27,7 +33,7 @@ }} on:input={(e) => { const t = e.currentTarget; - if (/^[A-Z\d/]*$/i.test(t.value)) { + if (inputRe.test(t.value)) { inputText = t.value.toUpperCase(); } else { // Users enter the not supported characters diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 4718974..417f8e5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -4,13 +4,16 @@ Callsign Checker - - + + - +
diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index 89da957..b73f636 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -1,2 +1,2 @@ -export const ssr = false; +export const ssr = true; export const prerender = true; diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index d9269c9..928b42b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,119 +1,9 @@

Callsign Checker

-
-
Enter a callsign
- -
- - {#if rawDxcc?.matchLength === callsign.length && rawDxcc.isExact} -
- -
- {:else if callsignData} - {@const { secondaryPrefix, fullDxcc, basePrefix, baseDxcc, secondarySuffixes } = callsignData} -
- {#if secondaryPrefix && fullDxcc} -
- -
- {/if} - {#if baseDxcc && basePrefix} -
- -
- {/if} - {#if secondarySuffixes.length > 0} -
- {#each secondarySuffixes as suffix} -
-
-
{suffix}
-
{getSecondarySuffixDescription(suffix)}
-
-
- {/each} -
- {/if} -
- {:else if rawDxcc} -
- -
- {/if} +
- - diff --git a/svelte.config.js b/svelte.config.js index 8667683..be16a09 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -12,7 +12,7 @@ const config = { // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://kit.svelte.dev/docs/adapters for more information about adapters. adapter: adapter({ - fallback: 'index.html' + strict: false }) } };