PageSourceSearch

https://toot.wales/packs/collection_adder-D8zwRUSn.js

js toot.wales collected 2026-10-02 04:09:32 UTC 3,131 bytes, 2 lines download raw bytes

1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t,t as n}from"./jsx-runtime-SsSjplwM.js";import{a as r,c as i,s as a}from"./react-intl-Cop388b4.js";import{Q as o,nt as s,rt as c}from"./poll-xFwn7afV.js";import"./render-CyxiOTyI.js";import{E as l,L as u}from"./accounts_typed-CjqlR29F.js";import{o as d,s as f}from"./typed_functions-CyAHd4bl.js";import{f as p,mn as m,o as h,s as g,u as _}from"./status_quoted-zZwhcx8q.js";import{n as v}from"./bundle_column_error-CQQiy3lP.js";import"./form_fields-Bx7LodtA.js";import{t as y}from"./toggle_field-CSl_LwCn.js";import{n as b}from"./useAccountId-DdAVoc7P.js";import{c as x,s as S}from"./collection_list_item-Be4ekFuN.js";var C=e(t()),w={wrapper:`_feat_collection_adder_collection_toggle__wrapper`},T=n(),E=({collection:e,checked:t,disabled:n,subtitle:r,onChange:i})=>{let a=(0,C.useId)(),o=`${a}-toggle`,s=`${a}-info`;return(0,T.jsx)(p,{className:w.wrapper,icon:(0,T.jsx)(h,{accountIds:e.items.map(e=>e.account_id),sensitive:e.sensitive}),sideContent:(0,T.jsx)(y,{id:o,checked:t,disabled:n,onChange:i,"aria-describedby":s}),children:(0,T.jsx)(_,{as:`label`,htmlFor:o,subtitle:r??(0,T.jsx)(g,{collection:e,withTimestamp:!1,withAuthorHandle:!1}),children:e.name})})},D=a({close:{id:`lightbox.close`,defaultMessage:`Close`}}),O=({collection:e,account:t})=>{let n=d(),[i,a]=(0,C.useState)(!1),o=e.items.find(e=>e.account_id===t.id),s=!!o,c=(0,C.useCallback)(async r=>{a(!0),r?await n(l({collectionId:e.id,accountId:t.id})):o&&await n(u({collectionId:e.id,itemId:o.id})),a(!1)},[t.id,e.id,o,n]),f=(0,C.useCallback)(e=>{c(e.target.checked)},[c]),p=!s&&e.item_count>=25;return(0,T.jsx)(E,{collection:e,disabled:i||p,subtitle:p?(0,T.jsx)(r,{id:`collections.search_accounts_max_reached`,defaultMessage:`You have added the maximum number of accounts`}):null,checked:s,onChange:f},e.id)},k=({accountId:e,onClose:t})=>{let n=i(),a=(0,C.useId)(),l=f(t=>t.accounts.get(e)),{collections:u,status:d}=x(b());return(0,T.jsxs)(`div`,{className:`modal-root__modal dialog-modal`,children:[(0,T.jsxs)(`div`,{className:`dialog-modal__header`,children:[(0,T.jsx)(o,{className:`dialog-modal__header__close`,title:n.formatMessage(D.close),icon:`times`,iconComponent:c,onClick:t}),(0,T.jsx)(m,{as:`h1`,id:a,className:`dialog-modal__header__title`,children:(0,T.jsx)(r,{id:`collections.add_to_collection`,defaultMessage:`Add {name} to collections`,values:{name:(0,T.jsxs)(`strong`,{children:[`@`,l?.acct]})}})})]}),(0,T.jsx)(`div`,{className:`dialog-modal__content`,children:(0,T.jsx)(`div`,{className:`lists-scrollable`,role:`group`,"aria-labelledby":a,children:d===`loading`||!l?(0,T.jsx)(s,{}):u.length===0?(0,T.jsx)(v,{title:(0,T.jsx)(r,{id:`empty_column.collections_self`,defaultMessage:`You have not created any collections yet.`}),message:(0,T.jsx)(r,{id:`empty_column.account_featured_self.showcase_accounts_desc`,defaultMessage:`Collections are curated lists of accounts to help others discover more of the Fediverse.`}),children:(0,T.jsx)(S,{onClick:t})}):u.map(e=>(0,T.jsx)(O,{collection:e,account:l},e.id))})})]})};export{k as CollectionAdder};
2//# sourceMappingURL=collection_adder-D8zwRUSn.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.