PageSourceSearch

https://farcaster.xyz/assets/ChannelDropdownMenu-B85nkP7d.js

js farcaster.xyz collected 2026-09-24 08:34:06 UTC 7,490 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-wagmi-CRHMQcRy.js";import{$ as R,ex as D,ew as A,bi as I,H as U,ey as P,ez as G,eA as H,eB as V,eC as K,eD as Y,I as J,G as X,bh as L,eE as $,eF as q,eG as Q,eH as W,cj as d,eI as _,eJ as ee,eK as oe,eL as te,eM as ae,eN as z,eO as E,c3 as B}from"./index-CjDX1y09.js";import{b as ne,c as se,a as ie}from"./useUserChannelRole-D0qYbPi3.js";const le=()=>{const{apiClient:o}=R(),t=D(),s=A(),{trackEvent:r}=I();return l.useCallback(async({channelKey:n})=>{const c=t({updates:{key:n,viewerContext:{enableNotifications:!1}},revertUpdates:{key:n,viewerContext:{enableNotifications:!0}}});try{r(U.ToggleChannelNotifications,{toggle:"off",channelKey:n});const i=await o.disableChannelNotifications({channelKey:n});return i.data.result.success||c(),s({key:n}),i.data}catch(i){throw c(),new P({error:i})}},[o,s,t,r])},re=()=>{const{apiClient:o}=R(),t=D(),s=A(),{trackEvent:r}=I();return l.useCallback(async({channelKey:n})=>{const c=t({updates:{key:n,viewerContext:{enableNotifications:!0}},revertUpdates:{key:n,viewerContext:{enableNotifications:!1}}});try{r(U.ToggleChannelNotifications,{toggle:"on",channelKey:n});const i=await o.enableChannelNotifications({channelKey:n});return i.data.result.success||c(),s({key:n}),i.data}catch(i){throw c(),new P({error:i})}},[o,s,t,r])},ce=({channel:o,fid:t,location:s})=>{const r=G(),n=H(),c=V(),i=K(),m=re(),u=le(),v=ne(),f=se(),h=(o.viewerContext.favoritePosition??-1)>0,C=o.viewerContext.following,g=o.viewerContext.enableNotifications,w=l.useCallback(async()=>{await m({channelKey:o.key})},[m,o.key]),b=l.useCallback(async()=>{u({channelKey:o.key})},[u,o.key]),x=l.useCallback(async()=>{await r({feedKey:o.key,location:s})},[r,o.key,s]),y=l.useCallback(async()=>{await n({feedKey:o.key,fid:t,following:C,location:s})},[n,o.key,t,C,s]),p=l.useCallback(async()=>{await c({feedKey:o.key,channel:o,fid:t})},[c,o,t]),k=l.useCallback(async()=>{await i({feedKey:o.key,favoritePosition:o.viewerContext.favoritePosition??-1,channel:o,fid:t})},[o,t,i]),j=l.useCallback(async()=>{await f({channelKey:o.key,removeFid:t,actorFid:t})},[f,o.key,t]),F=l.useCallback(async()=>{await v({channelKey:o.key,fid:t,actorFid:t})},[v,o.key,t]);return{following:C,toggleFollowing:C?y:x,favorited:h,toggleFavorited:h?k:p,notified:g,toggleNotified:g?b:w,removeMember:j,removeModerator:F}},de=({size:o})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,fill:"none",children:[e.jsx("g",{clipPath:"url(#a)",children:e.jsx("path",{className:"fill-current",fillRule:"evenodd",d:"M9.323 15.5a2 2 0 0 1-3.308-1.25c-.017-.137.097-.25.235-.25h3.5c.138 0 .252.113.235.25a2 2 0 0 1-.662 1.25ZM4.464 1.464A5 5 0 0 0 3 5v2.947c0 .05-.015.098-.042.139L1.255 10.64A1.516 1.516 0 0 0 2.518 13h10.964a1.52 1.52 0 0 0 1.263-2.359l-1.703-2.555A.252.252 0 0 1 13 7.947V5a5 5 0 0 0-8.536-3.536Zm6.281 4.667a.625.625 0 0 0-.99-.762L7.553 8.23l-.432-.393-.467-.425-.233-.213a.625.625 0 1 0-.842.925l.234.212.467.425.934.85a.625.625 0 0 0 .916-.08l2.615-3.4Z",clipRule:"evenodd"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"a",children:e.jsx("path",{fill:"#fff",d:"M0 0h16v16H0z"})})})]}),Ce=({size:o})=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:o,height:o,viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.783 1.81299L8.533 0.132987C8.18633 0.0219959 7.81367 0.0219959 7.467 0.132987L2.217 1.81299C1.86364 1.92598 1.55533 2.14834 1.33658 2.44797C1.11784 2.74761 0.99997 3.109 1 3.47999V6.99999C1 8.56599 1.32 10.182 2.303 11.682C3.286 13.18 4.888 14.495 7.335 15.537C7.54527 15.6265 7.77146 15.6727 8 15.6727C8.22854 15.6727 8.45473 15.6265 8.665 15.537C11.112 14.495 12.714 13.18 13.697 11.682C14.68 10.182 15 8.56599 15 6.99999V3.47999C15 3.109 14.8822 2.74761 14.6634 2.44797C14.4447 2.14834 14.1364 1.92598 13.783 1.81299ZM11.28 6.27997L7.78 9.77997C7.63937 9.92042 7.44875 9.99931 7.25 9.99931C7.05125 9.99931 6.86062 9.92042 6.72 9.77997L5.22 8.27997C5.12127 8.1883 5.0491 8.0717 5.01109 7.94245C4.97307 7.8132 4.97062 7.67609 5.004 7.54557C5.03737 7.41505 5.10533 7.29594 5.20072 7.2008C5.2961 7.10566 5.41539 7.03801 5.546 7.00497C5.67637 6.97156 5.81334 6.97389 5.94251 7.01172C6.07167 7.04956 6.18826 7.1215 6.28 7.21997L7.25 8.18997L10.22 5.21997C10.3623 5.08757 10.5503 5.01546 10.7446 5.01882C10.9389 5.02218 11.1244 5.10073 11.262 5.23797C11.3992 5.37558 11.4778 5.56103 11.4812 5.75534C11.4845 5.94966 11.4124 6.13771 11.28 6.27997Z",className:"fill-current"})}),ue=({channel:o,children:t,relationOnly:s,hideActions:r=[]}
1)=>{const n=Y({fallback:o}),c=J(),i=X(),[m,u]=l.useState(!1),[v,f]=l.useState(!1),{favorited:h,toggleFavorited:C,notified:g,toggleNotified:w,following:b,toggleFollowing:x,removeModerator:y,removeMember:p}=ce({channel:n,fid:i.fid,location:"channel header drop down"}),k=a=>!r.includes(a),j=l.useCallback(async()=>{try{u(!1),await p()}catch{L({message:"Failed to leave channel",type:"error"})}},[p]),F=l.useCallback(async()=>{try{f(!1),await y()}catch{L({message:"Failed to remove self as moderator",type:"error"})}},[y]),M=ie(n),N=M==="owner",S=M==="moderator",T=M!==null&&!(N||S),Z=S&&!N,O=S||N;return e.jsxs(e.Fragment,{children:[e.jsxs($,{children:[e.jsx(q,{onClick:a=>a.stopPropagation(),asChild:!0,children:t}),e.jsx(Q,{children:e.jsxs(W,{side:"bottom",sideOffset:10,align:"end",onClick:a=>a.stopPropagation(),className:"outline-hidden z-10 w-[240px] divide-y divide-border-gray-light overflow-hidden rounded-lg shadow-lg bg-app dark:divide-border-gray-dark",onCloseAutoFocus:a=>a.preventDefault(),children:[!s&&e.jsxs(e.Fragment,{children:[h?e.jsx(d,{onSelect:a=>{a.preventDefault(),C()},name:"Unfavorite",icon:e.jsx(_,{size:20})}):e.jsx(d,{onSelect:a=>{a.preventDefault(),C()},name:"Favorite",icon:e.jsx(ee,{size:20})}),k("notify")&&e.jsx(e.Fragment,{children:g?e.jsx(d,{onSelect:a=>{a.preventDefault(),w()},name:"Do not notify",icon:e.jsx(de,{size:20})}):e.jsx(d,{onSelect:a=>{a.preventDefault(),w()},name:"Notify",icon:e.jsx(oe,{size:20})})})]}),b?e.jsx(d,{onSelect:a=>{a.preventDefault(),x()},name:"Unfollow",icon:e.jsx(te,{size:20})}):e.jsx(d,{onSelect:a=>{a.preventDefault(),x()},name:"Follow",icon:e.jsx(ae,{size:20})}),!s&&O&&e.jsx(d,{onSelect:()=>{c({to:"channelSettings",params:{channelKey:n.key}})},name:"Manage",icon:e.jsx(Ce,{size:20})}),T&&e.jsx(d,{onSelect:()=>{u(!0)},name:"Leave as member",icon:e.jsx(z,{size:20,className:"text-danger"}),destructive:!0}),Z&&e.jsx(d,{onSelect:()=>{f(!0)},name:"Remove self as moderator",icon:e.jsx(E,{size:20,className:"text-danger"}),destructive:!0})]})})]}),m&&e.jsx(fe,{close:()=>{u(!1)},confirm:j}),v&&e.jsx(me,{close:()=>{f(!1)},confirm:F})]})};ue.displayName="ChannelDropdownMenu";function fe({close:o,confirm:t}){return e.jsx(B,{onBackdropClose:()=>{o()},onCancel:()=>{o()},onConfirm:t,title:"Leave channel",confirmText:"Leave",destructive:!0,icon:({size:s})=>e.jsx(z,{size:s}),body:e.jsx(e.Fragment,{children:"By removing yourself from this channel, you will lose access to casting in this channel, and any replies you've made will be hidden from other members."})})}function me({close:o,confirm:t}){return e.jsx(B,{onBackdropClose:()=>{o()},onCancel:()=>{o()},onConfirm:t,title:"Remove self as moderator",confirmText:"Remove",destructive:!0,icon:({size:s})=>e.jsx(E,{size:s}),body:e.jsx(e.Fragment,{children:"You will no longer be able to manage channel members or invite links. You will still have access to the channel as a regular member."})})}export{de as B,ue as C,Ce as S,ce as u};

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.