diff --git a/crates/api/src/routing/pages/mod.rs b/crates/api/src/routing/pages/mod.rs index 9f41c72..6300a42 100644 --- a/crates/api/src/routing/pages/mod.rs +++ b/crates/api/src/routing/pages/mod.rs @@ -1543,7 +1543,6 @@ pub async fn routes(database: Database) -> Router { .route("/@{username}/c/{id}", get(comment_request)) // profiles .route("/@{username}/_app/warning", get(profile::warning_request)) - .route("/@{username}/comments", get(profile::comments_request)) .route("/@{username}/mod", get(profile::mod_request)) // staff .route("/@{username}/questions", get(profile::questions_request)) .route("/@{username}/questions/inbox", get(profile::inbox_request)) // staff @@ -1551,14 +1550,23 @@ pub async fn routes(database: Database) -> Router { "/@{username}/questions/outbox", get(profile::outbox_request), ) // staff - .route("/@{username}/following", get(profile::following_request)) - .route("/@{username}/followers", get(profile::followers_request)) - .route("/@{username}/friends", get(profile::friends_request)) .route( - "/@{username}/friends/requests", + "/@{username}/social/following", + get(profile::following_request), + ) + .route( + "/@{username}/social/followers", + get(profile::followers_request), + ) + .route("/@{username}/social/friends", get(profile::friends_request)) + .route( + "/@{username}/social/friends/requests", get(profile::friend_requests_request), ) - .route("/@{username}/friends/blocks", get(profile::blocks_request)) + .route( + "/@{username}/social/friends/blocks", + get(profile::blocks_request), + ) .route("/@{username}/embed", get(profile::profile_embed_request)) .route( "/@{username}/relationship/friend_accept", @@ -1568,10 +1576,6 @@ pub async fn routes(database: Database) -> Router { "/@{username}/_app/feed.html", get(profile::partial_profile_request), ) - .route( - "/@{username}/_app/comments.html", - get(profile::partial_comments_request), - ) .route("/@{username}", get(profile::profile_request)) .route("/{id}", get(api::profiles::expand_request)) // circles diff --git a/crates/api/src/routing/pages/profile.rs b/crates/api/src/routing/pages/profile.rs index fda4b74..1d35874 100644 --- a/crates/api/src/routing/pages/profile.rs +++ b/crates/api/src/routing/pages/profile.rs @@ -8,7 +8,6 @@ use serde::{Deserialize, Serialize}; use axum::Json; use authbeam::model::{Permission, Profile, UserFollow, Warning}; -use rainbeam::model::ResponseComment; use databeam::DefaultReturn; use crate::database::Database; @@ -619,7 +618,7 @@ struct FollowersTemplate { is_helper: bool, } -/// GET /@{username}/followers +/// GET /@{username}/social/followers pub async fn followers_request( jar: CookieJar, Path(username): Path, @@ -741,7 +740,7 @@ struct FollowingTemplate { is_helper: bool, } -/// GET /@{username}/following +/// GET /@{username}/social/following pub async fn following_request( jar: CookieJar, Path(username): Path, @@ -863,7 +862,7 @@ struct FriendsTemplate { is_helper: bool, } -/// GET /@{username}/friends +/// GET /@{username}/social/friends pub async fn friends_request( jar: CookieJar, Path(username): Path, @@ -989,7 +988,7 @@ struct FriendRequestsTemplate { is_helper: bool, } -/// GET /@{username}/friends/requests +/// GET /@{username}/social/friends/requests pub async fn friend_requests_request( jar: CookieJar, Path(username): Path, @@ -1079,7 +1078,7 @@ struct BlocksTemplate { is_helper: bool, } -/// GET /@{username}/friends/blocks +/// GET /@{username}/social/friends/blocks pub async fn blocks_request( jar: CookieJar, Path(username): Path, diff --git a/crates/web/src/lib/components/ProfileCard.svelte b/crates/web/src/lib/components/ProfileCard.svelte new file mode 100644 index 0000000..5bad90c --- /dev/null +++ b/crates/web/src/lib/components/ProfileCard.svelte @@ -0,0 +1,57 @@ + + + diff --git a/crates/web/src/routes/+layout.server.ts b/crates/web/src/routes/+layout.server.ts index a4e3d69..8c540ce 100644 --- a/crates/web/src/routes/+layout.server.ts +++ b/crates/web/src/routes/+layout.server.ts @@ -58,6 +58,10 @@ export const load: LayoutServerLoad = async ({ cookies, url, request }): Promise query[param[0]] = param[1]; } + if (!query.page) { + query.page = 0; + } + // fetch unread data const unread = await db.get_unread(request.headers); diff --git a/crates/web/src/routes/+layout.svelte b/crates/web/src/routes/+layout.svelte index 184a073..e2851f1 100644 --- a/crates/web/src/routes/+layout.svelte +++ b/crates/web/src/routes/+layout.svelte @@ -245,12 +245,12 @@ {lang["general:title.social"]} - + {lang["general:link.friends"]} - + {lang["general:link.requests"]} @@ -284,12 +284,12 @@
{lang["general:title.account"]} - + {lang["general:link.login"]} - + {lang["general:link.sign_up"]} diff --git a/crates/web/src/routes/+page.svelte b/crates/web/src/routes/+page.svelte index da1a84e..a33ce18 100644 --- a/crates/web/src/routes/+page.svelte +++ b/crates/web/src/routes/+page.svelte @@ -19,9 +19,7 @@ const query = data.query; async function load_responses() { - return await ( - await fetch(`/_partial/timeline?page=${query.page || "0"}`) - ).json(); + return await (await fetch(`/_partial/timeline?page=${query.page || "0"}`)).json(); } let responses = $state([] as any[]); @@ -46,24 +44,14 @@
{#if user.is_some()} @@ -71,24 +59,12 @@
My Friends
- + {#each page.friends as user} {#if profile.id !== user[0].id} - + {:else} - + {/if} {/each}
@@ -98,12 +74,8 @@ {#each responses as res}
-
+

@@ -159,6 +127,7 @@ href="/sign_up" data-turbo="false" style="gap: 1rem !important" + data-sveltekit-reload > {lang["homepage.html:link.create_account"]} @@ -169,6 +138,7 @@ href="/login" data-turbo="false" style="gap: 1rem !important" + data-sveltekit-reload > {lang["general:link.login"]} @@ -177,4 +147,9 @@
+ + {/if} diff --git a/crates/web/src/routes/@[username]/+layout.svelte b/crates/web/src/routes/@[username]/+layout.svelte index a188483..b5ccea4 100644 --- a/crates/web/src/routes/@[username]/+layout.svelte +++ b/crates/web/src/routes/@[username]/+layout.svelte @@ -24,11 +24,8 @@ import { active_page } from "$lib/stores.js"; active_page.set("profile"); - import Question from "$lib/components/Question.svelte"; import Dropdown from "$lib/components/Dropdown.svelte"; - import MoreResponseOptions from "$lib/components/MoreResponseOptions.svelte"; import { Option } from "$lib/classes/Option"; - import Notification from "$lib/components/Notification.svelte"; import type { RelationshipStatus } from "$lib/bindings/RelationshipStatus"; import { render_markdown } from "$lib/helpers.js"; import UserNote from "$lib/components/UserNote.svelte"; @@ -316,19 +313,33 @@ {#if !hide_social}
- + {followers_count} {lang["profile:base.html:link.follower"]}{#if followers_count > 1}s{/if}{lang[ + "profile:base.html:link.follower" + ]}{#if followers_count > 1 || followers_count === 0}s{/if} - + {following_count} {lang["profile:base.html:link.following"]} - + {friends_count} {lang[ diff --git a/crates/web/src/routes/@[username]/c/[id]/+page@.svelte b/crates/web/src/routes/@[username]/c/[id]/+page@.svelte index e73746e..737a0d4 100644 --- a/crates/web/src/routes/@[username]/c/[id]/+page@.svelte +++ b/crates/web/src/routes/@[username]/c/[id]/+page@.svelte @@ -32,15 +32,7 @@ }, 100); }); - const { - question, - response, - comment, - replies, - reactions, - is_helper, - is_powerful - } = page; + const { question, response, comment, replies, reactions, is_helper, is_powerful } = page; @@ -53,11 +45,7 @@ {#if !comment[0].reply}
Response - +
@@ -80,11 +68,7 @@ {@const reply = comment[0].reply}
Replying to - +
@@ -125,18 +109,12 @@
- {lang["views:text.replies"]} - {lang["views:text.reactions"]} + {lang["views:text.replies"]} + {lang["views:text.reactions"]} {#if user.is_some()} {@const profile = user.unwrap()} {#if profile.id === comment[0].author.id} - {lang["general:action.edit"]} + {lang["general:action.edit"]} {/if} {/if}
@@ -175,17 +153,10 @@
- +
- +
- +
@@ -231,11 +194,7 @@
{#if page.page > 0} - + {lang["general:link.previous"]} {:else} @@ -243,11 +202,7 @@ {/if} {#if replies.length != 0} - + {lang["general:link.next"]} {/if} @@ -257,10 +212,7 @@