@openpeepshq/react 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/configuration/ConfigMenuButton.d.ts +5 -2
- package/dist/components/configuration/ConfigMenuButton.js +7 -3
- package/dist/components/notifications/NotificationWrapper.d.ts +3 -3
- package/dist/components/notifications/NotificationWrapper.js +4 -3
- package/dist/components/notifications/NotificationsList.d.ts +9 -1
- package/dist/components/notifications/NotificationsList.js +7 -6
- package/dist/components/notifications/TypedNotification.js +2 -2
- package/dist/components/notifications/index.d.ts +1 -1
- package/dist/components/post/FeedPost.d.ts +7 -1
- package/dist/components/post/FeedPost.js +2 -2
- package/dist/components/post/FullPostLayout.js +1 -1
- package/dist/components/post/pieces/PostActions.d.ts +3 -1
- package/dist/components/post/pieces/PostActions.js +2 -2
- package/dist/components/post/pieces/PostReactionHeader.d.ts +3 -1
- package/dist/components/post/pieces/PostReactionHeader.js +2 -2
- package/dist/components/post/types/event/FullEvent.d.ts +2 -0
- package/dist/react-native.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/configuration/ConfigMenuButton.tsx +29 -7
- package/src/components/notifications/NotificationWrapper.tsx +15 -9
- package/src/components/notifications/NotificationsList.tsx +27 -6
- package/src/components/notifications/TypedNotification.tsx +2 -2
- package/src/components/notifications/index.ts +4 -1
- package/src/components/post/FeedPost.tsx +16 -3
- package/src/components/post/FullPostLayout.tsx +1 -0
- package/src/components/post/pieces/PostActions.tsx +10 -4
- package/src/components/post/pieces/PostReactionHeader.tsx +7 -1
- package/src/components/post/types/event/FullEvent.tsx +2 -0
- package/src/react-native.ts +5 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export interface ConfigMenuButtonProps {
|
|
2
2
|
translationPrefix: string;
|
|
3
|
-
|
|
3
|
+
/** URL path for navigation (web). */
|
|
4
|
+
action?: string;
|
|
5
|
+
/** Click handler — renders a button instead of a Link when provided. */
|
|
6
|
+
onPress?: () => void;
|
|
4
7
|
testId?: string;
|
|
5
8
|
titleFallback?: string;
|
|
6
9
|
descriptionFallback?: string;
|
|
@@ -9,4 +12,4 @@ export interface ConfigMenuButtonProps {
|
|
|
9
12
|
* Row in a settings / configuration menu: title, description and a chevron.
|
|
10
13
|
* Shared by the admin configuration screens and the user settings index.
|
|
11
14
|
*/
|
|
12
|
-
export declare function ConfigMenuButton({ translationPrefix, action, testId, titleFallback, descriptionFallback, }: ConfigMenuButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ConfigMenuButton({ translationPrefix, action, onPress, testId, titleFallback, descriptionFallback, }: ConfigMenuButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
import { ChevronRight } from 'lucide-react';
|
|
4
4
|
import { useT } from '../../i18n/index.js';
|
|
@@ -6,7 +6,11 @@ import { useT } from '../../i18n/index.js';
|
|
|
6
6
|
* Row in a settings / configuration menu: title, description and a chevron.
|
|
7
7
|
* Shared by the admin configuration screens and the user settings index.
|
|
8
8
|
*/
|
|
9
|
-
export function ConfigMenuButton({ translationPrefix, action, testId, titleFallback, descriptionFallback, }) {
|
|
9
|
+
export function ConfigMenuButton({ translationPrefix, action, onPress, testId, titleFallback, descriptionFallback, }) {
|
|
10
10
|
const t = useT();
|
|
11
|
-
|
|
11
|
+
const content = (_jsxs(_Fragment, { children: [_jsxs("div", { children: [_jsx("div", { className: "font-medium", children: t(`${translationPrefix}.title`, titleFallback ? { defaultValue: titleFallback } : {}) }), _jsx("div", { className: "text-muted-foreground text-xs", children: t(`${translationPrefix}.description`, descriptionFallback ? { defaultValue: descriptionFallback } : {}) })] }), _jsx("span", { "aria-hidden": "true", children: _jsx(ChevronRight, { className: "h-4 w-4" }) })] }));
|
|
12
|
+
if (onPress) {
|
|
13
|
+
return (_jsx("button", { "data-testid": testId, onClick: onPress, className: "hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start", children: content }));
|
|
14
|
+
}
|
|
15
|
+
return (_jsx(Link, { to: action ?? '', "data-testid": testId, className: "hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start", children: content }));
|
|
12
16
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
2
|
+
import type { Group, PublicProfile } from '@openpeepshq/common/types';
|
|
3
3
|
export interface NotificationWrapperProps {
|
|
4
4
|
profile: PublicProfile;
|
|
5
5
|
seen?: boolean;
|
|
6
|
-
|
|
6
|
+
group?: Group | null;
|
|
7
7
|
showProfile?: boolean;
|
|
8
8
|
children: ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare function NotificationWrapper({ profile,
|
|
10
|
+
export declare function NotificationWrapper({ profile, group, seen, showProfile, children, }: NotificationWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Dot, User, Users } from 'lucide-react';
|
|
3
3
|
import { Avatar, ProfileLink } from '../profile/index.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { GroupAvatar } from '../groups/GroupAvatar.js';
|
|
5
|
+
export function NotificationWrapper({ profile, group, seen = true, showProfile = true, children, }) {
|
|
6
|
+
return (_jsxs("article", { className: "hover:bg-surface w-full items-start gap-3 overflow-hidden border-b px-4 py-5", children: [_jsx("div", { className: "flex justify-end", children: !seen ? _jsx(Dot, { className: "h-3 w-3" }) : null }), showProfile ? (_jsx("div", { className: "flex items-center gap-4 px-6", children: group ? (_jsxs(_Fragment, { children: [_jsx(Users, { className: "text-muted-foreground h-8 w-8" }), _jsx(GroupAvatar, { group: group, size: 3.5, borderless: true })] })) : (_jsxs(_Fragment, { children: [_jsx(User, { className: "text-muted-foreground h-8 w-8" }), _jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3.5 }) })] })) })) : null, _jsx("div", { className: "flex flex-1 flex-col", children: children })] }));
|
|
6
7
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import type { PublicNotification, SuccessFailureResponse } from '@openpeepshq/common/types';
|
|
2
|
+
import type { InfiniteData, UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
+
export type NotificationsFeedQuery = UseInfiniteQueryResult<InfiniteData<PublicNotification[]>, SuccessFailureResponse>;
|
|
1
4
|
export interface NotificationsListProps {
|
|
5
|
+
/** Supply your own query to control fetching externally. When omitted, the
|
|
6
|
+
* component fetches `useCurrentProfileNotifications` internally. */
|
|
7
|
+
query?: NotificationsFeedQuery;
|
|
2
8
|
pageSize?: number;
|
|
9
|
+
isNotificationFeed?: boolean;
|
|
10
|
+
onRefresh?: () => Promise<unknown>;
|
|
3
11
|
}
|
|
4
12
|
/**
|
|
5
13
|
* Translation of `routes/(protected)/(private)/notifications/+page.svelte`.
|
|
@@ -9,4 +17,4 @@ export interface NotificationsListProps {
|
|
|
9
17
|
* Also marks all notifications as seen on mount and clears the PWA app badge
|
|
10
18
|
* — matching the Svelte version's `onMount`.
|
|
11
19
|
*/
|
|
12
|
-
export declare function NotificationsList({ pageSize }: NotificationsListProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function NotificationsList({ query: externalQuery, pageSize, onRefresh, }: NotificationsListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,13 +13,14 @@ import { LoadingSpinner } from '@openpeepshq/react-ui';
|
|
|
13
13
|
* Also marks all notifications as seen on mount and clears the PWA app badge
|
|
14
14
|
* — matching the Svelte version's `onMount`.
|
|
15
15
|
*/
|
|
16
|
-
export function NotificationsList({ pageSize = 15 }) {
|
|
16
|
+
export function NotificationsList({ query: externalQuery, pageSize = 15, onRefresh, }) {
|
|
17
17
|
const t = useT();
|
|
18
18
|
const { openpeepsApi, queryClient, client } = useOpenpeeps();
|
|
19
19
|
const sentinelRef = useRef(null);
|
|
20
|
-
const query =
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const query = externalQuery ??
|
|
21
|
+
openpeepsApi.useCurrentProfileNotifications({
|
|
22
|
+
limit: pageSize,
|
|
23
|
+
});
|
|
23
24
|
const markAllNotificationsAsSeen = openpeepsApi.markAllNotificationsAsSeenAction()();
|
|
24
25
|
const statsQueryKey = client.profiles.current.notificationStats.queryKey({});
|
|
25
26
|
const markedSeenRef = useRef(false);
|
|
@@ -49,12 +50,12 @@ export function NotificationsList({ pageSize = 15 }) {
|
|
|
49
50
|
return;
|
|
50
51
|
const onVisibilityChange = () => {
|
|
51
52
|
if (document.visibilityState === 'visible') {
|
|
52
|
-
void refetch();
|
|
53
|
+
void (onRefresh ? onRefresh() : refetch());
|
|
53
54
|
}
|
|
54
55
|
};
|
|
55
56
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
56
57
|
return () => document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
57
|
-
}, [refetch]);
|
|
58
|
+
}, [refetch, onRefresh]);
|
|
58
59
|
const notifications = useMemo(() => {
|
|
59
60
|
const flat = (query.data?.pages ?? []).flat();
|
|
60
61
|
const seen = new Set();
|
|
@@ -196,7 +196,7 @@ function JamNotification({ notification, }) {
|
|
|
196
196
|
profileName: name,
|
|
197
197
|
groupName: notification.group?.displayName,
|
|
198
198
|
});
|
|
199
|
-
return (_jsx(NotificationWrapper, { profile: profile,
|
|
199
|
+
return (_jsx(NotificationWrapper, { profile: profile, group: notification.group, seen: notification.seen, children: _jsxs("a", { href: `/posts/${notification.post?.id}`, className: "block w-full px-4 py-2", children: [_jsxs("p", { className: "mb-2 flex items-center gap-2 text-sm font-semibold", children: [message, _jsx("span", { className: "text-muted-foreground text-xs font-normal", children: _jsx(UpdatingDate, { date: notification.createdAt }) })] }), notification.post ? _jsx(CardEvent, { post: notification.post }) : null] }) }));
|
|
200
200
|
}
|
|
201
201
|
function GenericNotification({ notification, }) {
|
|
202
202
|
const t = useT();
|
|
@@ -214,7 +214,7 @@ function GenericNotification({ notification, }) {
|
|
|
214
214
|
profileName: name,
|
|
215
215
|
groupName: notification.group?.displayName,
|
|
216
216
|
});
|
|
217
|
-
return (_jsx(NotificationWrapper, { profile: sender,
|
|
217
|
+
return (_jsx(NotificationWrapper, { profile: sender, group: notification.group, seen: notification.seen, children: notification.post ? (_jsx("a", { href: `/posts/${notification.post.id}`, className: "block w-full px-4", children: _jsx("p", { className: "text-base", children: message }) })) : (_jsx("a", { href: `/@${sender.handle}`, className: "block w-full px-4", children: _jsx("p", { className: "text-base", children: message }) })) }));
|
|
218
218
|
}
|
|
219
219
|
const TYPED = {
|
|
220
220
|
mention: MentionNotification,
|
|
@@ -3,5 +3,5 @@ export type { NotificationItemProps } from './NotificationItem';
|
|
|
3
3
|
export { TypedNotification } from './TypedNotification';
|
|
4
4
|
export { NotificationWrapper } from './NotificationWrapper';
|
|
5
5
|
export { NotificationsList } from './NotificationsList';
|
|
6
|
-
export type { NotificationsListProps } from './NotificationsList';
|
|
6
|
+
export type { NotificationsFeedQuery, NotificationsListProps, } from './NotificationsList';
|
|
7
7
|
export { NotificationHeaderActions } from './NotificationHeaderActions';
|
|
@@ -9,10 +9,16 @@ export interface FeedPostProps {
|
|
|
9
9
|
/** Optional override for the body (used when threading). */
|
|
10
10
|
content?: ReactNode;
|
|
11
11
|
className?: string;
|
|
12
|
+
/** When true, collapses the reply preview/thread rail. */
|
|
13
|
+
hideReply?: boolean;
|
|
14
|
+
/** When true, disables interactive actions (used in previews). */
|
|
15
|
+
previewMode?: boolean;
|
|
16
|
+
/** Override whether the post menu (⋯) is shown. */
|
|
17
|
+
showMenu?: boolean;
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
14
20
|
* Single post card for the chronological feed:
|
|
15
21
|
* shows a small reaction/reply/group banner, the author header, the body,
|
|
16
22
|
* stats and actions. The body component dispatches on `post.type`.
|
|
17
23
|
*/
|
|
18
|
-
export declare function FeedPost({ post, deleteCallback, noReactionHeader, inGroup, showReplyTo, content, className, }: FeedPostProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare function FeedPost({ post, deleteCallback, noReactionHeader, inGroup, showReplyTo, content, className, hideReply, previewMode, showMenu, }: FeedPostProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,12 +15,12 @@ import { FeedThreadPreview } from './pieces/FeedThreadPreview.js';
|
|
|
15
15
|
* shows a small reaction/reply/group banner, the author header, the body,
|
|
16
16
|
* stats and actions. The body component dispatches on `post.type`.
|
|
17
17
|
*/
|
|
18
|
-
export function FeedPost({ post, deleteCallback, noReactionHeader = false, inGroup = false, showReplyTo = false, content, className, }) {
|
|
18
|
+
export function FeedPost({ post, deleteCallback, noReactionHeader = false, inGroup = false, showReplyTo = false, content, className, hideReply = false, previewMode = false, showMenu, }) {
|
|
19
19
|
const { displayedPost, isUnread, hasReactionHeader, showsReplyTo, showThreadPreview, hasStats, viewContext, } = useFeedPostPresentation(post, {
|
|
20
20
|
noReactionHeader,
|
|
21
21
|
inGroup,
|
|
22
22
|
showReplyTo,
|
|
23
23
|
});
|
|
24
24
|
const postViewRef = usePostViewRef(post.id, viewContext);
|
|
25
|
-
return (_jsxs("article", { ref: postViewRef, className: cn('bg-background border-border relative min-w-0 border-b p-4', className), children: [_jsx(UnreadPostIndicator, { show: isUnread, variant: "corner" }), hasReactionHeader && (_jsx(PostReactionHeader, { post: post, inGroup: inGroup, deleteCallback: deleteCallback })), showsReplyTo && displayedPost.replyTo && (_jsx(CompactReplyParent, { post: displayedPost.replyTo })), _jsxs("div", { className: "relative", children: [_jsx(PostInfoHeader, { post: displayedPost, showMenu: !hasReactionHeader, deleteCallback: deleteCallback }), _jsx("div", { className: "min-w-0 pb-2", children: content ?? _jsx(FeedPostContent, { post: displayedPost }) }), hasStats && _jsx(FeedPostStats, { post: displayedPost })] }), _jsx(PostActions, { post: displayedPost }), showThreadPreview ? _jsx(FeedThreadPreview, { post: displayedPost }) : null] }));
|
|
25
|
+
return (_jsxs("article", { ref: postViewRef, className: cn('bg-background border-border relative min-w-0 border-b p-4', className), children: [_jsx(UnreadPostIndicator, { show: isUnread, variant: "corner" }), hasReactionHeader && (_jsx(PostReactionHeader, { post: post, inGroup: inGroup, deleteCallback: deleteCallback, hideReply: hideReply, previewMode: previewMode })), showsReplyTo && displayedPost.replyTo && (_jsx(CompactReplyParent, { post: displayedPost.replyTo })), _jsxs("div", { className: "relative", children: [_jsx(PostInfoHeader, { post: displayedPost, showMenu: showMenu ?? !hasReactionHeader, deleteCallback: deleteCallback }), _jsx("div", { className: "min-w-0 pb-2", children: content ?? _jsx(FeedPostContent, { post: displayedPost }) }), hasStats && _jsx(FeedPostStats, { post: displayedPost })] }), _jsx(PostActions, { post: displayedPost, previewMode: previewMode }), !hideReply && showThreadPreview ? (_jsx(FeedThreadPreview, { post: displayedPost })) : null] }));
|
|
26
26
|
}
|
|
@@ -20,7 +20,7 @@ export function FullPostLayout({ post, deleteCallback, children, }) {
|
|
|
20
20
|
if (isLoading) {
|
|
21
21
|
return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: t('common.loading', { defaultValue: 'Loading…' }) }));
|
|
22
22
|
}
|
|
23
|
-
return (_jsxs(_Fragment, { children: [ancestryThread ? (_jsx("div", { className: threadIndent, children: _jsx(ThreadedFeed, { thread: ancestryThread, isAncestors: true }) })) : null, _jsxs("div", { ref: postRef, className: "relative", children: [children ?? (_jsx(FeedPost, { post: post, deleteCallback: deleteCallback,
|
|
23
|
+
return (_jsxs(_Fragment, { children: [ancestryThread ? (_jsx("div", { className: threadIndent, children: _jsx(ThreadedFeed, { thread: ancestryThread, isAncestors: true }) })) : null, _jsxs("div", { ref: postRef, className: "relative", children: [children ?? (_jsx(FeedPost, { post: post, deleteCallback: deleteCallback, hideReply: true,
|
|
24
24
|
// The page header already names the group. On a repost, keep the
|
|
25
25
|
// banner so it says who shared it instead of hiding that.
|
|
26
26
|
inGroup: !!post.group, noReactionHeader: !post.repost })), ancestryThread ? (_jsx("div", { className: "bg-border-2 pointer-events-none absolute left-10 top-0 h-6 w-px" })) : null] }), _jsx(ReplyBox, { post: post }), descendentThreads.map((thread) => (_jsx("div", { className: threadIndent, children: _jsx(ThreadedFeed, { thread: thread }) }, thread.id))), _jsx("div", { className: "h-[70vh]" })] }));
|
|
@@ -2,5 +2,7 @@ import type { PublicPost } from '@openpeepshq/common/types';
|
|
|
2
2
|
export interface PostActionsProps {
|
|
3
3
|
post: PublicPost;
|
|
4
4
|
compact?: boolean;
|
|
5
|
+
/** When true, disables interactive actions (used in previews). */
|
|
6
|
+
previewMode?: boolean;
|
|
5
7
|
}
|
|
6
|
-
export declare function PostActions({ post, compact }: PostActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export declare function PostActions({ post, compact, previewMode, }: PostActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -4,7 +4,7 @@ import { Button } from '@openpeepshq/react-ui';
|
|
|
4
4
|
import { useT } from '../../../i18n/index.js';
|
|
5
5
|
import { useFeedPostActions } from '../../../hooks/posts/useFeedPostActions.js';
|
|
6
6
|
import { postReactionStats } from '../helpers.js';
|
|
7
|
-
export function PostActions({ post, compact = false }) {
|
|
7
|
+
export function PostActions({ post, compact = false, previewMode = false, }) {
|
|
8
8
|
const t = useT();
|
|
9
9
|
const { me, myRepost, iReacted, canReply, canRepost, canReact, reply, toggleRepost, toggleReaction, } = useFeedPostActions(post);
|
|
10
10
|
if (!me)
|
|
@@ -16,7 +16,7 @@ export function PostActions({ post, compact = false }) {
|
|
|
16
16
|
return (_jsxs("div", { className: "mx-auto grid w-full grid-cols-3 items-center p-2", onClick: (e) => {
|
|
17
17
|
e.preventDefault();
|
|
18
18
|
e.stopPropagation();
|
|
19
|
-
}, onKeyDown: (e) => e.stopPropagation(), role: "presentation", children: [_jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-start`, title: t('posts.actions.reply', { defaultValue: 'Reply' }), action: reply, disabled: !canReply, children: [_jsx(Reply, { className: "h-4 w-4" }), compact ? post.replyCount || null : replyLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-center ${myRepost ? 'text-primary' : ''}`, title: t('posts.actions.repost', { defaultValue: 'Repost' }), action: toggleRepost, disabled: !canRepost, spinnerOnlyOnLoading: true, "data-testid": "posts-repost-button", children: [_jsx(Repeat2, { className: "h-4 w-4" }), compact ? post.repostCount || null : repostLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-end ${iReacted ? 'text-primary' : ''}`, title: t('posts.actions.react', { defaultValue: 'React' }), action: toggleReaction, disabled: !canReact, spinnerOnlyOnLoading: true, children: [_jsx(ThumbsUp, { className: "h-4 w-4" }), compact
|
|
19
|
+
}, onKeyDown: (e) => e.stopPropagation(), role: "presentation", children: [_jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-start`, title: t('posts.actions.reply', { defaultValue: 'Reply' }), action: reply, disabled: previewMode || !canReply, children: [_jsx(Reply, { className: "h-4 w-4" }), compact ? post.replyCount || null : replyLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-center ${myRepost ? 'text-primary' : ''}`, title: t('posts.actions.repost', { defaultValue: 'Repost' }), action: toggleRepost, disabled: previewMode || !canRepost, spinnerOnlyOnLoading: true, "data-testid": "posts-repost-button", children: [_jsx(Repeat2, { className: "h-4 w-4" }), compact ? post.repostCount || null : repostLabel] }), _jsxs(Button, { variant: "unstyled", className: `${actionClass} justify-self-end ${iReacted ? 'text-primary' : ''}`, title: t('posts.actions.react', { defaultValue: 'React' }), action: toggleReaction, disabled: previewMode || !canReact, spinnerOnlyOnLoading: true, children: [_jsx(ThumbsUp, { className: "h-4 w-4" }), compact
|
|
20
20
|
? post.reactions?.length
|
|
21
21
|
? ` · ${postReactionStats(post)}`
|
|
22
22
|
: null
|
|
@@ -3,10 +3,12 @@ export interface PostReactionHeaderProps {
|
|
|
3
3
|
post: PublicPost;
|
|
4
4
|
inGroup?: boolean;
|
|
5
5
|
deleteCallback?: () => void;
|
|
6
|
+
hideReply?: boolean;
|
|
7
|
+
previewMode?: boolean;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* Small banner above feed posts that explains why this post is in the feed
|
|
9
11
|
* (reposted, reply, posted in group X). Translates
|
|
10
12
|
* `PostReactionHeader.svelte`.
|
|
11
13
|
*/
|
|
12
|
-
export declare function PostReactionHeader({ post, inGroup, deleteCallback, }: PostReactionHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
export declare function PostReactionHeader({ post, inGroup, deleteCallback, hideReply: _hideReply, previewMode, }: PostReactionHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -8,7 +8,7 @@ import { PostMenu } from './PostMenu.js';
|
|
|
8
8
|
* (reposted, reply, posted in group X). Translates
|
|
9
9
|
* `PostReactionHeader.svelte`.
|
|
10
10
|
*/
|
|
11
|
-
export function PostReactionHeader({ post, inGroup = false, deleteCallback, }) {
|
|
11
|
+
export function PostReactionHeader({ post, inGroup = false, deleteCallback, hideReply: _hideReply = false, previewMode = false, }) {
|
|
12
12
|
const t = useT();
|
|
13
13
|
const { openpeepsApi } = useOpenpeeps();
|
|
14
14
|
const replyPostQuery = post.inReplyToId
|
|
@@ -27,5 +27,5 @@ export function PostReactionHeader({ post, inGroup = false, deleteCallback, }) {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
const menuPost = post.repost ?? post;
|
|
30
|
-
return (_jsxs("div", { className: "border-border flex items-center justify-between gap-2 border-b py-2 text-sm", children: [_jsx("div", { className: "flex w-5/6 flex-1 items-center gap-2", children: showGroup ? (_jsxs(_Fragment, { children: [isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(Avatar, { profile: post.profile, size: 2.25 }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { className: "w-max", href: `/posts/${post.inReplyToId}`, children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { className: "w-max", profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) }), _jsx("span", { className: "font-light", children: "in" })] })) : (_jsx("span", { className: "font-light", children: "Posted in" })), _jsx("a", { href: `/groups/@${post.group?.handle}`, className: "text-primary flex-1 truncate font-semibold", children: post.group?.displayName })] })) : isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { href: `/posts/${post.inReplyToId}`, className: "text-sm", children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) })] })) : null }), _jsx(PostMenu, { post: menuPost, deleteCallback: deleteCallback })] }));
|
|
30
|
+
return (_jsxs("div", { className: "border-border flex items-center justify-between gap-2 border-b py-2 text-sm", children: [_jsx("div", { className: "flex w-5/6 flex-1 items-center gap-2", children: showGroup ? (_jsxs(_Fragment, { children: [isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(Avatar, { profile: post.profile, size: 2.25 }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { className: "w-max", href: `/posts/${post.inReplyToId}`, children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { className: "w-max", profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) }), _jsx("span", { className: "font-light", children: "in" })] })) : (_jsx("span", { className: "font-light", children: "Posted in" })), _jsx("a", { href: `/groups/@${post.group?.handle}`, className: "text-primary flex-1 truncate font-semibold", children: post.group?.displayName })] })) : isRepost ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("span", { className: "font-light", children: t('posts.reposted', { defaultValue: 'reposted' }) })] })) : isReply && replyPost?.profile ? (_jsxs(_Fragment, { children: [_jsx(ProfileLink, { profile: post.profile, children: _jsx(AvatarWithName, { profile: post.profile }) }), _jsx("a", { href: `/posts/${post.inReplyToId}`, className: "text-sm", children: t('posts.replyTo', { defaultValue: 'replied to' }) }), _jsx(ProfileLink, { profile: replyPost.profile, children: _jsx(AvatarWithName, { profile: replyPost.profile }) })] })) : null }), !previewMode ? (_jsx(PostMenu, { post: menuPost, deleteCallback: deleteCallback })) : null] }));
|
|
31
31
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PublicPost } from '@openpeepshq/common/types';
|
|
2
2
|
export interface FullEventProps {
|
|
3
3
|
post: PublicPost;
|
|
4
|
+
/** Specific occurrence of a recurring event. */
|
|
5
|
+
occurrence?: string;
|
|
4
6
|
}
|
|
5
7
|
export declare function FullEvent({ post }: FullEventProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/react-native.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export * from './components/post/attachmentPreview';
|
|
|
39
39
|
export * from './components/profile/profileFieldDisplay';
|
|
40
40
|
export { firstNWords, postReactionStats, stringToSegments, } from './components/post/helpers';
|
|
41
41
|
export { initializeNewPostStores, getNewPostStores, useNewPostStores, resetStore, defaultNewArticle, defaultNewEvent, defaultNewNote, defaultNewQuestion, eventSanitizer, getReplyStore, resetReplyData, useReplyStore, } from './stores/newPosts';
|
|
42
|
-
export type { NewPostsState } from './stores/types';
|
|
42
|
+
export type { NewPostsState, PlusButtonAction, PlusButtonActions, } from './stores/types';
|
|
43
43
|
export { extractUrlsFromText, isValidUrl, } from './components/preview-link/helpers';
|
|
44
44
|
export { JamProvider, useJamContext, useJamObserver, } from './components/jams/JamContext';
|
|
45
45
|
export type { JamContextValue, JamProviderProps, } from './components/jams/JamContext';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"simple-icons": "^16.31.0",
|
|
52
52
|
"uuidv7": "^1.0.2",
|
|
53
53
|
"@openpeepshq/client": "^0.2.0",
|
|
54
|
-
"@openpeepshq/common": "^0.2.0",
|
|
55
54
|
"@openpeepshq/react-ui": "^0.2.0",
|
|
56
|
-
"@openpeepshq/greenscreen": "^0.2.0"
|
|
55
|
+
"@openpeepshq/greenscreen": "^0.2.0",
|
|
56
|
+
"@openpeepshq/common": "^0.2.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": "^18.3.0 || ^19.0.0",
|
|
@@ -4,7 +4,10 @@ import { useT } from '../../i18n';
|
|
|
4
4
|
|
|
5
5
|
export interface ConfigMenuButtonProps {
|
|
6
6
|
translationPrefix: string;
|
|
7
|
-
|
|
7
|
+
/** URL path for navigation (web). */
|
|
8
|
+
action?: string;
|
|
9
|
+
/** Click handler — renders a button instead of a Link when provided. */
|
|
10
|
+
onPress?: () => void;
|
|
8
11
|
testId?: string;
|
|
9
12
|
titleFallback?: string;
|
|
10
13
|
descriptionFallback?: string;
|
|
@@ -17,17 +20,14 @@ export interface ConfigMenuButtonProps {
|
|
|
17
20
|
export function ConfigMenuButton({
|
|
18
21
|
translationPrefix,
|
|
19
22
|
action,
|
|
23
|
+
onPress,
|
|
20
24
|
testId,
|
|
21
25
|
titleFallback,
|
|
22
26
|
descriptionFallback,
|
|
23
27
|
}: ConfigMenuButtonProps) {
|
|
24
28
|
const t = useT();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
to={action}
|
|
28
|
-
data-testid={testId}
|
|
29
|
-
className="hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start"
|
|
30
|
-
>
|
|
29
|
+
const content = (
|
|
30
|
+
<>
|
|
31
31
|
<div>
|
|
32
32
|
<div className="font-medium">
|
|
33
33
|
{t(
|
|
@@ -45,6 +45,28 @@ export function ConfigMenuButton({
|
|
|
45
45
|
<span aria-hidden="true">
|
|
46
46
|
<ChevronRight className="h-4 w-4" />
|
|
47
47
|
</span>
|
|
48
|
+
</>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
if (onPress) {
|
|
52
|
+
return (
|
|
53
|
+
<button
|
|
54
|
+
data-testid={testId}
|
|
55
|
+
onClick={onPress}
|
|
56
|
+
className="hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start"
|
|
57
|
+
>
|
|
58
|
+
{content}
|
|
59
|
+
</button>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Link
|
|
65
|
+
to={action ?? ''}
|
|
66
|
+
data-testid={testId}
|
|
67
|
+
className="hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start"
|
|
68
|
+
>
|
|
69
|
+
{content}
|
|
48
70
|
</Link>
|
|
49
71
|
);
|
|
50
72
|
}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { Dot, User, Users } from 'lucide-react';
|
|
3
|
-
import type { PublicProfile } from '@openpeepshq/common/types';
|
|
3
|
+
import type { Group, PublicProfile } from '@openpeepshq/common/types';
|
|
4
4
|
import { Avatar, ProfileLink } from '../profile';
|
|
5
|
+
import { GroupAvatar } from '../groups/GroupAvatar';
|
|
5
6
|
|
|
6
7
|
export interface NotificationWrapperProps {
|
|
7
8
|
profile: PublicProfile;
|
|
8
9
|
seen?: boolean;
|
|
9
|
-
|
|
10
|
+
group?: Group | null;
|
|
10
11
|
showProfile?: boolean;
|
|
11
12
|
children: ReactNode;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export function NotificationWrapper({
|
|
15
16
|
profile,
|
|
17
|
+
group,
|
|
16
18
|
seen = true,
|
|
17
|
-
isGroup = false,
|
|
18
19
|
showProfile = true,
|
|
19
20
|
children,
|
|
20
21
|
}: NotificationWrapperProps) {
|
|
@@ -26,14 +27,19 @@ export function NotificationWrapper({
|
|
|
26
27
|
|
|
27
28
|
{showProfile ? (
|
|
28
29
|
<div className="flex items-center gap-4 px-6">
|
|
29
|
-
{
|
|
30
|
-
|
|
30
|
+
{group ? (
|
|
31
|
+
<>
|
|
32
|
+
<Users className="text-muted-foreground h-8 w-8" />
|
|
33
|
+
<GroupAvatar group={group} size={3.5} borderless />
|
|
34
|
+
</>
|
|
31
35
|
) : (
|
|
32
|
-
|
|
36
|
+
<>
|
|
37
|
+
<User className="text-muted-foreground h-8 w-8" />
|
|
38
|
+
<ProfileLink profile={profile}>
|
|
39
|
+
<Avatar profile={profile} size={3.5} />
|
|
40
|
+
</ProfileLink>
|
|
41
|
+
</>
|
|
33
42
|
)}
|
|
34
|
-
<ProfileLink profile={profile}>
|
|
35
|
-
<Avatar profile={profile} size={3.5} />
|
|
36
|
-
</ProfileLink>
|
|
37
43
|
</div>
|
|
38
44
|
) : null}
|
|
39
45
|
<div className="flex flex-1 flex-col">{children}</div>
|
|
@@ -2,7 +2,12 @@ import { useCallback, useEffect, useRef, useMemo } from 'react';
|
|
|
2
2
|
import type {
|
|
3
3
|
NotificationStats,
|
|
4
4
|
PublicNotification,
|
|
5
|
+
SuccessFailureResponse,
|
|
5
6
|
} from '@openpeepshq/common/types';
|
|
7
|
+
import type {
|
|
8
|
+
InfiniteData,
|
|
9
|
+
UseInfiniteQueryResult,
|
|
10
|
+
} from '@tanstack/react-query';
|
|
6
11
|
|
|
7
12
|
import { useT } from '../../i18n';
|
|
8
13
|
import { useOpenpeeps } from '../../contexts/openpeeps';
|
|
@@ -13,8 +18,18 @@ import {
|
|
|
13
18
|
import { NotificationItem } from './NotificationItem';
|
|
14
19
|
import { LoadingSpinner } from '@openpeepshq/react-ui';
|
|
15
20
|
|
|
21
|
+
export type NotificationsFeedQuery = UseInfiniteQueryResult<
|
|
22
|
+
InfiniteData<PublicNotification[]>,
|
|
23
|
+
SuccessFailureResponse
|
|
24
|
+
>;
|
|
25
|
+
|
|
16
26
|
export interface NotificationsListProps {
|
|
27
|
+
/** Supply your own query to control fetching externally. When omitted, the
|
|
28
|
+
* component fetches `useCurrentProfileNotifications` internally. */
|
|
29
|
+
query?: NotificationsFeedQuery;
|
|
17
30
|
pageSize?: number;
|
|
31
|
+
isNotificationFeed?: boolean;
|
|
32
|
+
onRefresh?: () => Promise<unknown>;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
/**
|
|
@@ -25,14 +40,20 @@ export interface NotificationsListProps {
|
|
|
25
40
|
* Also marks all notifications as seen on mount and clears the PWA app badge
|
|
26
41
|
* — matching the Svelte version's `onMount`.
|
|
27
42
|
*/
|
|
28
|
-
export function NotificationsList({
|
|
43
|
+
export function NotificationsList({
|
|
44
|
+
query: externalQuery,
|
|
45
|
+
pageSize = 15,
|
|
46
|
+
onRefresh,
|
|
47
|
+
}: NotificationsListProps) {
|
|
29
48
|
const t = useT();
|
|
30
49
|
const { openpeepsApi, queryClient, client } = useOpenpeeps();
|
|
31
50
|
const sentinelRef = useRef<HTMLDivElement | null>(null);
|
|
32
51
|
|
|
33
|
-
const query =
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
const query =
|
|
53
|
+
externalQuery ??
|
|
54
|
+
openpeepsApi.useCurrentProfileNotifications({
|
|
55
|
+
limit: pageSize,
|
|
56
|
+
});
|
|
36
57
|
|
|
37
58
|
const markAllNotificationsAsSeen =
|
|
38
59
|
openpeepsApi.markAllNotificationsAsSeenAction()();
|
|
@@ -64,13 +85,13 @@ export function NotificationsList({ pageSize = 15 }: NotificationsListProps) {
|
|
|
64
85
|
if (typeof document === 'undefined') return;
|
|
65
86
|
const onVisibilityChange = () => {
|
|
66
87
|
if (document.visibilityState === 'visible') {
|
|
67
|
-
void refetch();
|
|
88
|
+
void (onRefresh ? onRefresh() : refetch());
|
|
68
89
|
}
|
|
69
90
|
};
|
|
70
91
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
71
92
|
return () =>
|
|
72
93
|
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
73
|
-
}, [refetch]);
|
|
94
|
+
}, [refetch, onRefresh]);
|
|
74
95
|
|
|
75
96
|
const notifications = useMemo(() => {
|
|
76
97
|
const flat: PublicNotification[] = (query.data?.pages ?? []).flat();
|
|
@@ -585,8 +585,8 @@ function JamNotification({
|
|
|
585
585
|
return (
|
|
586
586
|
<NotificationWrapper
|
|
587
587
|
profile={profile}
|
|
588
|
+
group={notification.group}
|
|
588
589
|
seen={notification.seen}
|
|
589
|
-
isGroup={!!notification.group}
|
|
590
590
|
>
|
|
591
591
|
<a
|
|
592
592
|
href={`/posts/${notification.post?.id}`}
|
|
@@ -631,8 +631,8 @@ function GenericNotification({
|
|
|
631
631
|
return (
|
|
632
632
|
<NotificationWrapper
|
|
633
633
|
profile={sender}
|
|
634
|
+
group={notification.group}
|
|
634
635
|
seen={notification.seen}
|
|
635
|
-
isGroup={!!notification.group}
|
|
636
636
|
>
|
|
637
637
|
{notification.post ? (
|
|
638
638
|
<a
|
|
@@ -3,5 +3,8 @@ export type { NotificationItemProps } from './NotificationItem';
|
|
|
3
3
|
export { TypedNotification } from './TypedNotification';
|
|
4
4
|
export { NotificationWrapper } from './NotificationWrapper';
|
|
5
5
|
export { NotificationsList } from './NotificationsList';
|
|
6
|
-
export type {
|
|
6
|
+
export type {
|
|
7
|
+
NotificationsFeedQuery,
|
|
8
|
+
NotificationsListProps,
|
|
9
|
+
} from './NotificationsList';
|
|
7
10
|
export { NotificationHeaderActions } from './NotificationHeaderActions';
|
|
@@ -22,6 +22,12 @@ export interface FeedPostProps {
|
|
|
22
22
|
/** Optional override for the body (used when threading). */
|
|
23
23
|
content?: ReactNode;
|
|
24
24
|
className?: string;
|
|
25
|
+
/** When true, collapses the reply preview/thread rail. */
|
|
26
|
+
hideReply?: boolean;
|
|
27
|
+
/** When true, disables interactive actions (used in previews). */
|
|
28
|
+
previewMode?: boolean;
|
|
29
|
+
/** Override whether the post menu (⋯) is shown. */
|
|
30
|
+
showMenu?: boolean;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -37,6 +43,9 @@ export function FeedPost({
|
|
|
37
43
|
showReplyTo = false,
|
|
38
44
|
content,
|
|
39
45
|
className,
|
|
46
|
+
hideReply = false,
|
|
47
|
+
previewMode = false,
|
|
48
|
+
showMenu,
|
|
40
49
|
}: FeedPostProps) {
|
|
41
50
|
const {
|
|
42
51
|
displayedPost,
|
|
@@ -67,6 +76,8 @@ export function FeedPost({
|
|
|
67
76
|
post={post}
|
|
68
77
|
inGroup={inGroup}
|
|
69
78
|
deleteCallback={deleteCallback}
|
|
79
|
+
hideReply={hideReply}
|
|
80
|
+
previewMode={previewMode}
|
|
70
81
|
/>
|
|
71
82
|
)}
|
|
72
83
|
|
|
@@ -77,7 +88,7 @@ export function FeedPost({
|
|
|
77
88
|
<div className="relative">
|
|
78
89
|
<PostInfoHeader
|
|
79
90
|
post={displayedPost}
|
|
80
|
-
showMenu={!hasReactionHeader}
|
|
91
|
+
showMenu={showMenu ?? !hasReactionHeader}
|
|
81
92
|
deleteCallback={deleteCallback}
|
|
82
93
|
/>
|
|
83
94
|
<div className="min-w-0 pb-2">
|
|
@@ -86,8 +97,10 @@ export function FeedPost({
|
|
|
86
97
|
{hasStats && <FeedPostStats post={displayedPost} />}
|
|
87
98
|
</div>
|
|
88
99
|
|
|
89
|
-
<PostActions post={displayedPost} />
|
|
90
|
-
{showThreadPreview ?
|
|
100
|
+
<PostActions post={displayedPost} previewMode={previewMode} />
|
|
101
|
+
{!hideReply && showThreadPreview ? (
|
|
102
|
+
<FeedThreadPreview post={displayedPost} />
|
|
103
|
+
) : null}
|
|
91
104
|
</article>
|
|
92
105
|
);
|
|
93
106
|
}
|
|
@@ -53,6 +53,7 @@ export function FullPostLayout({
|
|
|
53
53
|
<FeedPost
|
|
54
54
|
post={post}
|
|
55
55
|
deleteCallback={deleteCallback}
|
|
56
|
+
hideReply
|
|
56
57
|
// The page header already names the group. On a repost, keep the
|
|
57
58
|
// banner so it says who shared it instead of hiding that.
|
|
58
59
|
inGroup={!!post.group}
|
|
@@ -8,9 +8,15 @@ import { postReactionStats } from '../helpers';
|
|
|
8
8
|
export interface PostActionsProps {
|
|
9
9
|
post: PublicPost;
|
|
10
10
|
compact?: boolean;
|
|
11
|
+
/** When true, disables interactive actions (used in previews). */
|
|
12
|
+
previewMode?: boolean;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export function PostActions({
|
|
15
|
+
export function PostActions({
|
|
16
|
+
post,
|
|
17
|
+
compact = false,
|
|
18
|
+
previewMode = false,
|
|
19
|
+
}: PostActionsProps) {
|
|
14
20
|
const t = useT();
|
|
15
21
|
const {
|
|
16
22
|
me,
|
|
@@ -48,7 +54,7 @@ export function PostActions({ post, compact = false }: PostActionsProps) {
|
|
|
48
54
|
className={`${actionClass} justify-self-start`}
|
|
49
55
|
title={t('posts.actions.reply', { defaultValue: 'Reply' })}
|
|
50
56
|
action={reply}
|
|
51
|
-
disabled={!canReply}
|
|
57
|
+
disabled={previewMode || !canReply}
|
|
52
58
|
>
|
|
53
59
|
<Reply className="h-4 w-4" />
|
|
54
60
|
{compact ? post.replyCount || null : replyLabel}
|
|
@@ -58,7 +64,7 @@ export function PostActions({ post, compact = false }: PostActionsProps) {
|
|
|
58
64
|
className={`${actionClass} justify-self-center ${myRepost ? 'text-primary' : ''}`}
|
|
59
65
|
title={t('posts.actions.repost', { defaultValue: 'Repost' })}
|
|
60
66
|
action={toggleRepost}
|
|
61
|
-
disabled={!canRepost}
|
|
67
|
+
disabled={previewMode || !canRepost}
|
|
62
68
|
spinnerOnlyOnLoading
|
|
63
69
|
data-testid="posts-repost-button"
|
|
64
70
|
>
|
|
@@ -70,7 +76,7 @@ export function PostActions({ post, compact = false }: PostActionsProps) {
|
|
|
70
76
|
className={`${actionClass} justify-self-end ${iReacted ? 'text-primary' : ''}`}
|
|
71
77
|
title={t('posts.actions.react', { defaultValue: 'React' })}
|
|
72
78
|
action={toggleReaction}
|
|
73
|
-
disabled={!canReact}
|
|
79
|
+
disabled={previewMode || !canReact}
|
|
74
80
|
spinnerOnlyOnLoading
|
|
75
81
|
>
|
|
76
82
|
<ThumbsUp className="h-4 w-4" />
|
|
@@ -8,6 +8,8 @@ export interface PostReactionHeaderProps {
|
|
|
8
8
|
post: PublicPost;
|
|
9
9
|
inGroup?: boolean;
|
|
10
10
|
deleteCallback?: () => void;
|
|
11
|
+
hideReply?: boolean;
|
|
12
|
+
previewMode?: boolean;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -19,6 +21,8 @@ export function PostReactionHeader({
|
|
|
19
21
|
post,
|
|
20
22
|
inGroup = false,
|
|
21
23
|
deleteCallback,
|
|
24
|
+
hideReply: _hideReply = false,
|
|
25
|
+
previewMode = false,
|
|
22
26
|
}: PostReactionHeaderProps) {
|
|
23
27
|
const t = useT();
|
|
24
28
|
const { openpeepsApi } = useOpenpeeps();
|
|
@@ -103,7 +107,9 @@ export function PostReactionHeader({
|
|
|
103
107
|
</>
|
|
104
108
|
) : null}
|
|
105
109
|
</div>
|
|
106
|
-
|
|
110
|
+
{!previewMode ? (
|
|
111
|
+
<PostMenu post={menuPost} deleteCallback={deleteCallback} />
|
|
112
|
+
) : null}
|
|
107
113
|
</div>
|
|
108
114
|
);
|
|
109
115
|
}
|
package/src/react-native.ts
CHANGED
|
@@ -83,7 +83,11 @@ export {
|
|
|
83
83
|
resetReplyData,
|
|
84
84
|
useReplyStore,
|
|
85
85
|
} from './stores/newPosts';
|
|
86
|
-
export type {
|
|
86
|
+
export type {
|
|
87
|
+
NewPostsState,
|
|
88
|
+
PlusButtonAction,
|
|
89
|
+
PlusButtonActions,
|
|
90
|
+
} from './stores/types';
|
|
87
91
|
export {
|
|
88
92
|
extractUrlsFromText,
|
|
89
93
|
isValidUrl,
|