hive-react-kit 0.9.7 → 0.9.9

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.
@@ -59,6 +59,23 @@ export interface PostActionButtonProps {
59
59
  templateApiBaseUrl?: string;
60
60
  /** When true, clicking the comment icon calls onComments instead of opening the CommentsModal popup */
61
61
  disableCommentsModal?: boolean;
62
+ /** Called when the comment ICON is clicked. When set, the icon is
63
+ * rendered as its own button (separate from the count) — typical
64
+ * use is to open an inline reply composer. */
65
+ onClickCommentIcon?: () => void;
66
+ /** Called when the comment COUNT is clicked. When set, the count is
67
+ * rendered as its own button — typical use is to navigate into
68
+ * the post detail / comments view. */
69
+ onClickCommentCount?: () => void;
70
+ /** Pre-computed "current user has commented on this post" flag —
71
+ * typically derived from `post.replies` matching `${currentUser}/…`.
72
+ * When true, the comment icon is highlighted in red and a hover
73
+ * tooltip with the user's reply body is enabled. Mirrors hSnaps. */
74
+ hasCommented?: boolean;
75
+ /** `${author}/${permlink}` of the current user's reply on this post.
76
+ * Used to lazy-fetch the reply body the first time the user hovers
77
+ * the comment icon, so the tooltip can show what they wrote. */
78
+ myReplyKey?: string;
62
79
  }
63
- export declare function PostActionButton({ author, permlink, currentUser: currentUserProp, hiveValue, hiveIconUrl, payoutTooltip, initialVotes, initialCommentsCount, onUpvote, onSubmitComment, onComments, onReblog, onShare, onTip, onReport, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, disableCommentsModal, showVoteButton, parentTags, defaultReward, defaultVotePercent, voteWeightStep, allowLandscapeVideos, }: PostActionButtonProps): import("react/jsx-runtime").JSX.Element;
80
+ export declare function PostActionButton({ author, permlink, currentUser: currentUserProp, hiveValue, hiveIconUrl, payoutTooltip, initialVotes, initialCommentsCount, onUpvote, onSubmitComment, onComments, onReblog, onShare, onTip, onReport, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, disableCommentsModal, onClickCommentIcon, onClickCommentCount, hasCommented, myReplyKey, showVoteButton, parentTags, defaultReward, defaultVotePercent, voteWeightStep, allowLandscapeVideos, }: PostActionButtonProps): import("react/jsx-runtime").JSX.Element;
64
81
  export default PostActionButton;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Segment control (pill switcher) for picking one of N feeds.
