diff --git a/assets/css/app.css b/assets/css/app.css index 65ab2fc..4dd6a10 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -303,6 +303,12 @@ html, body { user-select: none; } +.mx-tweet-avatar--lg { + width: 56px; + height: 56px; + font-size: 1.25rem; +} + .mx-compose-body { flex: 1; } .mx-compose-textarea, .mx-edit-textarea { @@ -964,4 +970,6 @@ html, body { } .mx-header { padding: 0.75rem 1rem; } .mx-detail { padding: 0.875rem 1rem; } + /* 5-item nav: slightly smaller labels so nothing wraps */ + .mx-mobile-nav-item { font-size: 0.6rem; } } diff --git a/assets/js/index.tsx b/assets/js/index.tsx index 52c39c1..d08fe97 100644 --- a/assets/js/index.tsx +++ b/assets/js/index.tsx @@ -1208,7 +1208,7 @@ function UserList() { ); } -function UserDetail({ userId }: { userId: string }) { +function UserDetail({ userId, isStandalone = false }: { userId: string; isStandalone?: boolean }) { const { userId: currentUserId } = useContext(AuthCtx); const { follow, unfollow, isPending } = useFollowUser(userId); const { data: user, isLoading, isError } = useQuery({ @@ -1228,30 +1228,38 @@ function UserDetail({ userId }: { userId: string }) { if (isLoading) return ; if (isError || !user) return ; - const canFollow = !!currentUserId && currentUserId !== userId; + const isOwnProfile = currentUserId === userId; + const canFollow = !!currentUserId && !isOwnProfile; const amIFollowing = user.amIFollowing ?? false; return (
-
- - - - - Back - -
+ {!isStandalone && ( +
+ + + + + Back + +
+ )}
-
- M +
+ {user.email?.[0]?.toUpperCase() ?? "M"}
-
+
{user.email} {canFollow && ( )} + {isOwnProfile && isStandalone && ( + + Sign out + + )}
{user.followerCount ?? 0} followers @@ -1264,6 +1272,25 @@ function UserDetail({ userId }: { userId: string }) { ); } +function MyProfile() { + const { userId } = useContext(AuthCtx); + + if (!userId) { + return ( +
+
+

Your profile

+

+ Sign in + {" "}to view your profile. +

+
+ ); + } + + return ; +} + // ── Mobile bottom nav ───────────────────────────────────────────────────────── function MobileNav({ @@ -1276,6 +1303,7 @@ function MobileNav({ const onFeedPage = page === "feed" || page === "tweet"; const onFollowingPage = page === "following"; const onUsersPage = page === "users" || page === "user-detail"; + const onProfilePage = page === "profile"; return ( ); } @@ -1379,6 +1417,7 @@ function App() { const onFeedPage = page === "feed" || page === "tweet"; const onFollowingPage = page === "following"; const onUsersPage = page === "users" || page === "user-detail"; + const onProfilePage = page === "profile"; function renderMain() { switch (page) { @@ -1419,6 +1458,15 @@ function App() { ); + case "profile": + return ( + <> +
+

My Profile

+
+ + + ); default: return ( <> @@ -1475,6 +1523,12 @@ function App() { Users + + + + + Profile +
{email ? ( diff --git a/lib/mixer_web/controllers/page_controller.ex b/lib/mixer_web/controllers/page_controller.ex index b5b94a4..cc202d4 100644 --- a/lib/mixer_web/controllers/page_controller.ex +++ b/lib/mixer_web/controllers/page_controller.ex @@ -21,6 +21,10 @@ defmodule MixerWeb.PageController do render_spa(conn, %{page: "following", tweet_id: nil, user_id: nil}) end + def profile(conn, _params) do + render_spa(conn, %{page: "profile", tweet_id: nil, user_id: nil}) + end + def users_index(conn, _params) do render_spa(conn, %{page: "users", tweet_id: nil, user_id: nil}) end diff --git a/lib/mixer_web/router.ex b/lib/mixer_web/router.ex index fad45f1..cb982b3 100644 --- a/lib/mixer_web/router.ex +++ b/lib/mixer_web/router.ex @@ -41,6 +41,7 @@ defmodule MixerWeb.Router do get "/feed", PageController, :index get "/feed/:tweet_id", PageController, :show get "/following", PageController, :following + get "/profile", PageController, :profile get "/users", PageController, :users_index get "/users/:user_id", PageController, :user_show post "/rpc/run", AshTypescriptRpcController, :run