2024-06-28 06:19:00 +01:00
|
|
|
<script>
|
2024-07-05 14:47:17 +01:00
|
|
|
import * as api from '$lib/api.js';
|
2024-07-07 14:58:59 +01:00
|
|
|
import { account } from '$lib/stores/account.js';
|
2024-07-05 14:47:17 +01:00
|
|
|
import { server } from '$lib/client/server.js';
|
|
|
|
import { app } from '$lib/client/app.js';
|
2024-07-08 11:56:26 +01:00
|
|
|
import { playSound } from '$lib/sound.js';
|
2024-06-29 16:19:34 +01:00
|
|
|
import { goto } from '$app/navigation';
|
2024-07-02 19:38:20 +01:00
|
|
|
import { page } from '$app/stores';
|
2025-07-14 17:42:20 +01:00
|
|
|
import { createEventDispatcher, onMount } from 'svelte';
|
2025-07-14 04:10:16 +01:00
|
|
|
import { unread_notif_count } from '$lib/notifications.js';
|
2025-07-14 17:42:20 +01:00
|
|
|
import { fetchFollowRequests, followRequests } from '$lib/followRequests.js'
|
2025-07-13 18:49:49 +01:00
|
|
|
import Lang from '$lib/lang';
|
2024-06-28 06:19:00 +01:00
|
|
|
|
2024-07-03 22:00:32 +01:00
|
|
|
import Logo from '$lib/../img/campfire-logo.svg';
|
|
|
|
import Button from './Button.svelte';
|
|
|
|
|
2024-06-30 19:57:32 +01:00
|
|
|
import TimelineIcon from '../../img/icons/timeline.svg';
|
|
|
|
import NotificationsIcon from '../../img/icons/notifications.svg';
|
|
|
|
import ExploreIcon from '../../img/icons/explore.svg';
|
|
|
|
import ListIcon from '../../img/icons/lists.svg';
|
|
|
|
import FavouritesIcon from '../../img/icons/like_fill.svg';
|
|
|
|
import BookmarkIcon from '../../img/icons/bookmark.svg';
|
|
|
|
import HashtagIcon from '../../img/icons/hashtag.svg';
|
|
|
|
import PostIcon from '../../img/icons/post.svg';
|
|
|
|
import InfoIcon from '../../img/icons/info.svg';
|
|
|
|
import SettingsIcon from '../../img/icons/settings.svg';
|
|
|
|
import LogoutIcon from '../../img/icons/logout.svg';
|
2025-07-14 17:42:20 +01:00
|
|
|
import FollowersIcon from '../../img/icons/followers.svg';
|
2024-06-30 19:57:32 +01:00
|
|
|
|
2024-06-29 14:48:34 +01:00
|
|
|
const VERSION = APP_VERSION;
|
2025-07-13 18:35:26 +01:00
|
|
|
const lang = Lang('en_GB');
|
2024-06-28 06:19:00 +01:00
|
|
|
|
2024-07-04 16:55:57 +01:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
2025-07-14 00:19:42 +01:00
|
|
|
function gotoProfile() {
|
|
|
|
if (!$account) return;
|
|
|
|
playSound();
|
|
|
|
window.scrollTo({
|
|
|
|
top: 0,
|
|
|
|
behavior: "smooth"
|
|
|
|
});
|
|
|
|
goto(`/${$server.host}/${$account.username}`);
|
|
|
|
}
|
|
|
|
|
2025-07-14 17:42:20 +01:00
|
|
|
async function logOut() {
|
2024-06-28 06:19:00 +01:00
|
|
|
if (!confirm("This will log you out. Are you sure?")) return;
|
2024-07-05 14:47:17 +01:00
|
|
|
|
|
|
|
const res = await api.revokeToken(
|
2024-07-07 14:58:59 +01:00
|
|
|
$server.host,
|
|
|
|
$app.id,
|
|
|
|
$app.secret,
|
|
|
|
$app.token
|
2024-07-05 14:47:17 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
if (!res.ok)
|
2025-07-13 20:44:54 +01:00
|
|
|
console.warn(lang.string('logs.token_revoke_failed'));
|
2024-07-05 14:47:17 +01:00
|
|
|
|
|
|
|
account.set(false);
|
|
|
|
app.set(false);
|
|
|
|
server.set(false);
|
|
|
|
|
2024-06-29 23:10:29 +01:00
|
|
|
goto("/");
|
2024-06-28 06:19:00 +01:00
|
|
|
}
|
2025-07-14 17:42:20 +01:00
|
|
|
|
|
|
|
onMount(async () => {
|
|
|
|
await fetchFollowRequests(true)
|
|
|
|
})
|
2024-06-28 06:19:00 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div id="navigation">
|
2024-07-03 22:00:32 +01:00
|
|
|
<header class="server-header">
|
2024-07-01 03:41:02 +01:00
|
|
|
<div class="app-logo">
|
|
|
|
<Logo />
|
|
|
|
</div>
|
|
|
|
</header>
|
2024-06-28 06:19:00 +01:00
|
|
|
|
2024-07-07 14:33:28 +01:00
|
|
|
{#if $account}
|
2024-06-28 06:19:00 +01:00
|
|
|
<div id="nav-items">
|
2024-07-02 12:36:26 +01:00
|
|
|
<Button label="Timeline"
|
2025-07-14 01:06:16 +01:00
|
|
|
href="/")}
|
2024-07-02 19:38:20 +01:00
|
|
|
active={$page.url.pathname === "/"}>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<TimelineIcon/>
|
|
|
|
</svelte:fragment>
|
2025-07-13 18:35:26 +01:00
|
|
|
{lang.string('navigation.timeline')}
|
2024-06-30 19:57:32 +01:00
|
|
|
</Button>
|
2024-07-02 12:36:26 +01:00
|
|
|
<Button label="Notifications"
|
2025-07-14 04:10:16 +01:00
|
|
|
href="/notifications"}
|
2024-07-02 19:38:20 +01:00
|
|
|
active={$page.url.pathname === "/notifications"}>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<NotificationsIcon/>
|
|
|
|
</svelte:fragment>
|
2025-07-13 18:35:26 +01:00
|
|
|
{lang.string('navigation.notifications')}
|
2024-07-02 19:38:20 +01:00
|
|
|
{#if $unread_notif_count}
|
|
|
|
<span class="notification-count">
|
|
|
|
{$unread_notif_count <= 99 ? $unread_notif_count : "99+"}
|
|
|
|
</span>
|
2024-06-28 06:19:00 +01:00
|
|
|
{/if}
|
|
|
|
</Button>
|
2025-07-14 17:42:20 +01:00
|
|
|
{#if $followRequests.length > 0}
|
|
|
|
<Button label="Follow requests"
|
|
|
|
href="/follow-requests"}
|
|
|
|
active={$page.url.pathname === "/follow-requests"}>
|
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<FollowersIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
{lang.string('navigation.follow_requests')}
|
|
|
|
<span class="notification-count">
|
|
|
|
{$followRequests.length}
|
|
|
|
</span>
|
|
|
|
</Button>
|
|
|
|
{/if}
|
2024-06-30 19:57:32 +01:00
|
|
|
<Button label="Explore" disabled>
|
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<ExploreIcon height="auto"/>
|
|
|
|
</svelte:fragment>
|
2025-07-13 18:35:26 +01:00
|
|
|
{lang.string('navigation.explore')}
|
2024-06-30 19:57:32 +01:00
|
|
|
</Button>
|
|
|
|
<Button label="Lists" disabled>
|
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<ListIcon/>
|
|
|
|
</svelte:fragment>
|
2025-07-13 18:35:26 +01:00
|
|
|
{lang.string('navigation.lists')}
|
2024-06-30 19:57:32 +01:00
|
|
|
</Button>
|
2024-06-28 06:19:00 +01:00
|
|
|
|
|
|
|
<div class="flex-row">
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button centered label="{lang.string('navigation.favourites')}" disabled>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<FavouritesIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button centered label="{lang.string('navigation.bookmarks')}" disabled>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<BookmarkIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button centered label="{lang.string('navigation.hashtags')}" disabled>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<HashtagIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2024-06-28 06:19:00 +01:00
|
|
|
</div>
|
|
|
|
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button filled label="{lang.string('compose')}" on:click={() => dispatch("compose")}>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<PostIcon/>
|
|
|
|
</svelte:fragment>
|
2025-07-13 18:35:26 +01:00
|
|
|
{lang.string('compose')}
|
2024-07-04 16:55:57 +01:00
|
|
|
</Button>
|
2024-06-28 06:19:00 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="account-items">
|
|
|
|
<div class="flex-row">
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button centered label="{lang.string('navigation.profile_information')}" disabled>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<InfoIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2025-07-13 18:35:26 +01:00
|
|
|
<Button centered label="{lang.string('navigation.settings')}" disabled>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<SettingsIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2025-07-14 17:42:20 +01:00
|
|
|
<Button centered label="{lang.string('navigation.log_out')}" on:click={() => logOut()}>
|
2024-06-30 19:57:32 +01:00
|
|
|
<svelte:fragment slot="icon">
|
|
|
|
<LogoutIcon/>
|
|
|
|
</svelte:fragment>
|
|
|
|
</Button>
|
2024-06-28 06:19:00 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div id="account-button">
|
2025-07-14 00:19:42 +01:00
|
|
|
<img src={$account.avatar_url} class="account-avatar" height="64px" alt="" aria-hidden="true" on:click={() => gotoProfile()}>
|
2024-06-28 06:19:00 +01:00
|
|
|
<div class="account-name" aria-hidden="true">
|
2025-07-14 01:06:16 +01:00
|
|
|
<a href="/{$server.host}/@{$account.username}" class="nickname" title={$account.nickname}>{@html $account.rich_name}</a>
|
2024-07-03 22:00:32 +01:00
|
|
|
<span class="username" title={`@${$account.username}@${$account.host}`}>
|
2025-07-13 19:04:50 +01:00
|
|
|
{$account.fqn}
|
2024-06-28 06:19:00 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2024-07-07 14:33:28 +01:00
|
|
|
|
2024-06-28 06:19:00 +01:00
|
|
|
<span class="version">
|
2024-06-30 17:37:19 +01:00
|
|
|
campfire v{VERSION}
|
2024-06-28 06:19:00 +01:00
|
|
|
<br>
|
|
|
|
<ul>
|
2025-07-13 18:35:26 +01:00
|
|
|
<li><a href="https://git.arimelody.me/blisstown/campfire">{lang.string('source')}</a></li>
|
|
|
|
<li><a href="https://codeberg.org/arimelody/campfire/issues">{lang.string('issues')}</a></li>
|
2024-06-28 06:19:00 +01:00
|
|
|
</ul>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#navigation {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
position: fixed;
|
|
|
|
top: 16px;
|
|
|
|
width: 300px;
|
|
|
|
height: calc(100vh - 32px);
|
|
|
|
border-radius: 8px;
|
|
|
|
background-color: var(--bg-800);
|
2025-07-10 18:11:49 +01:00
|
|
|
transition: background-color .1s linear;
|
|
|
|
user-select: none;
|
2024-06-28 06:19:00 +01:00
|
|
|
}
|
|
|
|
|
2024-07-03 22:00:32 +01:00
|
|
|
.server-header {
|
2024-06-28 06:19:00 +01:00
|
|
|
width: 100%;
|
|
|
|
height: 172px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
border-radius: 8px;
|
|
|
|
background-position: center;
|
|
|
|
background-size: cover;
|
|
|
|
background-color: var(--bg-600);
|
|
|
|
background-image: linear-gradient(to top, var(--bg-800), var(--bg-600));
|
2025-07-10 18:11:49 +01:00
|
|
|
transition: background .1s linear;
|
2024-06-28 06:19:00 +01:00
|
|
|
}
|
|
|
|
|
2024-07-03 22:00:32 +01:00
|
|
|
.server-icon {
|
2024-06-29 15:24:33 +01:00
|
|
|
height: 50%;
|
2024-06-28 06:19:00 +01:00
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
2024-06-30 21:08:14 +01:00
|
|
|
.app-logo {
|
|
|
|
max-width: 70%;
|
|
|
|
max-height: 70%;
|
2024-06-28 06:19:00 +01:00
|
|
|
margin: auto;
|
|
|
|
}
|
|
|
|
|
2024-06-30 21:08:14 +01:00
|
|
|
.app-logo :global(svg) {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
2024-06-28 06:19:00 +01:00
|
|
|
#nav-items {
|
|
|
|
margin-bottom: auto;
|
|
|
|
padding: 16px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.notification-count {
|
|
|
|
position: relative;
|
|
|
|
transform: translate(22px, -16px);
|
|
|
|
min-width: 12px;
|
|
|
|
height: 28px;
|
2024-07-02 19:38:20 +01:00
|
|
|
margin-left: auto;
|
2024-06-28 06:19:00 +01:00
|
|
|
padding: 0 8px;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
text-align: right;
|
|
|
|
border-radius: 8px;
|
|
|
|
font-weight: 700;
|
|
|
|
color: var(--bg-1000);
|
|
|
|
background-color: var(--accent);
|
|
|
|
box-shadow: 0 0 32px color-mix(in srgb, transparent, var(--accent) 100%);
|
|
|
|
}
|
|
|
|
|
|
|
|
#account-items {
|
|
|
|
padding: 16px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.version {
|
|
|
|
margin-bottom: 16px;
|
|
|
|
font-style: italic;
|
|
|
|
font-size: .9em;
|
|
|
|
opacity: .6;
|
|
|
|
text-align: center;
|
2025-07-10 18:11:49 +01:00
|
|
|
user-select: text;
|
2024-06-28 06:19:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.version ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
justify-content: center;
|
|
|
|
list-style: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.version ul li {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.version ul li:not(:first-child):before {
|
|
|
|
content: '•';
|
|
|
|
margin-right: 8px;
|
|
|
|
color: inherit;
|
|
|
|
opacity: .7;
|
|
|
|
}
|
|
|
|
|
|
|
|
.version a {
|
|
|
|
color: inherit;
|
|
|
|
text-decoration: none;
|
|
|
|
opacity: .7;
|
|
|
|
}
|
|
|
|
|
|
|
|
.version a:hover {
|
|
|
|
text-decoration: underline;
|
|
|
|
}
|
|
|
|
|
|
|
|
#account-button {
|
|
|
|
width: calc(100% - 16px);
|
|
|
|
height: 48px;
|
|
|
|
padding: 8px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
align-items: center;
|
|
|
|
gap: 8px;
|
|
|
|
|
|
|
|
font-family: inherit;
|
|
|
|
font-size: 1rem;
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
background-color: var(--bg-700);
|
|
|
|
color: var(--text);
|
|
|
|
border-color: transparent;
|
|
|
|
|
|
|
|
transition-property: border-color, background-color, color;
|
|
|
|
transition-timing-function: ease-out;
|
|
|
|
transition-duration: .1s;
|
|
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.account-avatar {
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
border-radius: 8px;
|
|
|
|
transition: transform .1s ease-out, box-shadow .2s;
|
|
|
|
}
|
|
|
|
|
|
|
|
.account-avatar:hover {
|
|
|
|
transform: scale(1.05);
|
|
|
|
box-shadow: 0 0 16px color-mix(in srgb, transparent, var(--accent) 25%);
|
|
|
|
}
|
|
|
|
|
|
|
|
.account-avatar:active {
|
|
|
|
transform: scale(.95);
|
|
|
|
box-shadow: 0 0 16px var(--bg-1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
.account-name {
|
|
|
|
/* width: 152px; */
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
gap: 2px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.username, .nickname {
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
font-size: .8em;
|
2024-07-01 03:58:31 +01:00
|
|
|
color: inherit;
|
2024-06-28 06:19:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.username {
|
|
|
|
opacity: .8;
|
|
|
|
font-size: .65em;
|
|
|
|
}
|
|
|
|
|
2024-07-02 21:58:46 +01:00
|
|
|
.nickname :global(.emoji) {
|
|
|
|
height: 1.2em;
|
|
|
|
margin: -.1em 0;
|
|
|
|
}
|
|
|
|
|
2024-06-28 06:19:00 +01:00
|
|
|
.flex-row {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
gap: 8px;
|
|
|
|
}
|
|
|
|
</style>
|