3
+ *
4
+ * Themed to match hivesuite tokens (#262b30 / #3a424a / #e31337). Used by
5
+ * <SnapsFeedView/> in tablet (2-col) layouts where each column lets the
6
+ * user toggle between two feeds.
7
+ */
8
+ export interface FeedSegmentOption {
9
+ id: string;
10
+ label: string;
11
+ avatarUrl?: string;
12
+ }
13
+ export interface FeedSegmentControlProps {
14
+ options: FeedSegmentOption[];
15
+ value: string;
16
+ onChange: (id: string) => void;
17
+ className?: string;
18
+ }
19
+ export declare function FeedSegmentControl({ options, value, onChange, className, }: FeedSegmentControlProps): import("react/jsx-runtime").JSX.Element;
20
+ export default FeedSegmentControl;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * SnapsFeedCard — single feed card matching the hSnaps home-screen layout.
3
+ *
4
+ * Layout (mirrors hSnaps `<PostCard/>` / `<FeedItemBody/>`):
5
+ * header (avatar · @author · time · community)
6
+ * plain-text body (markdown stripped, mentions / hashtags / urls
7
+ * turned into clickable inline segments)
8
+ * attachment strip (swipeable image carousel + lightweight YouTube /
9
+ * 3Speak / audio placeholders)
10
+ * action bar (`<PostActionButton/>`)
11
+ *
12
+ * No title is rendered in the card — taps anywhere outside the action
13
+ * row navigate to the post via `onPostClick`.
14
+ *
15
+ * No app-specific stores: every action is forwarded via callbacks so
16
+ * the host app owns the data plane.
17
+ */
18
+ import { type FC, type ReactNode } from 'react';
19
+ import type { Post } from '@/types/post';
20
+ import type { RewardOption } from '../../utils/commentOptions';
21
+ export interface SnapsFeedCardProps {
22
+ post: Post;
23
+ currentUser?: string;
24
+ onUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
25
+ onSubmitComment?: (parentAuthor: string, parentPermlink: string, body: string) => void | Promise<void>;
26
+ onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
27
+ onReblog?: (author: string, permlink: string) => void;
28
+ onTip?: (author: string, permlink: string) => void;
29
+ onSharePost?: (author: string, permlink: string) => void;
30
+ onCommentClick?: (author: string, permlink: string) => void;
31
+ /** Click on just the message-circle icon — typical use: open an
32
+ * inline reply composer. Mirrors hSnaps PostCard. */
33
+ onClickCommentIcon?: (author: string, permlink: string) => void;
34
+ /** Click on just the count number next to the comment icon — typical
35
+ * use: navigate to the post detail / comments view. Mirrors hSnaps. */
36
+ onClickCommentCount?: (author: string, permlink: string) => void;
37
+ onReportPost?: (author: string, permlink: string) => void;
38
+ onUserClick?: (username: string) => void;
39
+ onPostClick?: (author: string, permlink: string, title?: string) => void;
40
+ onTagClick?: (tag: string) => void;
41
+ ecencyToken?: string;
42
+ threeSpeakApiKey?: string;
43
+ giphyApiKey?: string;
44
+ templateToken?: string;
45
+ templateApiBaseUrl?: string;
46
+ defaultVotePercent?: number;
47
+ voteWeightStep?: number;
48
+ allowLandscapeVideos?: boolean;
49
+ defaultReward?: RewardOption;
50
+ /** Optional render slot for header right-side actions (e.g. a kebab
51
+ * menu with Edit / Delete / Flag). Receives the post so the host can
52
+ * own edit/delete/flag state per card. */
53
+ renderHeaderActions?: (post: Post) => ReactNode;
54
+ }
55
+ declare const SnapsFeedCard: FC<SnapsFeedCardProps>;
56
+ export default SnapsFeedCard;
@@ -0,0 +1,12 @@
1
+ import type { Post } from '@/types/post';
2
+ import type { SnapsFeedCardProps } from './SnapsFeedCard';
3
+ export interface SnapsFeedListProps extends Omit<SnapsFeedCardProps, 'post'> {
4
+ posts: Post[];
5
+ loading?: boolean;
6
+ loadingMore?: boolean;
7
+ hasMore?: boolean;
8
+ onLoadMore?: () => void;
9
+ emptyMessage?: string;
10
+ }
11
+ declare const SnapsFeedList: ({ posts, loading, loadingMore, hasMore, onLoadMore, emptyMessage, ...cardProps }: SnapsFeedListProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default SnapsFeedList;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * SnapsFeedView — responsive multi-feed shell ported from the hSnaps
3
+ * `UnifiedFeedPage`.
4
+ *
5
+ * • Mobile (1 col): full-width pill switcher above a single feed
6
+ * column. The user picks one of the four feeds.
7
+ * • Tablet (2 col): two columns, each with its own segment-control
8
+ * switcher (snaps/ecency on the left, threads/liketu
9
+ * on the right by default — both fully overridable).
10
+ * • Desktop (4 col): all four feeds visible side-by-side, each titled
11
+ * with the canonical feed avatar + label.
12
+ *
13
+ * Data is supplied by the host app: each feed slot receives `posts`,
14
+ * loading/error/pagination flags, plus an optional `onLoadMore`. Per-post
15
+ * action callbacks (vote / comment / reblog / share / tip / report) are
16
+ * forwarded to the embedded <BlogPostList/> exactly the way <BlogsPage/>
17
+ * already does — so the rendered cards behave identically to the rest of
18
+ * the hivesuite Blog-style surfaces.
19
+ */
20
+ import { type ReactNode } from 'react';
21
+ import type { Post } from '@/types/post';
22
+ import type { RewardOption } from '../../utils/commentOptions';
23
+ export type SnapsFeedKey = 'snaps' | 'ecency' | 'threads' | 'liketu';
24
+ export interface SnapsFeedSlot {
25
+ posts: Post[];
26
+ loading?: boolean;
27
+ loadingMore?: boolean;
28
+ hasMore?: boolean;
29
+ error?: string | null;
30
+ onLoadMore?: () => void;
31
+ onRefresh?: () => void;
32
+ }
33
+ export interface SnapsFeedViewProps {
34
+ feeds: Record<SnapsFeedKey, SnapsFeedSlot>;
35
+ /** Override per-feed display name (default labels: Snaps / Ecency / Threads / Liketu). */
36
+ labels?: Partial<Record<SnapsFeedKey, string>>;
37
+ /** Override per-feed avatar URL (defaults to canonical container account avatars). */
38
+ avatars?: Partial<Record<SnapsFeedKey, string>>;
39
+ /** Initial feed shown on mobile (the only visible column at < 768 px).
40
+ * Defaults to `snaps`. */
41
+ defaultPrimary?: SnapsFeedKey;
42
+ /** Logged-in observer username (drives auth-gated buttons inside post cards). */
43
+ currentUser?: string;
44
+ onUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
45
+ onSubmitComment?: (parentAuthor: string, parentPermlink: string, body: string) => void | Promise<void>;
46
+ onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
47
+ onReblog?: (author: string, permlink: string) => void;
48
+ onTip?: (author: string, permlink: string) => void;
49
+ onSharePost?: (author: string, permlink: string) => void;
50
+ onCommentClick?: (author: string, permlink: string) => void;
51
+ /** Comment-icon click (per card) — typical use: open inline composer. */
52
+ onClickCommentIcon?: (author: string, permlink: string) => void;
53
+ /** Comment-count click (per card) — typical use: open post detail. */
54
+ onClickCommentCount?: (author: string, permlink: string) => void;
55
+ onReportPost?: (author: string, permlink: string) => void;
56
+ onUserClick?: (username: string) => void;
57
+ onPostClick?: (author: string, permlink: string, title?: string) => void;
58
+ ecencyToken?: string;
59
+ threeSpeakApiKey?: string;
60
+ giphyApiKey?: string;
61
+ templateToken?: string;
62
+ templateApiBaseUrl?: string;
63
+ defaultVotePercent?: number;
64
+ voteWeightStep?: number;
65
+ allowLandscapeVideos?: boolean;
66
+ defaultReward?: RewardOption;
67
+ /** Optional top-row content rendered above the columns (e.g. a Compose FAB
68
+ * trigger or filter dropdown). Sticky to the top of the viewport. */
69
+ toolbar?: ReactNode;
70
+ /** Optional element rendered at the bottom of the layout (e.g. Compose FAB). */
71
+ footer?: ReactNode;
72
+ /** Optional render slot for a per-card right-side header action menu
73
+ * (Edit / Delete / Flag). Forwarded to every <SnapsFeedCard/>. */
74
+ renderHeaderActions?: (post: import('@/types/post').Post) => ReactNode;
75
+ }
76
+ export declare function SnapsFeedView({ feeds, labels, avatars, defaultPrimary, currentUser, onUpvote, onSubmitComment, onClickCommentUpvote, onReblog, onTip, onSharePost, onCommentClick, onClickCommentIcon, onClickCommentCount, onReportPost, onUserClick, onPostClick, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, defaultVotePercent, voteWeightStep, allowLandscapeVideos, defaultReward, toolbar, footer, renderHeaderActions, }: SnapsFeedViewProps): import("react/jsx-runtime").JSX.Element;
77
+ export default SnapsFeedView;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * ProfileSnapsTab — Snaps tab body for the user-profile page.
3
+ *
4
+ * Wraps <SnapsFeedView/> so a profile renders the same 1-col-mobile /
5
+ * 4-col-desktop snaps layout as the unified Snaps page. Each of the four
6
+ * container types (peak.snaps · ecency.waves · leothreads · liketu.moments)
7
+ * gets its own slot, fetched in parallel from the user's snaps for that
8
+ * container.
9
+ */
10
+ import { type ReactNode } from 'react';
11
+ import type { Post } from '@/types/post';
12
+ import type { RewardOption } from '../../utils/commentOptions';
13
+ export interface ProfileSnapsTabProps {
14
+ username: string;
15
+ currentUsername?: string;
16
+ reportedPosts?: {
17
+ author: string;
18
+ permlink: string;
19
+ }[];
20
+ reportedAuthors?: string[];
21
+ onUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
22
+ onSubmitComment?: (parentAuthor: string, parentPermlink: string, body: string) => void | Promise<void>;
23
+ onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
24
+ onReblog?: (author: string, permlink: string) => void;
25
+ onTip?: (author: string, permlink: string) => void;
26
+ onSharePost?: (author: string, permlink: string) => void;
27
+ onCommentClick?: (author: string, permlink: string) => void;
28
+ /** Comment-icon click (per card) — typical use: open inline composer. */
29
+ onClickCommentIcon?: (author: string, permlink: string) => void;
30
+ /** Comment-count click (per card) — typical use: open post detail. */
31
+ onClickCommentCount?: (author: string, permlink: string) => void;
32
+ onReportPost?: (author: string, permlink: string) => void;
33
+ onUserClick?: (username: string) => void;
34
+ onPostClick?: (author: string, permlink: string, title?: string) => void;
35
+ ecencyToken?: string;
36
+ threeSpeakApiKey?: string;
37
+ giphyApiKey?: string;
38
+ templateToken?: string;
39
+ templateApiBaseUrl?: string;
40
+ defaultVotePercent?: number;
41
+ voteWeightStep?: number;
42
+ allowLandscapeVideos?: boolean;
43
+ defaultReward?: RewardOption;
44
+ /** Per-card right-side header action menu slot (e.g. Edit / Flag). */
45
+ renderHeaderActions?: (post: Post) => ReactNode;
46
+ }
47
+ declare const ProfileSnapsTab: React.FC<ProfileSnapsTabProps>;
48
+ export default ProfileSnapsTab;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { Post } from "@/types/post";
2
3
  export interface UserDetailProfileProps {
3
4
  username: string;
4
5
  currentUsername?: string;
@@ -62,6 +63,12 @@ export interface UserDetailProfileProps {
62
63
  onSharePost?: (author: string, permlink: string) => void;
63
64
  /** When provided, clicking the comment icon navigates to the post detail instead of opening the comments modal. */
64
65
  onCommentClick?: (author: string, permlink: string) => void;
66
+ /** Snaps tab only: click on the comment icon (separate from count) —
67
+ * typical use: open an inline reply composer. Mirrors hSnaps. */
68
+ onClickSnapCommentIcon?: (author: string, permlink: string) => void;
69
+ /** Snaps tab only: click on the comment count number — typical use:
70
+ * navigate to the post detail. */
71
+ onClickSnapCommentCount?: (author: string, permlink: string) => void;
65
72
  onFavouriteList?: () => void | Promise<void>;
66
73
  onAddToFavourite?: (username: string) => void | Promise<void>;
67
74
  isFavourited?: boolean;
@@ -76,6 +83,9 @@ export interface UserDetailProfileProps {
76
83
  /** Allow landscape videos in every embedded comment composer on this profile.
77
84
  * Default false (portrait-only, matches hSnaps Moments contract). */
78
85
  allowLandscapeVideos?: boolean;
86
+ /** Per-card right-side header action menu (Edit / Delete / Flag) for the
87
+ * Snaps tab. Forwarded into <SnapsFeedView/>. */
88
+ renderSnapHeaderActions?: (post: Post) => React.ReactNode;
79
89
  }
80
90
  type TabType = "blogs" | "posts" | "snaps" | "polls" | "comments" | "replies" | "activities" | "authorRewards" | "curationRewards" | "followers" | "following" | "wallet" | "votingPower" | "badges" | "witnessVotes" | "growth";
81
91
  declare const UserDetailProfile: React.FC<UserDetailProfileProps>;