diff --git a/chat/index.html b/chat/index.html index 6f89d7c..d71ba19 100644 --- a/chat/index.html +++ b/chat/index.html @@ -3,7 +3,7 @@ - + Vite + Solid + TS diff --git a/chat/public/logo-04.svg b/chat/public/logo-04.svg new file mode 100644 index 0000000..c9d8394 --- /dev/null +++ b/chat/public/logo-04.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/chat/public/vite.svg b/chat/public/vite.svg deleted file mode 100644 index e7b8dfb..0000000 --- a/chat/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/chat/src/context.tsx b/chat/src/context.tsx index b4d62bf..9f4abcc 100644 --- a/chat/src/context.tsx +++ b/chat/src/context.tsx @@ -11,6 +11,17 @@ import { ChatMessage } from "./routes/Chat"; const [name, setName] = createSignal( localStorage.getItem("name") ); + +createEffect(() => { + const value = name(); + if (value === null) { + localStorage.removeItem("name"); + return; + } + + localStorage.setItem("name", value); +}); + const [socket, setSocket] = createSignal(); // Not sure if using a map is better const messagesByUser = new Map>(); diff --git a/chat/src/routes/SetUp.tsx b/chat/src/routes/SetUp.tsx index e185869..0672d48 100644 --- a/chat/src/routes/SetUp.tsx +++ b/chat/src/routes/SetUp.tsx @@ -20,11 +20,13 @@ function Alert() {
-

Attention needed

+

+ Don't share sensitive information +

- Lorem ipsum dolor sit amet consectetur adipisicing elit. Aliquid - pariatur, ipsum similique veniam quo totam eius aperiam dolorum. + Anyone using the same name as you can view your messages. Although + they are not permanently stored.

@@ -40,7 +42,6 @@ export default function SetUp() { // @ts-ignore Access form element called "name" and get the value. TS doesn't know about the DOM structure. const name = event.target.name.value; setName(name); - localStorage.setItem("name", name); } const navigate = useNavigate(); @@ -50,46 +51,49 @@ export default function SetUp() { }); return ( -
-
- {/* TODO use melt logo */} - Melt logo -
+ <> + +
+
+ {/* TODO use melt logo */} + Melt logo showing melting orange goop +
-
-
-
- -
- +
+ +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
+ ); }