Skip to content

Commit

Permalink
very rudimentary initial post thing! wahoo
Browse files Browse the repository at this point in the history
  • Loading branch information
eblu3 committed Dec 6, 2024
1 parent ac3784e commit 9004605
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 9 deletions.
1 change: 1 addition & 0 deletions home/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h1>Home</h1>
<main id="timeline">
<div id="post-input-container">
<textarea id="post-input" placeholder="What's up?"></textarea>
<button id="post-button">Post!</button>
</div>
</main>
<button id="load-more-button">Load more</button>
Expand Down
10 changes: 9 additions & 1 deletion js/homepage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/homepage.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions js/homepage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { setTimeline, Timelines, renderTimeline } from "./masto_ts.js";
import { setTimeline, Timelines, renderTimeline, postStatus, renderStatus } from "./masto_ts.js";

const postInput: HTMLElement = document.getElementById("post-input");
const postInput: HTMLTextAreaElement = (document.getElementById("post-input") as HTMLTextAreaElement);
const postButton: HTMLButtonElement = (document.getElementById("post-button") as HTMLButtonElement);

document.getElementById("load-more-button").addEventListener("click", () => {
renderTimeline();
Expand All @@ -13,6 +14,15 @@ postInput.addEventListener("input", (event) => {
(event.target as HTMLInputElement).style.height = `${(event.target as HTMLInputElement).scrollHeight}px`;
});

postButton.addEventListener("click", (event) => {
postStatus(postInput.value).then((status) => {
postInput.value = "";

const timeline = document.getElementById("timeline");
timeline.insertBefore(renderStatus(status),timeline.getElementsByTagName("article")[0]);
});
});

setTimeline(Timelines.Home);

renderTimeline();
Expand Down
29 changes: 27 additions & 2 deletions js/masto_ts.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9004605

Please sign in to comment.