From 5028f7ee2c6a9a4a1cdc9dfcb8928d09aab44db4 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 13 Dec 2024 16:13:01 -0600 Subject: [PATCH] Add screens and routes --- bskyweb/cmd/bskyweb/server.go | 4 ++++ src/Navigation.tsx | 24 +++++++++++++++++++ src/lib/constants.ts | 2 ++ src/lib/routes/types.ts | 4 ++++ src/routes.ts | 5 ++++ src/screens/Profile/Vouches/Create/index.tsx | 24 +++++++++++++++++++ src/screens/Profile/Vouches/Issued/index.tsx | 24 +++++++++++++++++++ .../Profile/Vouches/Received/index.tsx | 24 +++++++++++++++++++ src/screens/Profile/Vouches/index.tsx | 24 +++++++++++++++++++ src/view/com/profile/ProfileMenu.tsx | 18 +++++++++++++- 10 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 src/screens/Profile/Vouches/Create/index.tsx create mode 100644 src/screens/Profile/Vouches/Issued/index.tsx create mode 100644 src/screens/Profile/Vouches/Received/index.tsx create mode 100644 src/screens/Profile/Vouches/index.tsx diff --git a/bskyweb/cmd/bskyweb/server.go b/bskyweb/cmd/bskyweb/server.go index 19252f7654..350c8246b4 100644 --- a/bskyweb/cmd/bskyweb/server.go +++ b/bskyweb/cmd/bskyweb/server.go @@ -280,6 +280,10 @@ func serve(cctx *cli.Context) error { e.GET("/profile/:handleOrDID/feed/:rkey", server.WebGeneric) e.GET("/profile/:handleOrDID/feed/:rkey/liked-by", server.WebGeneric) e.GET("/profile/:handleOrDID/labeler/liked-by", server.WebGeneric) + e.GET("/profile/:handleOrDID/vouches", server.WebGeneric) + e.GET("/profile/:handleOrDID/vouches/create", server.WebGeneric) + e.GET("/profile/:handleOrDID/vouches/issued", server.WebGeneric) + e.GET("/profile/:handleOrDID/vouches/received", server.WebGeneric) // profile RSS feed (DID not handle) e.GET("/profile/:ident/rss", server.WebProfileRSS) diff --git a/src/Navigation.tsx b/src/Navigation.tsx index 7443128d2c..8c1b254463 100644 --- a/src/Navigation.tsx +++ b/src/Navigation.tsx @@ -78,6 +78,10 @@ import {ProfileFeedScreen} from '#/screens/Profile/ProfileFeed' import {ProfileFollowersScreen} from '#/screens/Profile/ProfileFollowers' import {ProfileFollowsScreen} from '#/screens/Profile/ProfileFollows' import {ProfileLabelerLikedByScreen} from '#/screens/Profile/ProfileLabelerLikedBy' +import {Screen as ProfileVouches} from '#/screens/Profile/Vouches' +import {Screen as ProfileVouchesCreate} from '#/screens/Profile/Vouches/Create' +import {Screen as ProfileVouchesIssued} from '#/screens/Profile/Vouches/Issued' +import {Screen as ProfileVouchesReceived} from '#/screens/Profile/Vouches/Received' import {AppearanceSettingsScreen} from '#/screens/Settings/AppearanceSettings' import {AppIconSettingsScreen} from '#/screens/Settings/AppIconSettings' import {NotificationSettingsScreen} from '#/screens/Settings/NotificationSettings' @@ -239,6 +243,26 @@ function commonScreens(Stack: typeof HomeTab, unreadCountLabel?: string) { getComponent={() => ProfileLabelerLikedByScreen} options={{title: title(msg`Liked by`)}} /> + ProfileVouches} + options={{title: title(msg`Vouches`)}} + /> + ProfileVouchesCreate} + options={{title: title(msg`Create Vouch`)}} + /> + ProfileVouchesIssued} + options={{title: title(msg`Issued Vouch`)}} + /> + ProfileVouchesReceived} + options={{title: title(msg`My Vouches`)}} + /> Storybook} diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 5d7b5eb456..bf7be2b41c 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -32,6 +32,8 @@ export const DISCOVER_DEBUG_DIDS: Record = { 'did:plc:3jpt2mvvsumj2r7eqk4gzzjz': true, // esb.lol 'did:plc:vjug55kidv6sye7ykr5faxxn': true, // emilyliu.me } +export const isInternalUser = (did?: string) => + did ? DISCOVER_DEBUG_DIDS[did] : false const BASE_FEEDBACK_FORM_URL = `${HELP_DESK_URL}/requests/new` export function FEEDBACK_FORM_URL({ diff --git a/src/lib/routes/types.ts b/src/lib/routes/types.ts index 238e4be4c3..93b9d9974a 100644 --- a/src/lib/routes/types.ts +++ b/src/lib/routes/types.ts @@ -23,6 +23,10 @@ export type CommonNavigatorParams = { ProfileFeed: {name: string; rkey: string} ProfileFeedLikedBy: {name: string; rkey: string} ProfileLabelerLikedBy: {name: string} + ProfileVouches: {name: string} + ProfileVouchesCreate: {name: string} + ProfileVouchesIssued: {name: string} + ProfileVouchesReceived: {name: string} Debug: undefined DebugMod: undefined SharedPreferencesTester: undefined diff --git a/src/routes.ts b/src/routes.ts index 188665d849..f695d11680 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -26,6 +26,11 @@ export const router = new Router({ ProfileFeed: '/profile/:name/feed/:rkey', ProfileFeedLikedBy: '/profile/:name/feed/:rkey/liked-by', ProfileLabelerLikedBy: '/profile/:name/labeler/liked-by', + ProfileVouches: '/profile/:name/vouches', + ProfileVouchesCreate: '/profile/:name/vouches/create', + ProfileVouchesIssued: '/profile/:name/vouches/issued', + ProfileVouchesReceived: '/profile/:name/vouches/received', + // debug Debug: '/sys/debug', DebugMod: '/sys/debug-mod', diff --git a/src/screens/Profile/Vouches/Create/index.tsx b/src/screens/Profile/Vouches/Create/index.tsx new file mode 100644 index 0000000000..a7da764a32 --- /dev/null +++ b/src/screens/Profile/Vouches/Create/index.tsx @@ -0,0 +1,24 @@ +import {Trans} from '@lingui/macro' + +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' + +export function Screen() { + return ( + + + + + + Create Vouch + + + + + + + Create + + + ) +} diff --git a/src/screens/Profile/Vouches/Issued/index.tsx b/src/screens/Profile/Vouches/Issued/index.tsx new file mode 100644 index 0000000000..c45d94abdd --- /dev/null +++ b/src/screens/Profile/Vouches/Issued/index.tsx @@ -0,0 +1,24 @@ +import {Trans} from '@lingui/macro' + +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' + +export function Screen() { + return ( + + + + + + Issued Vouches + + + + + + + Create + + + ) +} diff --git a/src/screens/Profile/Vouches/Received/index.tsx b/src/screens/Profile/Vouches/Received/index.tsx new file mode 100644 index 0000000000..12e99975f5 --- /dev/null +++ b/src/screens/Profile/Vouches/Received/index.tsx @@ -0,0 +1,24 @@ +import {Trans} from '@lingui/macro' + +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' + +export function Screen() { + return ( + + + + + + My Vouches + + + + + + + Mine + + + ) +} diff --git a/src/screens/Profile/Vouches/index.tsx b/src/screens/Profile/Vouches/index.tsx new file mode 100644 index 0000000000..f52f0f65fc --- /dev/null +++ b/src/screens/Profile/Vouches/index.tsx @@ -0,0 +1,24 @@ +import {Trans} from '@lingui/macro' + +import * as Layout from '#/components/Layout' +import {Text} from '#/components/Typography' + +export function Screen() { + return ( + + + + + + Vouches + + + + + + + Vouches + + + ) +} diff --git a/src/view/com/profile/ProfileMenu.tsx b/src/view/com/profile/ProfileMenu.tsx index f01fb5e172..6cd54ae85b 100644 --- a/src/view/com/profile/ProfileMenu.tsx +++ b/src/view/com/profile/ProfileMenu.tsx @@ -4,7 +4,8 @@ import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useQueryClient} from '@tanstack/react-query' -import {HITSLOP_20} from '#/lib/constants' +import {HITSLOP_20, isInternalUser} from '#/lib/constants' +import {useNavigationDeduped} from '#/lib/hooks/useNavigationDeduped' import {makeProfileLink} from '#/lib/routes/links' import {shareUrl} from '#/lib/sharing' import {toShareUrl} from '#/lib/strings/url-helpers' @@ -52,6 +53,7 @@ let ProfileMenu = ({ const isBlocked = profile.viewer?.blocking || profile.viewer?.blockedBy const isFollowingBlockedAccount = isFollowing && isBlocked const isLabelerAndNotBlocked = !!profile.associated?.labeler && !isBlocked + const navigation = useNavigationDeduped() const [queueMute, queueUnmute] = useProfileMuteMutationQueue(profile) const [queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile) @@ -80,6 +82,10 @@ let ProfileMenu = ({ shareUrl(toShareUrl(makeProfileLink(profile))) }, [profile]) + const onPressManageVouches = React.useCallback(() => { + navigation.navigate('ProfileVouches', {name: profile.handle}) + }, [navigation, profile.handle]) + const onPressAddRemoveLists = React.useCallback(() => { openModal({ name: 'user-add-remove-lists', @@ -247,6 +253,16 @@ let ProfileMenu = ({ + {isInternalUser(currentAccount?.did) && ( + + + Manage vouches + + + + )} {!isSelf && ( <> {!profile.viewer?.blocking &&