Compare commits

..

No commits in common. "ef9f12d0fd159f2be9f0b122efcef92a2af4a354" and "a8c460e742c8a9f4710bc6dc3eb62e0730775196" have entirely different histories.

4 changed files with 15 additions and 43 deletions

View file

@ -90,6 +90,7 @@ export class Client {
}
const user = await api.parseUser(data);
console.log(`Logged in as @${user.username}@${user.host}`);
console.log(`You have ${data.source.follow_request_count} follow request${data.source.follow_request_count === 1 ? '' : 's'}!`);
return user;
}

View file

@ -7,7 +7,6 @@
import { getTimeline } from '$lib/timeline.js';
import { goto } from '$app/navigation';
import { get } from 'svelte/store';
import { onMount } from 'svelte';
import TimelineIcon from '../../img/icons/timeline.svg';
import NotificationsIcon from '../../img/icons/notifications.svg';
@ -21,33 +20,21 @@
import SettingsIcon from '../../img/icons/settings.svg';
import LogoutIcon from '../../img/icons/logout.svg';
export let path;
const VERSION = APP_VERSION;
let notification_count = 0;
if (notification_count > 99) notification_count = "99+";
function handle_btn(name) {
let route;
switch (name) {
case "timeline":
route = "/";
break;
case "notifcations":
case "explore":
case "lists":
case "favourites":
case "bookmarks":
case "hashtags":
return;
}
if (!route) return;
function goTimeline() {
if (location.pathname === "/") {
getTimeline(true);
window.scrollTo({
top: 0,
behavior: "smooth"
});
goto(route);
return;
}
goto("/");
}
async function log_out() {
@ -65,18 +52,13 @@
</header>
<div id="nav-items">
<Button label="Timeline"
on:click={handle_btn("timeline")}
active={path == "/"}>
<Button label="Timeline" on:click={() => goTimeline()} active={!!$client.user}>
<svelte:fragment slot="icon">
<TimelineIcon/>
</svelte:fragment>
Timeline
</Button>
<Button label="Notifications"
on:click={handle_btn("notifications")}
active={path == "/notifications"}
disabled>
<Button label="Notifications" disabled>
<svelte:fragment slot="icon">
<NotificationsIcon/>
</svelte:fragment>

View file

@ -5,16 +5,12 @@
import { client, Client } from '$lib/client/client.js';
import { get } from 'svelte/store';
export let data;
$: path = data.path || "/";
let ready = new Promise(resolve => {
if (get(client)) {
return resolve();
}
let new_client = new Client();
new_client.load();
client.set(new_client);
return new_client.getClientUser().then(user => {
if (!user) {
@ -22,11 +18,8 @@
return resolve();
}
new_client.user = user;
window.peekie = new_client;
client.update(client => {
client.user = user;
return client;
});
client.set(new_client);
client.user
return resolve();
});
});
@ -35,7 +28,7 @@
<div id="app">
<header>
<Navigation path={path} />
<Navigation />
</header>
<main>

View file

@ -1,6 +1,2 @@
export const prerender = true;
export const ssr = false;
export async function load({ url }) {
return { path: url.pathname };
}