@openpeepshq/react 0.3.3 → 0.5.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.
Files changed (42) hide show
  1. package/dist/components/configuration/ConfigMenuButton.d.ts +5 -2
  2. package/dist/components/configuration/ConfigMenuButton.js +7 -3
  3. package/dist/components/notifications/NotificationWrapper.d.ts +3 -3
  4. package/dist/components/notifications/NotificationWrapper.js +4 -3
  5. package/dist/components/notifications/NotificationsList.d.ts +9 -1
  6. package/dist/components/notifications/NotificationsList.js +7 -6
  7. package/dist/components/notifications/TypedNotification.js +2 -2
  8. package/dist/components/notifications/index.d.ts +1 -1
  9. package/dist/components/post/FeedPost.d.ts +7 -1
  10. package/dist/components/post/FeedPost.js +2 -2
  11. package/dist/components/post/FullPostLayout.js +1 -1
  12. package/dist/components/post/PostDetail.d.ts +2 -1
  13. package/dist/components/post/PostDetail.js +3 -3
  14. package/dist/components/post/pieces/PostActions.d.ts +3 -1
  15. package/dist/components/post/pieces/PostActions.js +2 -2
  16. package/dist/components/post/pieces/PostInfoHeader.js +1 -1
  17. package/dist/components/post/pieces/PostReactionHeader.d.ts +3 -1
  18. package/dist/components/post/pieces/PostReactionHeader.js +2 -2
  19. package/dist/components/post/types/event/FullEvent.d.ts +3 -1
  20. package/dist/components/post/types/event/FullEvent.js +2 -4
  21. package/dist/components/preview-link/local/PostPreview.js +1 -1
  22. package/dist/hooks/profile/useFollowProfile.d.ts +2 -2
  23. package/dist/pages/PostDetail.js +5 -2
  24. package/dist/react-native.d.ts +2 -0
  25. package/dist/react-native.js +2 -0
  26. package/package.json +4 -4
  27. package/src/components/configuration/ConfigMenuButton.tsx +29 -7
  28. package/src/components/notifications/NotificationWrapper.tsx +15 -9
  29. package/src/components/notifications/NotificationsList.tsx +27 -6
  30. package/src/components/notifications/TypedNotification.tsx +2 -2
  31. package/src/components/notifications/index.ts +4 -1
  32. package/src/components/post/FeedPost.tsx +16 -3
  33. package/src/components/post/FullPostLayout.tsx +1 -0
  34. package/src/components/post/PostDetail.tsx +5 -4
  35. package/src/components/post/pieces/PostActions.tsx +10 -4
  36. package/src/components/post/pieces/PostInfoHeader.tsx +1 -1
  37. package/src/components/post/pieces/PostReactionHeader.tsx +7 -1
  38. package/src/components/post/types/event/FullEvent.tsx +4 -4
  39. package/src/components/preview-link/local/PostPreview.tsx +1 -1
  40. package/src/hooks/profile/useFollowProfile.ts +2 -2
  41. package/src/pages/PostDetail.tsx +5 -2
  42. package/src/react-native.ts +6 -0
@@ -1,6 +1,9 @@
1
1
  export interface ConfigMenuButtonProps {
2
2
  translationPrefix: string;
3
- action: string;
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
- return (_jsxs(Link, { to: action, "data-testid": testId, className: "hover:bg-surface flex w-full items-center justify-between px-4 py-3 text-start", 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" }) })] }));
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
- isGroup?: boolean;
6
+ group?: Group | null;
7
7
  showProfile?: boolean;
8
8
  children: ReactNode;
9
9
  }
10
- export declare function NotificationWrapper({ profile, seen, isGroup, showProfile, children, }: NotificationWrapperProps): import("react/jsx-runtime").JSX.Element;
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
- export function NotificationWrapper({ profile, seen = true, isGroup = false, showProfile = true, children, }) {
5
- 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 ? (_jsxs("div", { className: "flex items-center gap-4 px-6", children: [isGroup ? (_jsx(Users, { className: "text-muted-foreground h-8 w-8" })) : (_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 })] }));
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 = openpeepsApi.useCurrentProfileNotifications({
21
- limit: pageSize,
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, seen: notification.seen, isGroup: !!notification.group, 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] }) }));
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, seen: notification.seen, isGroup: !!notification.group, 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 }) })) }));
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]" })] }));
@@ -1,4 +1,5 @@
1
1
  export interface PostDetailProps {
2
2
  postId: string;
3
+ occurrence?: string;
3
4
  }
