{"version":3,"sources":["webpack:///app/javascript/opt/mastodon/app/javascript/flavours/glitch/features/link_timeline/index.tsx"],"names":["LinkTimeline","_ref","multiColumn","url","useParams","decodedUrl","decodeURIComponent","undefined","dispatch","useAppDispatch","columnRef","useRef","firstStatusId","useAppSelector","state","timelines","getIn","story","statuses","handleHeaderClick","useCallback","_columnRef$current","current","scrollTop","handleLoadMore","maxId","expandLinkTimeline","useEffect","_jsxs","Column","bindToDocument","ref","label","title","children","_jsx","ColumnHeader","icon","iconComponent","ExploreIcon","onClick","showBackButton","StatusListContainer","timelineId","onLoadMore","trackScroll","scrollKey","regex","Helmet","name","content"],"mappings":"mPAcO,MAAMA,EAERC,IAAsB,IAArB,YAAEC,GAAaD,EACnB,MAAM,IAAEE,GAAQC,cACVC,EAAaF,EAAMG,mBAAmBH,QAAOI,EAC7CC,EAAWC,cACXC,EAAYC,iBAAkB,MAC9BC,EAAgBC,aAAgBC,GACpCT,EAEKS,EAAMC,UAAUC,MAAM,CAAC,QAAQX,IAAc,QAAS,SACvDE,IAEAU,EAAQJ,aAAgBC,GAC5BF,EACKE,EAAMI,SAASF,MAAM,CAACJ,EAAe,cACtCL,IAGAY,EAAoBC,uBAAY,KAAO,IAADC,EACzB,QAAjBA,EAAAX,EAAUY,eAAO,IAAAD,GAAjBA,EAAmBE,WAAW,GAC7B,IAEGC,EAAiBJ,uBACpBK,IACMjB,EAASkB,YAAmBrB,EAAY,CAAEoB,UAAS,GAE1D,CAACjB,EAAUH,IAOb,OAJAsB,qBAAU,KACHnB,EAASkB,YAAmBrB,GAAY,GAC5C,CAACG,EAAUH,IAGZuB,eAACC,IAAM,CAACC,gBAAiB5B,EAAa6B,IAAKrB,EAAWsB,MAAOf,aAAK,EAALA,EAAOgB,MAAMC,SAAA,CACxEC,YAACC,IAAY,CACXC,KAAK,UACLC,cAAeC,IACfN,MAAOhB,aAAK,EAALA,EAAOgB,MACdO,QAASrB,EACTjB,YAAaA,EACbuC,gBAAc,IAGhBN,YAACO,IAAmB,CAClBC,WAAY,QAAQtC,IACpBuC,WAAYpB,EACZqB,aAAW,EACXC,UAAW,iBAAiBzC,IAC5ByB,gBAAiB5B,EACjB6C,WAAOxC,IAGT4B,YAACa,IAAM,UACLb,YAAA,kBAAQlB,aAAK,EAALA,EAAOgB,OACfE,YAAA,QAAMc,KAAK,SAASC,QAAQ,eAEvB,EAKElD,W","file":"js/features/glitch/link_timeline-d9621e8e16ca3ced2121.chunk.js","sourcesContent":["import { useRef, useEffect, useCallback } from 'react';\n\nimport { Helmet } from 'react-helmet';\nimport { useParams } from 'react-router-dom';\n\nimport ExploreIcon from '@/material-icons/400-24px/explore.svg?react';\nimport { expandLinkTimeline } from 'flavours/glitch/actions/timelines';\nimport { Column } from 'flavours/glitch/components/column';\nimport type { ColumnRef } from 'flavours/glitch/components/column';\nimport { ColumnHeader } from 'flavours/glitch/components/column_header';\nimport StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container';\nimport type { Card } from 'flavours/glitch/models/status';\nimport { useAppDispatch, useAppSelector } from 'flavours/glitch/store';\n\nexport const LinkTimeline: React.FC<{\n  multiColumn: boolean;\n}> = ({ multiColumn }) => {\n  const { url } = useParams<{ url: string }>();\n  const decodedUrl = url ? decodeURIComponent(url) : undefined;\n  const dispatch = useAppDispatch();\n  const columnRef = useRef<ColumnRef>(null);\n  const firstStatusId = useAppSelector((state) =>\n    decodedUrl\n      ? // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access\n        (state.timelines.getIn([`link:${decodedUrl}`, 'items', 0]) as string)\n      : undefined,\n  );\n  const story = useAppSelector((state) =>\n    firstStatusId\n      ? (state.statuses.getIn([firstStatusId, 'card']) as Card)\n      : undefined,\n  );\n\n  const handleHeaderClick = useCallback(() => {\n    columnRef.current?.scrollTop();\n  }, []);\n\n  const handleLoadMore = useCallback(\n    (maxId: string) => {\n      void dispatch(expandLinkTimeline(decodedUrl, { maxId }));\n    },\n    [dispatch, decodedUrl],\n  );\n\n  useEffect(() => {\n    void dispatch(expandLinkTimeline(decodedUrl));\n  }, [dispatch, decodedUrl]);\n\n  return (\n    <Column bindToDocument={!multiColumn} ref={columnRef} label={story?.title}>\n      <ColumnHeader\n        icon='explore'\n        iconComponent={ExploreIcon}\n        title={story?.title}\n        onClick={handleHeaderClick}\n        multiColumn={multiColumn}\n        showBackButton\n      />\n\n      <StatusListContainer\n        timelineId={`link:${decodedUrl}`}\n        onLoadMore={handleLoadMore}\n        trackScroll\n        scrollKey={`link_timeline-${decodedUrl}`}\n        bindToDocument={!multiColumn}\n        regex={undefined}\n      />\n\n      <Helmet>\n        <title>{story?.title}</title>\n        <meta name='robots' content='noindex' />\n      </Helmet>\n    </Column>\n  );\n};\n\n// eslint-disable-next-line import/no-default-export\nexport default LinkTimeline;\n"],"sourceRoot":""}