diff --git a/public/diagonal-stripes.svg b/public/diagonal-stripes.svg
new file mode 100644
index 0000000..1237279
--- /dev/null
+++ b/public/diagonal-stripes.svg
@@ -0,0 +1,5 @@
+
diff --git a/src/App.tsx b/src/App.tsx
index a4a4d9f..ced7b8f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,6 +1,7 @@
import { createEffect, createSignal, For } from "solid-js";
import UrlForm from "./components/UrlForm";
import UrlItem from "./components/UrlItem";
+import transition from "./transition";
const URI_LIST = "text/uri-list";
@@ -53,13 +54,15 @@ export default function App() {
function handleUrlSubmit(url: URL) {
console.debug("Submitted url", url);
//TODO use map to deduplicate and reduce garbage
- setUrls((urls) => {
- const index = urls.findIndex((otherUrl) => otherUrl.href === url.href);
+ transition(() => {
+ setUrls((urls) => {
+ const index = urls.findIndex((otherUrl) => otherUrl.href === url.href);
- console.debug("Found url", index);
- if (index !== -1) return urls;
+ console.debug("Found url", index);
+ if (index !== -1) return urls;
- return [...urls, url];
+ return [...urls, url];
+ });
});
}
@@ -73,7 +76,7 @@ export default function App() {
Add Destination
Destinations
-
+
{(url) => (
-
diff --git a/src/components/UrlForm.tsx b/src/components/UrlForm.tsx
index 4420bbf..45719b2 100644
--- a/src/components/UrlForm.tsx
+++ b/src/components/UrlForm.tsx
@@ -37,9 +37,15 @@ export default function UrlForm({ onSubmit }: UrlFormProperties) {
if (!(input instanceof HTMLInputElement))
throw new Error("Expected form to have url input");
+ console.debug("submitted", input.value);
const url = URL.parse(input.value);
if (url === null) {
input.setCustomValidity("Invalid url. Url is not parsable.");
+ input.reportValidity();
+ // Reset on next input
+ input.addEventListener("input", () => input.setCustomValidity(""), {
+ once: true,
+ });
return;
}
@@ -57,7 +63,9 @@ export default function UrlForm({ onSubmit }: UrlFormProperties) {