PageSourceSearch

https://femos.trobada.social/packs/follow_button-D-HRKcp_.js

js trobada.social collected 2026-10-09 01:15:26 UTC 3,215 bytes, 2 lines download raw bytes

1import{j as m}from"./client-ncDLP5Hr.js";import{r as g,a as _,u as N,m as p}from"./index-B20Sgkgt.js";import{c as b}from"./index-S4ck4eQf.js";import{u as E,h as x,a as k,b7 as B,am as c,aS as F,bG as L,L as T}from"./useSelectableClick-Cf3E8tvL.js";import{J as v}from"./status_quoted-B6qw66Z7.js";const O={narrow:479,openable:759,full:1174},q=e=>{const[u,n]=g.useState(!1);return g.useEffect(()=>{const f=window.matchMedia("(max-width: ".concat(O[e],"px)"));n(f.matches);const l=t=>{n(t.matches)};return f.addEventListener("change",l),()=>{f.removeEventListener("change",l)}},[e,n]),u};function $(e,u="full"){var l;const n="withMobileLayout(".concat((l=e.displayName)!=null?l:e.name,")"),f=t=>{const i=q(u);return m.jsx(e,{matchesBreakpoint:i,...t})};return f.displayName=n,f}const R=_({unfollow:{id:"account.unfollow",defaultMessage:"Unfollow"},unblock:{id:"account.unblock_short",defaultMessage:"Unblock"},unmute:{id:"account.unmute_short",defaultMessage:"Unmute"},follow:{id:"account.follow",defaultMessage:"Follow"},followBack:{id:"account.follow_back",defaultMessage:"Follow back"},followRequest:{id:"account.follow_request",defaultMessage:"Request to follow"},followRequestCancel:{id:"account.follow_request_cancel",defaultMessage:"Cancel request"},editProfile:{id:"account.edit_profile",defaultMessage:"Edit profile"}}),P={...R,..._({followBack:{id:"account.follow_back_short",defaultMessage:"Follow back"},followRequest:{id:"account.follow_request_short",defaultMessage:"Request"},followRequestCancel:{id:"account.follow_request_cancel_short",defaultMessage:"Cancel"},editProfile:{id:"account.edit_profile_short",defaultMessage:"Edit"}})},G=({accountId:e,compact:u,labelLength:n="auto",className:f})=>{const l=N(),t=E(),{signedIn:i}=x(),s=k(w=>e?w.accounts.get(e):void 0),o=k(w=>e?w.relationships.get(e):void 0),M=(o==null?void 0:o.following)||(o==null?void 0:o.requested);g.useEffect(()=>{e&&i&&t(B([e]))},[t,e,i]);const y=g.useCallback(()=>{i||t(c({modalType:"INTERACTION",modalProps:{accountId:e,url:s==null?void 0:s.url}})),!(!o||!e)&&e!==p&&(o.muting?t(F(e)):s&&o.following?t(c({modalType:"CONFIRM_UNFOLLOW",modalProps:{account:s}})):s&&o.requested?t(c({modalType:"CONFIRM_WITHDRAW_REQUEST",modalProps:{account:s}})):o.blocking?t(c({modalType:"CONFIRM_UNBLOCK",modalProps:{account:s}})):t(L(e)))},[t,e,o,s,i]),C=q("narrow"),r=n==="short"||n==="auto"&&C?P:R,h=s!=null&&s.locked?r.followRequest:r.follow;let a,d=(o==null?void 0:o.blocked_by)||(s==null?void 0:s.suspended)||!!(s!=null&&s.moved);return i?e===p?a=l.formatMessage(r.editProfile):o?o.muting?(a=l.formatMessage(r.unmute),d=!1):o.following?(a=l.formatMessage(r.unfollow),d=!1):o.blocking?(a=l.formatMessage(r.unblock),d=!1):o.requested?(a=l.formatMessage(r.followRequestCancel),d=!1):o.followed_by&&!(s!=null&&s.locked)?a=l.formatMessage(r.followBack):a=l.formatMessage(h):a=m.jsx(T,{}):a=l.formatMessage(h),e===p?m.jsx("a",{href:"/settings/profile",target:"_blank",rel:"noopener",className:b(f,"button button-secondary",{"button--compact":u}),children:a}):m.jsx(v,{onClick:y,disabled:d,secondary:M,compact:u,className:b(f,{"button--destructive":M}),children:a})};export{G as F,q as u,$ as w};
2//# sourceMappingURL=follow_button-D-HRKcp_.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.