diff --git a/src/lib/timeline.js b/src/lib/timeline.js
index 68aa2b2..179f0a4 100644
--- a/src/lib/timeline.js
+++ b/src/lib/timeline.js
@@ -71,3 +71,8 @@ export async function getTimeline(timelineType = "home", clean, localOnly = fals
}
loading = false;
}
+
+export function clearTimeline() {
+ timeline.set([]);
+ last_post = false;
+}
\ No newline at end of file
diff --git a/src/lib/ui/timeline/Timeline.svelte b/src/lib/ui/timeline/Timeline.svelte
new file mode 100644
index 0000000..1053fef
--- /dev/null
+++ b/src/lib/ui/timeline/Timeline.svelte
@@ -0,0 +1,78 @@
+
+
+ {#if $timeline.length <= 0}
+
+ {lang.string('timeline.fetching')}
+
+ {/if}
+ {#each $timeline as post}
+
+ {/each}
+
+
+
+
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 3375ab4..5cae86d 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -9,6 +9,7 @@
import Button from '$lib/ui/Button.svelte';
import Post from '$lib/ui/post/Post.svelte';
import PageHeader from '../lib/ui/core/PageHeader.svelte';
+ import Timeline from '../lib/ui/timeline/Timeline.svelte';
const lang = Lang();
@@ -24,40 +25,7 @@
// set in localStorage
localStorage.setItem(app_name + '_selected_timeline', timelineType);
-
- // erase the timeline here so the ui reacts instantly
- // mae: i could write an awesome undertale reference here
- timeline.set([]);
-
- getCurrentTimeline()
}
-
- function getCurrentTimeline(clean = false) {
- switch(timelineType) {
- case "home":
- getTimeline("home", clean);
- break;
-
- case "local":
- getTimeline("public", clean, true)
- break;
-
- case "federated":
- getTimeline("public", clean, false, true)
- break;
- }
- }
-
- account.subscribe(account => {
- if (account) getCurrentTimeline();
- });
-
- document.addEventListener('scroll', () => {
- if ($account && $page.url.pathname !== "/") return;
- if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 2048) {
- getCurrentTimeline();
- }
- });
{#if $account}
@@ -79,24 +47,12 @@
-
- {#if $timeline.length <= 0}
-
- {lang.string('timeline.fetching')}
-
- {/if}
- {#each $timeline as post}
-
- {/each}
-
+
{:else}
{/if}