Skip to content

Commit 7fafd24

Browse files
v0.0.11
1 parent d503556 commit 7fafd24

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Version History
44

5+
### v0.0.11
6+
7+
- Added a fix for the "Mixed content" error from the quotable API. Changed it to
8+
The Quotes Hub.
9+
- Added extra interactions for for the gibberish chat.
10+
511
### v0.0.10
612

713
- Added the `<GibberishChat/>` island.

islands/GibberishChat.tsx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,35 @@ export default function () {
8181
))}
8282
</div>
8383
<div class="p-1-2 bg-base-200">
84-
<div class="join">
84+
<form
85+
class="join"
86+
onSubmit={(ev) => {
87+
ev.preventDefault();
88+
const input = document
89+
.getElementById("gibberish-input") as HTMLInputElement;
90+
91+
setMessages([{
92+
user: 2,
93+
content: input.value,
94+
}, ...messages]);
95+
96+
input.value = "";
97+
}}
98+
>
8599
<input
86100
id="gibberish-input"
87101
class="join-item input input-sm"
88102
type="text"
103+
tabindex={0}
89104
/>
90105
<button
91-
type="button"
106+
type="submit"
92107
class="join-item btn btn-sm"
93-
onClick={() =>
94-
setMessages([{
95-
user: 2,
96-
content: (document.getElementById(
97-
"gibberish-input",
98-
) as HTMLInputElement).value,
99-
}, ...messages])}
108+
tabindex={0}
100109
>
101110
Send
102111
</button>
103-
</div>
112+
</form>
104113
</div>
105114
</div>
106115
);

islands/RandomQuote.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { useState } from "preact/hooks";
22
import { handleKeyboard, Key } from "@carcajada/teclas";
33

4-
const quotableUrl = "http://api.quotable.io/random";
4+
const quoteUrl = "https://thequoteshub.com/api/random-quote";
55

66
async function fetchQuote() {
7-
const res = await (await fetch(quotableUrl))
7+
const res = await (await fetch(quoteUrl))
88
.json();
9-
return `${res.content} - ${res.author}`;
9+
console.log(res);
10+
return `${res.text} - ${res.author}`;
1011
}
1112

1213
export default function () {
@@ -20,9 +21,9 @@ export default function () {
2021
<h2 class="mb-1-4">Random quote generator</h2>
2122
<p class="mb-1-1">
2223
This feed is brought to you by the{" "}
23-
<a href="quotable.io">Quotable</a> public API of random quotes:{" "}
24-
<code>{quotableUrl}</code> click on quotes or press the{" "}
25-
<kbd class="kbd">Enter</kbd>{" "}
24+
<a href="https://thequoteshub.com">The Quotes Hub</a>{" "}
25+
public API of random quotes: <code>/api/random-quote</code>{" "}
26+
click on a quote or press the <kbd class="kbd">Enter</kbd>{" "}
2627
key when focusing on a quote to remove it.
2728
</p>
2829
</div>

0 commit comments

Comments
 (0)