hive-react-kit 0.0.32 → 0.0.33
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Post } from "../../types/post";
|
|
2
|
-
interface
|
|
2
|
+
interface CommunityPostDetailsProps {
|
|
3
3
|
communityId: string;
|
|
4
4
|
onAuthorClick?: (author: string, avatar: string) => void;
|
|
5
5
|
onPostClick?: (post: Post) => void;
|
|
@@ -9,5 +9,5 @@ interface CommunityDetailsProps {
|
|
|
9
9
|
onCommentClick?: (post: Post) => void;
|
|
10
10
|
onReblogClick?: (post: Post) => void;
|
|
11
11
|
}
|
|
12
|
-
declare const
|
|
13
|
-
export default
|
|
12
|
+
declare const CommunityPostDetails: ({ communityId, onAuthorClick, onPostClick, onCommunityClick, onPayoutClick, onUpvoteClick, onCommentClick, onReblogClick, }: CommunityPostDetailsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default CommunityPostDetails;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1102,4 +1102,4 @@ and ensure you are accounting for this risk.
|
|
|
1102
1102
|
rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
|
|
1103
1103
|
transition-colors cursor-pointer`,children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("img",{src:qe.userAvatar(f.follower),alt:f.follower,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.follower}&background=random`}}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.follower]})})]})},`${f.follower}-${a}`))})})},Ad=({username:e,onSelectUser:n})=>{const[s,i]=R.useState([]),[t,r]=R.useState(!0),[o,c]=R.useState(null),d=async()=>{try{r(!0),c(null);const f=await qe.getFollowing(e);i(f)}catch(f){c(f instanceof Error?f.message:"Failed to load following list")}finally{r(!1)}};return R.useEffect(()=>{d()},[e]),t?u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading following list..."]})}):o?u.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:u.jsxs("div",{className:"text-center",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load following list"}),u.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:o}),u.jsxs("button",{onClick:d,className:"m-2 inline-flex items-center justify-center rounded-md border border-input text-gray-400 cursor-pointer bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[u.jsx(Y.RefreshCw,{className:"w-4 h-4 mr-2"}),"Try Again"]})]})}):s.length===0?u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"This user is not following anyone."})}):u.jsx("div",{className:"space-y-6",children:u.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:s.map((f,a)=>u.jsx("div",{onClick:()=>n&&n(f.following),className:`bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700
|
|
1104
1104
|
rounded-xl p-4 hover:bg-gray-300 dark:hover:bg-gray-700
|
|
1105
|
-
transition-colors cursor-pointer`,children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("img",{src:qe.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${a}`))})})},jd=({username:e})=>{const[n,s]=R.useState(null),[i,t]=R.useState(!0),[r,o]=R.useState(null),c=async()=>{try{t(!0),o(null);const l=await qe.getProfile(e);s(l)}catch(l){o(l instanceof Error?l.message:"Failed to load user details")}finally{t(!1)}};R.useEffect(()=>{c()},[e]);const d=l=>{try{return new Date(l).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return l}},f=l=>l.replace(/<[^>]*>/g,"");if(i)return u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(r)return u.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:u.jsxs("div",{className:"text-center",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),u.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:r}),u.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[u.jsx(Y.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!n?.result)return u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const a=n.result,h=a.metadata?.profile;return u.jsx("div",{className:"space-y-6",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&u.jsxs("div",{className:"mb-6",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),u.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),u.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),u.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),u.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:a.created?d(a.created):"Unknown"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.stats?.followers?.toLocaleString()||"0"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.stats?.following?.toLocaleString()||"0"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.post_count?.toLocaleString()||"0"})]})]})]})})},Mp=({username:e,onVideoClick:n,onAuthorClick:s,onBack:i,onClickUserInfoTab:t,onClickFollowersTab:r,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:a,showMoreMenu:h=!1})=>{const[l,p]=R.useState("videos"),[x,w]=R.useState(null),[b,m]=R.useState(!1),[y,_]=R.useState(!0);R.useEffect(()=>{(async()=>{try{_(!0);const T=await qe.getProfile(e);w(T)}catch(T){console.error("Failed to fetch user details:",T)}finally{_(!1)}})()},[e]);const E=()=>{if(f)f(e);else{const j=`https://3speak.tv/user/${e}`;navigator.share?navigator.share({title:x?.result?.name||e,url:j}):navigator.clipboard.writeText(j)}},v=()=>{d?d(e):window.open(`https://3speak.tv/rss/${e}.xml`,"_blank")},g=j=>{s(j)};if(y)return u.jsx("div",{className:"space-y-6",children:u.jsxs("div",{className:"animate-pulse",children:[u.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),u.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[u.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[u.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),u.jsxs("div",{className:"flex-1 space-y-2",children:[u.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),u.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),u.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((j,T)=>u.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},T))})]})]})});const k=x?.result,A=k?.metadata?.profile;return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("button",{onClick:i,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[u.jsx(Y.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),u.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[u.jsx("img",{src:A.cover_image||qe.userAvatar(e),alt:"Cover",className:"w-full h-48 object-cover",onError:j=>{j.target.src=qe.userAvatar(e)}}),u.jsx("div",{className:"p-6",children:u.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[u.jsx("img",{src:A?.profile_image,alt:A?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:j=>{j.target.src=qe.userAvatar(e)}}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:A?.name||e}),u.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:A?.about||"No description available"}),u.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Users,{className:"w-4 h-4"}),u.jsxs("span",{children:[(k?.stats?.followers||0).toLocaleString()," Followers"]})]}),u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Users,{className:"w-4 h-4"}),u.jsxs("span",{children:[(k?.stats?.following||0).toLocaleString()," Following"]})]}),u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Calendar,{className:"w-4 h-4"}),u.jsxs("span",{children:["Joined"," ",k?.created?new Date(k.created).getFullYear():"Unknown"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(to,{id:e,toastType:"user",onAdd:(j,T)=>{c?c(j,!0):console.log("Added:",j,T)},onRemove:(j,T)=>{c?c(j,!1):console.log("Removed:",j,T)}}),u.jsx("button",{onClick:v,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.Rss,{className:"w-4 h-4"})}),u.jsx("button",{onClick:E,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.Share2,{className:"w-4 h-4"})}),h&&u.jsx("button",{onClick:()=>{a&&a(e)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),u.jsxs("div",{children:[u.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:t},{key:"followers",label:"Followers",callback:r},{key:"following",label:"Following",callback:o}].map((j,T)=>u.jsx("button",{onClick:()=>{j.callback?j.callback():p(j.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${l===j.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:j.label},j.key))}),u.jsxs("div",{className:"mt-6",children:[l==="videos"&&u.jsx(ni,{feedType:We.USER,username:e,onVideoClick:n,onAuthorClick:s}),l==="about"&&u.jsx(jd,{username:e}),l==="followers"&&u.jsx(Nd,{username:e,onSelectUser:g}),l==="following"&&u.jsx(Ad,{username:e,onSelectUser:g})]})]})]})},Rp=1,Ip=1e6;let Cs=0;function Fp(){return Cs=(Cs+1)%Number.MAX_SAFE_INTEGER,Cs.toString()}const Ts=new Map,bc=e=>{if(Ts.has(e))return;const n=setTimeout(()=>{Ts.delete(e),Yn({type:"REMOVE_TOAST",toastId:e})},Ip);Ts.set(e,n)},Sd=(e,n)=>{switch(n.type){case"ADD_TOAST":return{...e,toasts:[n.toast,...e.toasts].slice(0,Rp)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===n.toast.id?{...s,...n.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=n;return s?bc(s):e.toasts.forEach(i=>{bc(i.id)}),{...e,toasts:e.toasts.map(i=>i.id===s||s===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return n.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==n.toastId)}}},Ja=[];let Ya={toasts:[]};function Yn(e){Ya=Sd(Ya,e),Ja.forEach(n=>{n(Ya)})}function Dd({...e}){const n=Fp(),s=t=>Yn({type:"UPDATE_TOAST",toast:{...t,id:n}}),i=()=>Yn({type:"DISMISS_TOAST",toastId:n});return Yn({type:"ADD_TOAST",toast:{...e,id:n,open:!0,onOpenChange:t=>{t||i()}}}),{id:n,dismiss:i,update:s}}function qp(){const[e,n]=Za.useState(Ya);return Za.useEffect(()=>(Ja.push(n),()=>{const s=Ja.indexOf(n);s>-1&&Ja.splice(s,1)}),[e]),{...e,toast:Dd,dismiss:s=>Yn({type:"DISMISS_TOAST",toastId:s})}}exports.ActivityList=jp;exports.ApiVideoFeedType=We;exports.CommentsModal=Ec;exports.CommunitiesList=Op;exports.CommunityAbout=_d;exports.CommunityDetail=Pp;exports.CommunityDetails=Lp;exports.CommunityMembers=kd;exports.CommunityTeam=Ed;exports.DescriptionModal=Nc;exports.FavouriteWidget=to;exports.FollowersList=kp;exports.FollowingList=Np;exports.ListOfWitnesses=Cp;exports.Modal=ai;exports.PostFeedList=yd;exports.ProposalsList=_p;exports.UpvoteListModal=kc;exports.UserAccount=$p;exports.UserFollowers=Nd;exports.UserFollowing=Ad;exports.UserInfo=jd;exports.UserProfilePage=Mp;exports.VideoCard=wc;exports.VideoDetail=Id;exports.VideoFeed=ni;exports.VideoInfo=_c;exports.Wallet=t0;exports.apiService=Qe;exports.reducer=Sd;exports.server=ir;exports.toast=Dd;exports.useIsMobile=wd;exports.useToast=qp;exports.useWalletStore=Sc;exports.witnessService=ct;
|
|
1105
|
+
transition-colors cursor-pointer`,children:u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("img",{src:qe.userAvatar(f.following),alt:f.following,className:"w-12 h-12 rounded-full object-cover",onError:h=>{h.target.src=`https://ui-avatars.com/api/?name=${f.following}&background=random`}}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsxs("h3",{className:"font-semibold text-gray-900 dark:text-white truncate",children:["@",f.following]})})]})},`${f.following}-${a}`))})})},jd=({username:e})=>{const[n,s]=R.useState(null),[i,t]=R.useState(!0),[r,o]=R.useState(null),c=async()=>{try{t(!0),o(null);const l=await qe.getProfile(e);s(l)}catch(l){o(l instanceof Error?l.message:"Failed to load user details")}finally{t(!1)}};R.useEffect(()=>{c()},[e]);const d=l=>{try{return new Date(l).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}catch{return l}},f=l=>l.replace(/<[^>]*>/g,"");if(i)return u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Loader2,{className:"w-5 h-5 animate-spin"}),"Loading user details..."]})});if(r)return u.jsx("div",{className:"flex flex-col items-center justify-center min-h-[400px] space-y-4",children:u.jsxs("div",{className:"text-center",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-2",children:"Failed to load user details"}),u.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:r}),u.jsxs("button",{onClick:c,className:"m-2 inline-flex items-center justify-center rounded-md border border-input bg-background p-2 text-sm font-medium text-foreground shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground disabled:opacity-50 disabled:pointer-events-none",children:[u.jsx(Y.RefreshCw,{className:"w-4 h-4"}),"Try Again"]})]})});if(!n?.result)return u.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:u.jsx("p",{className:"text-gray-500 dark:text-gray-400",children:"No user details available"})});const a=n.result,h=a.metadata?.profile;return u.jsx("div",{className:"space-y-6",children:u.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[h?.about&&u.jsxs("div",{className:"mb-6",children:[u.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white mb-3",children:"About"}),u.jsx("div",{className:"text-gray-600 dark:text-gray-300 leading-relaxed whitespace-pre-wrap",children:f(h.about)})]}),u.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Location"}),u.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:h?.location||"Not specified"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Website"}),u.jsx("a",{href:h?.website,target:"_blank",rel:"noopener noreferrer",className:"text-lg font-semibold text-blue-500 hover:underline",children:h?.website||"Not specified"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Joined"}),u.jsx("p",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:a.created?d(a.created):"Unknown"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Followers"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.stats?.followers?.toLocaleString()||"0"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Following"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.stats?.following?.toLocaleString()||"0"})]}),u.jsxs("div",{className:"bg-gray-50 dark:bg-gray-900 p-4 rounded-lg",children:[u.jsx("h4",{className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1",children:"Post Count"}),u.jsx("p",{className:"text-2xl font-bold text-gray-900 dark:text-white",children:a.post_count?.toLocaleString()||"0"})]})]})]})})},Mp=({username:e,onVideoClick:n,onAuthorClick:s,onBack:i,onClickUserInfoTab:t,onClickFollowersTab:r,onClickFollowingTab:o,onBookmarkToggle:c,onRss:d,onShare:f,onMoreMenu:a,showMoreMenu:h=!1})=>{const[l,p]=R.useState("videos"),[x,w]=R.useState(null),[b,m]=R.useState(!1),[y,_]=R.useState(!0);R.useEffect(()=>{(async()=>{try{_(!0);const T=await qe.getProfile(e);w(T)}catch(T){console.error("Failed to fetch user details:",T)}finally{_(!1)}})()},[e]);const E=()=>{if(f)f(e);else{const j=`https://3speak.tv/user/${e}`;navigator.share?navigator.share({title:x?.result?.name||e,url:j}):navigator.clipboard.writeText(j)}},v=()=>{d?d(e):window.open(`https://3speak.tv/rss/${e}.xml`,"_blank")},g=j=>{s(j)};if(y)return u.jsx("div",{className:"space-y-6",children:u.jsxs("div",{className:"animate-pulse",children:[u.jsx("div",{className:"h-8 bg-gray-200 dark:bg-gray-700 rounded w-32 mb-6"}),u.jsxs("div",{className:"bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl p-6",children:[u.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[u.jsx("div",{className:"w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-full"}),u.jsxs("div",{className:"flex-1 space-y-2",children:[u.jsx("div",{className:"h-6 bg-gray-200 dark:bg-gray-700 rounded w-48"}),u.jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded w-32"})]})]}),u.jsx("div",{className:"flex gap-2",children:Array.from({length:4}).map((j,T)=>u.jsx("div",{className:"h-10 bg-gray-200 dark:bg-gray-700 rounded w-20"},T))})]})]})});const k=x?.result,A=k?.metadata?.profile;return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("button",{onClick:i,className:"flex items-center justify-center mr-4 px-2 text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-full",children:[u.jsx(Y.ArrowLeft,{className:"w-4 h-4 mr-2"}),"Back"]}),u.jsxs("div",{className:"relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-xl overflow-hidden",children:[u.jsx("img",{src:A.cover_image||qe.userAvatar(e),alt:"Cover",className:"w-full h-48 object-cover",onError:j=>{j.target.src=qe.userAvatar(e)}}),u.jsx("div",{className:"p-6",children:u.jsxs("div",{className:"flex flex-col md:flex-row items-start md:items-center gap-6",children:[u.jsx("img",{src:A?.profile_image,alt:A?.name,className:"w-24 h-24 rounded-full object-cover border-4 border-white dark:border-gray-800 -mt-16",onError:j=>{j.target.src=qe.userAvatar(e)}}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-2",children:A?.name||e}),u.jsx("p",{className:"text-gray-600 dark:text-gray-400 mb-4",children:A?.about||"No description available"}),u.jsxs("div",{className:"flex flex-wrap gap-6 text-sm",children:[u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Users,{className:"w-4 h-4"}),u.jsxs("span",{children:[(k?.stats?.followers||0).toLocaleString()," Followers"]})]}),u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Users,{className:"w-4 h-4"}),u.jsxs("span",{children:[(k?.stats?.following||0).toLocaleString()," Following"]})]}),u.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[u.jsx(Y.Calendar,{className:"w-4 h-4"}),u.jsxs("span",{children:["Joined"," ",k?.created?new Date(k.created).getFullYear():"Unknown"]})]})]})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(to,{id:e,toastType:"user",onAdd:(j,T)=>{c?c(j,!0):console.log("Added:",j,T)},onRemove:(j,T)=>{c?c(j,!1):console.log("Removed:",j,T)}}),u.jsx("button",{onClick:v,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.Rss,{className:"w-4 h-4"})}),u.jsx("button",{onClick:E,className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.Share2,{className:"w-4 h-4"})}),h&&u.jsx("button",{onClick:()=>{a&&a(e)},className:"p-2 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700",children:u.jsx(Y.MoreVertical,{className:"w-4 h-4"})})]})]})})]}),u.jsxs("div",{children:[u.jsx("div",{className:"grid grid-cols-4 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",children:[{key:"videos",label:"Videos"},{key:"about",label:"User Info",callback:t},{key:"followers",label:"Followers",callback:r},{key:"following",label:"Following",callback:o}].map((j,T)=>u.jsx("button",{onClick:()=>{j.callback?j.callback():p(j.key)},className:`px-4 py-2 text-xs sm:text-sm font-medium transition-colors ${l===j.key?"bg-blue-600 dark:bg-blue-500 text-white":"text-gray-700 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700"}`,children:j.label},j.key))}),u.jsxs("div",{className:"mt-6",children:[l==="videos"&&u.jsx(ni,{feedType:We.USER,username:e,onVideoClick:n,onAuthorClick:s}),l==="about"&&u.jsx(jd,{username:e}),l==="followers"&&u.jsx(Nd,{username:e,onSelectUser:g}),l==="following"&&u.jsx(Ad,{username:e,onSelectUser:g})]})]})]})},Rp=1,Ip=1e6;let Cs=0;function Fp(){return Cs=(Cs+1)%Number.MAX_SAFE_INTEGER,Cs.toString()}const Ts=new Map,bc=e=>{if(Ts.has(e))return;const n=setTimeout(()=>{Ts.delete(e),Yn({type:"REMOVE_TOAST",toastId:e})},Ip);Ts.set(e,n)},Sd=(e,n)=>{switch(n.type){case"ADD_TOAST":return{...e,toasts:[n.toast,...e.toasts].slice(0,Rp)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(s=>s.id===n.toast.id?{...s,...n.toast}:s)};case"DISMISS_TOAST":{const{toastId:s}=n;return s?bc(s):e.toasts.forEach(i=>{bc(i.id)}),{...e,toasts:e.toasts.map(i=>i.id===s||s===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return n.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(s=>s.id!==n.toastId)}}},Ja=[];let Ya={toasts:[]};function Yn(e){Ya=Sd(Ya,e),Ja.forEach(n=>{n(Ya)})}function Dd({...e}){const n=Fp(),s=t=>Yn({type:"UPDATE_TOAST",toast:{...t,id:n}}),i=()=>Yn({type:"DISMISS_TOAST",toastId:n});return Yn({type:"ADD_TOAST",toast:{...e,id:n,open:!0,onOpenChange:t=>{t||i()}}}),{id:n,dismiss:i,update:s}}function qp(){const[e,n]=Za.useState(Ya);return Za.useEffect(()=>(Ja.push(n),()=>{const s=Ja.indexOf(n);s>-1&&Ja.splice(s,1)}),[e]),{...e,toast:Dd,dismiss:s=>Yn({type:"DISMISS_TOAST",toastId:s})}}exports.ActivityList=jp;exports.ApiVideoFeedType=We;exports.CommentsModal=Ec;exports.CommunitiesList=Op;exports.CommunityAbout=_d;exports.CommunityDetail=Pp;exports.CommunityMembers=kd;exports.CommunityPostDetails=Lp;exports.CommunityTeam=Ed;exports.DescriptionModal=Nc;exports.FavouriteWidget=to;exports.FollowersList=kp;exports.FollowingList=Np;exports.ListOfWitnesses=Cp;exports.Modal=ai;exports.PostFeedList=yd;exports.ProposalsList=_p;exports.UpvoteListModal=kc;exports.UserAccount=$p;exports.UserFollowers=Nd;exports.UserFollowing=Ad;exports.UserInfo=jd;exports.UserProfilePage=Mp;exports.VideoCard=wc;exports.VideoDetail=Id;exports.VideoFeed=ni;exports.VideoInfo=_c;exports.Wallet=t0;exports.apiService=Qe;exports.reducer=Sd;exports.server=ir;exports.toast=Dd;exports.useIsMobile=wd;exports.useToast=qp;exports.useWalletStore=Sc;exports.witnessService=ct;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { default as FavouriteWidget } from './components/common/FavouriteWidget'
|
|
|
13
13
|
export { default as CommunitiesList } from './components/community/CommunitiesList';
|
|
14
14
|
export { default as CommunityAbout } from './components/community/CommunityAbout';
|
|
15
15
|
export { default as CommunityDetail } from './components/community/CommunityDetail';
|
|
16
|
-
export { default as
|
|
16
|
+
export { default as CommunityPostDetails } from './components/community/CommunityPostDetails';
|
|
17
17
|
export { default as CommunityMembers } from './components/community/CommunityMembers';
|
|
18
18
|
export { default as CommunityTeam } from './components/community/CommunityTeam';
|
|
19
19
|
export { default as CommentsModal } from './components/modals/CommentsModal';
|
package/dist/index.esm.js
CHANGED
|
@@ -25040,8 +25040,8 @@ export {
|
|
|
25040
25040
|
qm as CommunitiesList,
|
|
25041
25041
|
em as CommunityAbout,
|
|
25042
25042
|
Bm as CommunityDetail,
|
|
25043
|
-
Vm as CommunityDetails,
|
|
25044
25043
|
rm as CommunityMembers,
|
|
25044
|
+
Vm as CommunityPostDetails,
|
|
25045
25045
|
tm as CommunityTeam,
|
|
25046
25046
|
l0 as DescriptionModal,
|
|
25047
25047
|
qd as FavouriteWidget,
|
package/package.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hive-react-kit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.33",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
7
7
|
"module": "./dist/index.esm.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.esm.js",
|
|
12
|
-
"require": "./dist/index.cjs.js"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/index.cjs.js"
|
|
14
14
|
},
|
|
15
15
|
"./components": {
|
|
16
|
+
"types": "./dist/components/index.d.ts",
|
|
16
17
|
"import": "./dist/components/index.js",
|
|
17
|
-
"require": "./dist/components/index.js"
|
|
18
|
-
"types": "./dist/components/index.d.ts"
|
|
18
|
+
"require": "./dist/components/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./hooks": {
|
|
21
|
+
"types": "./dist/hooks/index.d.ts",
|
|
21
22
|
"import": "./dist/hooks/index.js",
|
|
22
|
-
"require": "./dist/hooks/index.js"
|
|
23
|
-
"types": "./dist/hooks/index.d.ts"
|
|
23
|
+
"require": "./dist/hooks/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./types": {
|
|
26
|
+
"types": "./dist/types/index.d.ts",
|
|
26
27
|
"import": "./dist/types/index.js",
|
|
27
|
-
"require": "./dist/types/index.js"
|
|
28
|
-
"types": "./dist/types/index.d.ts"
|
|
28
|
+
"require": "./dist/types/index.js"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"files": [
|