campfire/src/routes/+page.svelte

61 lines
1.3 KiB
Svelte
Raw Normal View History

<script>
import { page } from '$app/stores';
import { get } from 'svelte/store';
import { client } from '$lib/client/client.js';
import { timeline, getTimeline } from '$lib/timeline.js';
import LoginForm from '$lib/ui/LoginForm.svelte';
2024-06-29 10:46:27 +01:00
import Feed from '$lib/ui/Feed.svelte';
import User from '$lib/user/user.js';
2024-06-29 10:46:27 +01:00
import Button from '$lib/ui/Button.svelte';
getTimeline();
document.addEventListener("scroll", event => {
if (get(page).url.pathname !== "/") return;
if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 2048) {
getTimeline();
}
});
</script>
{#if $client.user}
<Feed posts={$timeline} />
{:else}
<LoginForm />
2024-06-29 17:27:46 +01:00
{/if}
<style>
a {
color: var(--accent);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
2024-06-29 17:27:46 +01:00
header {
width: 100%;
margin: 16px 0 8px 0;
display: flex;
flex-direction: row;
}
2024-06-29 17:27:46 +01:00
header h1 {
font-size: 1.5em;
}
2024-06-29 17:27:46 +01:00
header nav {
margin-left: auto;
display: flex;
flex-direction: row;
gap: 8px;
}
2024-06-30 17:37:19 +01:00
:global(.app-logo) {
height: auto;
width: 320px;
margin: 8px;
}
</style>