4
- export declare function PostDetail({ postId }: PostDetailProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function PostDetail({ postId, occurrence }: PostDetailProps): import("react/jsx-runtime").JSX.Element;
@@ -6,13 +6,13 @@ import { FullArticle } from './types/article/FullArticle.js';
6
6
  import { FullPoll } from './types/poll/FullPoll.js';
7
7
  import { FullEvent } from './types/event/FullEvent.js';
8
8
  import { LoadingSpinner } from '@openpeepshq/react-ui';
9
- export function PostDetail({ postId }) {
9
+ export function PostDetail({ postId, occurrence }) {
10
10
  const t = useT();
11
11
  const { openpeepsApi } = useOpenpeeps();
12
12
  const postQuery = openpeepsApi.usePost(postId);
13
13
  const post = postQuery.data;
14
14
  if (postQuery.isLoading) {
15
- return (_jsx("div", { className: "flex h-32 items-center justify-center text-sm text-muted-foreground", children: _jsx(LoadingSpinner, {}) }));
15
+ return (_jsx("div", { className: "text-muted-foreground flex h-32 items-center justify-center text-sm", children: _jsx(LoadingSpinner, {}) }));
16
16
  }
17
17
  if (!post) {
18
18
  return (_jsx("div", { className: "flex h-full items-center justify-center p-8", children: _jsx("p", { className: "text-2xl font-bold", children: t('post.notFound', { defaultValue: 'Post not found' }) }) }));
@@ -21,7 +21,7 @@ export function PostDetail({ postId }) {
21
21
  case 'article':
22
22
  return _jsx(FullArticle, { post: post });
23
23
  case 'event':
24
- return _jsx(FullEvent, { post: post });
24
+ return _jsx(FullEvent, { post: post, occurrence: occurrence });
25
25
  case 'question':
26
26
  return _jsx(FullPoll, { post: post });
27
27
  case 'note':
@@ -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
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Avatar, ProfileLink } from '../../profile/index.js';
3
3
  import { UpdatingDate } from '@openpeepshq/react-ui';
4
4
  import { PostMenu } from './PostMenu.js';
5
- export function PostInfoHeader({ post, showMenu = false, deleteCallback, }) {
5
+ export function PostInfoHeader({ post, showMenu = true, deleteCallback, }) {
6
6
  const { profile } = post;
7
7
  return (_jsxs("div", { className: "flex justify-between py-2", children: [_jsxs("div", { className: "flex w-fit gap-2", children: [_jsx(ProfileLink, { profile: profile, children: _jsx(Avatar, { profile: profile, size: 3, borderless: true }) }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(ProfileLink, { profile: profile, className: "text-sm font-semibold hover:underline", children: profile.displayName || `@${profile.handle}` }), _jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: ["@", profile.handle, _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx(UpdatingDate, { date: post.createdAt })] })] })] }), showMenu && 'id' in post ? (_jsx(PostMenu, { post: post, deleteCallback: deleteCallback })) : null] }));
8
8
  }
@@ -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
- export declare function FullEvent({ post }: FullEventProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function FullEvent({ post, occurrence }: FullEventProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Download, EyeOff, MoreHorizontal, Share, Trash2 } from 'lucide-react';
3
3
  import { useCallback, useMemo, useState } from 'react';
4
- import { useSearchParams } from 'react-router-dom';
5
4
  import { buildThreads, canAccessJamRecordings, canManageEventRsvps, canModerateJam, canViewJamAttendees, countYesRsvps, effectiveEventTimes, eventTimeZoneOptions, formatEventClockTime, formatEventRecurrence, getJamUrl, groupName, isCapacityEvent, parseOccurrenceQuery, listRsvpOccurrences, profileName, } from '@openpeepshq/common/lib';
6
5
  import { Button, Dialog, DialogActions, DialogContent, DialogHeader, DialogTitle, LoadingSpinner, UpdatingDate, } from '@openpeepshq/react-ui';
7
6
  import { useOpenpeeps } from '../../../../contexts/openpeeps/index.js';
@@ -23,13 +22,12 @@ import { EventRsvpButton } from '../../pieces/EventRsvpButton.js';
23
22
  import { EventRsvpList } from '../../pieces/EventRsvpList.js';
24
23
  import { ShareMenu } from '../../pieces/ShareMenu.js';
25
24
  import { VideoPlayer } from '../../pieces/VideoPlayer.js';
26
- export function FullEvent({ post }) {
25
+ export function FullEvent({ post, occurrence }) {
27
26
  const t = useT();
28
27
  const profile = useCurrentProfile();
29
28
  const serverInfo = useServerInfo();
30
29
  const livekitEnabled = serverInfo.jams.livekit.enabled;
31
- const [searchParams] = useSearchParams();
32
- const occurrenceId = parseOccurrenceQuery(searchParams.get('occurrence'));
30
+ const occurrenceId = parseOccurrenceQuery(occurrence);
33
31
  const { openCreateConversation } = useCreateNewConversation();
34
32
  const postViewRef = usePostViewRef(post.id);
35
33
  const { openpeepsApi, client } = useOpenpeeps();
@@ -12,5 +12,5 @@ export function PostPreview({ path }) {
12
12
  }
13
13
  if (!postQuery.data)
14
14
  return null;
15
- return (_jsxs(_Fragment, { children: [_jsx(PostInfoHeader, { post: postQuery.data }), _jsx(FeedPostContent, { post: postQuery.data })] }));
15
+ return (_jsxs(_Fragment, { children: [_jsx(PostInfoHeader, { post: postQuery.data, showMenu: false }), _jsx(FeedPostContent, { post: postQuery.data })] }));
16
16
  }
@@ -1,5 +1,5 @@
1
- import type { PublicProfile } from '@openpeepshq/common/types';
2
- export declare const useFollowProfile: (profile: PublicProfile, onSuccess?: () => void) => {
1
+ import type { PublicProfile, Profile } from '@openpeepshq/common/types';
2
+ export declare const useFollowProfile: (profile: PublicProfile | Profile, onSuccess?: () => void) => {
3
3
  me: import("@openpeepshq/common").ProfileWithMeta | undefined;
4
4
  isSelf: boolean;
5
5
  isFollowing: boolean;
@@ -1,12 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useMemo } from 'react';
3
- import { Link, useParams } from 'react-router-dom';
3
+ import { Link, useSearchParams, useParams } from 'react-router-dom';
4
+ import { parseOccurrenceQuery } from '@openpeepshq/common/lib';
4
5
  import { useT, useSetPageHeader } from '../index.js';
5
6
  import { usePostDetailTitle } from '../hooks/posts/usePostDetailTitle.js';
6
7
  import { PostDetail as PostDetailComponent } from '../components/index.js';
7
8
  export function PostDetail() {
8
9
  const t = useT();
9
10
  const { postId = '' } = useParams();
11
+ const [searchParams] = useSearchParams();
12
+ const occurrence = parseOccurrenceQuery(searchParams.get('occurrence'));
10
13
  const { kindTitle, groupHandle, groupLabel, inGroup } = usePostDetailTitle(postId);
11
14
  const title = useMemo(() => {
12
15
  if (!inGroup)
@@ -14,5 +17,5 @@ export function PostDetail() {
14
17
  return (_jsxs("h1", { className: "flex min-w-0 items-baseline gap-x-1 text-xl font-semibold", children: [_jsx("span", { className: "truncate", children: kindTitle }), _jsx("span", { className: "shrink-0", children: t('post.detail.inGroup', { defaultValue: 'in' }) }), _jsx(Link, { to: `/groups/@${groupHandle}`, className: "text-primary min-w-0 truncate hover:underline", children: groupLabel })] }));
15
18
  }, [groupHandle, groupLabel, inGroup, kindTitle, t]);
16
19
  useSetPageHeader(title);
17
- return _jsx(PostDetailComponent, { postId: postId });
20
+ return _jsx(PostDetailComponent, { postId: postId, occurrence: occurrence });
18
21
  }
@@ -10,6 +10,8 @@ export * from './lib/analyticsClicks';
10
10
  export * from './lib/unseenCountsOptimistic';
11
11
  export * from './lib/postUnread';
12
12
  export * from './lib/notificationBadge';
13
+ export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar';
14
+ export { svgCoverSrc } from './lib/svgCover';
13
15
  export * from './lib/capabilityMatrix';
14
16
  export * from './lib/groupFormErrors';
15
17
  export * from './lib/passwordStrength';
@@ -10,6 +10,8 @@ export * from './lib/analyticsClicks.js';
10
10
  export * from './lib/unseenCountsOptimistic.js';
11
11
  export * from './lib/postUnread.js';
12
12
  export * from './lib/notificationBadge.js';
13
+ export { getInitials, hueFromHandle, initialsBackground, } from './lib/initialsAvatar.js';
14
+ export { svgCoverSrc } from './lib/svgCover.js';
13
15
  export * from './lib/capabilityMatrix.js';
14
16
  export * from './lib/groupFormErrors.js';
15
17
  export * from './lib/passwordStrength.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/react",
3
- "version": "0.3.3",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -50,10 +50,10 @@
50
50
  "react-i18next": "^15.4.1",
51
51
  "simple-icons": "^16.31.0",
52
52
  "uuidv7": "^1.0.2",
53
- "@openpeepshq/client": "^0.2.0",
54
- "@openpeepshq/greenscreen": "^0.2.0",
55
53
  "@openpeepshq/common": "^0.2.0",
56
- "@openpeepshq/react-ui": "^0.2.0"
54
+ "@openpeepshq/react-ui": "^0.3.0",
55
+ "@openpeepshq/greenscreen": "^0.2.0",
56
+ "@openpeepshq/client": "^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
- action: string;
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
- return (
26
- <Link
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
- isGroup?: boolean;
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
- {isGroup ? (
30
- <Users className="text-muted-foreground h-8 w-8" />
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
- <User className="text-muted-foreground h-8 w-8" />
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({ pageSize = 15 }: NotificationsListProps) {
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 = openpeepsApi.useCurrentProfileNotifications({
34
- limit: pageSize,
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 { NotificationsListProps } from './NotificationsList';
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 ? <FeedThreadPreview post={displayedPost} /> : null}
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,10 @@ import { LoadingSpinner } from '@openpeepshq/react-ui';
8
8
 
9
9
  export interface PostDetailProps {
10
10
  postId: string;
11
+ occurrence?: string;
11
12
  }
12
13
 
13
- export function PostDetail({ postId }: PostDetailProps) {
14
+ export function PostDetail({ postId, occurrence }: PostDetailProps) {
14
15
  const t = useT();
15
16
  const { openpeepsApi } = useOpenpeeps();
16
17
  const postQuery = openpeepsApi.usePost(postId);
@@ -18,9 +19,9 @@ export function PostDetail({ postId }: PostDetailProps) {
18
19
 
19
20
  if (postQuery.isLoading) {
20
21
  return (
21
- <div className="flex h-32 items-center justify-center text-sm text-muted-foreground">
22
+ <div className="text-muted-foreground flex h-32 items-center justify-center text-sm">
22
23
  <LoadingSpinner />
23
- </div>
24
+ </div>
24
25
  );
25
26
  }
26
27
 
@@ -38,7 +39,7 @@ export function PostDetail({ postId }: PostDetailProps) {
38
39
  case 'article':
39
40
  return <FullArticle post={post} />;
40
41
  case 'event':
41
- return <FullEvent post={post} />;
42
+ return <FullEvent post={post} occurrence={occurrence} />;
42
43
  case 'question':
43
44
  return <FullPoll post={post} />;
44
45
  case 'note':
@@ -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({ post, compact = false }: PostActionsProps) {
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" />
@@ -11,7 +11,7 @@ export interface PostInfoHeaderProps {
11
11
 
12
12
  export function PostInfoHeader({
13
13
  post,
14
- showMenu = false,
14
+ showMenu = true,
15
15
  deleteCallback,
16
16
  }: PostInfoHeaderProps) {
17
17
  const { profile } = post;
@@ -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
- <PostMenu post={menuPost} deleteCallback={deleteCallback} />
110
+ {!previewMode ? (
111
+ <PostMenu post={menuPost} deleteCallback={deleteCallback} />
112
+ ) : null}
107
113
  </div>
108
114
  );
109
115
  }
@@ -1,6 +1,5 @@
1
1
  import { Download, EyeOff, MoreHorizontal, Share, Trash2 } from 'lucide-react';
2
2
  import { useCallback, useMemo, useState } from 'react';
3
- import { useSearchParams } from 'react-router-dom';
4
3
  import type {
5
4
  Event,
6
5
  JamRecording,
@@ -57,6 +56,8 @@ import { VideoPlayer } from '../../pieces/VideoPlayer';
57
56
 
58
57
  export interface FullEventProps {
59
58
  post: PublicPost;
59
+ /** Specific occurrence of a recurring event. */
60
+ occurrence?: string;
60
61
  }
61
62
 
62
63
  type EventTab =
@@ -66,13 +67,12 @@ type EventTab =
66
67
  | 'attendees'
67
68
  | 'recordings';
68
69
 
69
- export function FullEvent({ post }: FullEventProps) {
70
+ export function FullEvent({ post, occurrence }: FullEventProps) {
70
71
  const t = useT();
71
72
  const profile = useCurrentProfile();
72
73
  const serverInfo = useServerInfo();
73
74
  const livekitEnabled = serverInfo.jams.livekit.enabled;
74
- const [searchParams] = useSearchParams();
75
- const occurrenceId = parseOccurrenceQuery(searchParams.get('occurrence'));
75
+ const occurrenceId = parseOccurrenceQuery(occurrence);
76
76
  const { openCreateConversation } = useCreateNewConversation();
77
77
  const postViewRef = usePostViewRef(post.id);
78
78
  const { openpeepsApi, client } = useOpenpeeps();
@@ -24,7 +24,7 @@ export function PostPreview({ path }: PostPreviewProps) {
24
24
 
25
25
  return (
26
26
  <>
27
- <PostInfoHeader post={postQuery.data} />
27
+ <PostInfoHeader post={postQuery.data} showMenu={false} />
28
28
  <FeedPostContent post={postQuery.data} />
29
29
  </>
30
30
  );
@@ -1,9 +1,9 @@
1
- import type { PublicProfile } from '@openpeepshq/common/types';
1
+ import type { PublicProfile, Profile } from '@openpeepshq/common/types';
2
2
  import { useOpenpeeps } from '../../contexts/openpeeps';
3
3
  import { useCurrentProfile } from '../../components/layout/IdentityContext';
4
4
 
5
5
  export const useFollowProfile = (
6
- profile: PublicProfile,
6
+ profile: PublicProfile | Profile,
7
7
  onSuccess?: () => void,
8
8
  ) => {
9
9
  const me = useCurrentProfile();
@@ -1,5 +1,6 @@
1
1
  import { useMemo, type ReactNode } from 'react';
2
- import { Link, useParams } from 'react-router-dom';
2
+ import { Link, useSearchParams, useParams } from 'react-router-dom';
3
+ import { parseOccurrenceQuery } from '@openpeepshq/common/lib';
3
4
  import { useT, useSetPageHeader } from '../index';
4
5
  import { usePostDetailTitle } from '../hooks/posts/usePostDetailTitle';
5
6
  import { PostDetail as PostDetailComponent } from '../components';
@@ -7,6 +8,8 @@ import { PostDetail as PostDetailComponent } from '../components';
7
8
  export function PostDetail() {
8
9
  const t = useT();
9
10
  const { postId = '' } = useParams<{ postId: string }>();
11
+ const [searchParams] = useSearchParams();
12
+ const occurrence = parseOccurrenceQuery(searchParams.get('occurrence'));
10
13
  const { kindTitle, groupHandle, groupLabel, inGroup } =
11
14
  usePostDetailTitle(postId);
12
15
 
@@ -31,5 +34,5 @@ export function PostDetail() {
31
34
 
32
35
  useSetPageHeader(title);
33
36
 
34
- return <PostDetailComponent postId={postId} />;
37
+ return <PostDetailComponent postId={postId} occurrence={occurrence} />;
35
38
  }
@@ -10,6 +10,12 @@ export * from './lib/analyticsClicks';
10
10
  export * from './lib/unseenCountsOptimistic';
11
11
  export * from './lib/postUnread';
12
12
  export * from './lib/notificationBadge';
13
+ export {
14
+ getInitials,
15
+ hueFromHandle,
16
+ initialsBackground,
17
+ } from './lib/initialsAvatar';
18
+ export { svgCoverSrc } from './lib/svgCover';
13
19
  export * from './lib/capabilityMatrix';
14
20
  export * from './lib/groupFormErrors';
15
21
  export * from './lib/passwordStrength';