mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-15 11:51:37 +00:00
1 line
21 KiB
Plaintext
1 line
21 KiB
Plaintext
{"version":3,"sources":["webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/drawer/header/index.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/util/numbers.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/components/hashtag.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/drawer/results/index.js","webpack:///app/javascript/builds/pleroma/mastofe/app/javascript/flavours/glitch/features/drawer/index.js"],"names":["messages","defineMessages","community","id","defaultMessage","home_timeline","logout","notifications","public","settings","start","DrawerHeader","_ref","columns","unreadNotifications","showNotificationsBadge","intl","onSettingsClick","renderForColumn","conditionalRender","bind","columnId","some","column","get","Object","jsx","className","Link","aria-label","formatMessage","title","to","icon","onClick","href","data-method","signOutLink","shortNumberFormat","number","index_es","value","react","maximumFractionDigits","Hashtag","hashtag","permalink","values","rawCount","getIn","count","build","width","height","data","reverse","map","day","toArray","style","fill","total","DrawerResults","results","visible","accounts","statuses","hashtags","reduce","size","item","optional_motion","defaultStyle","x","spring","stiffness","damping","_ref2","transform","visibility","react_default","a","createElement","esm_extends","accountId","account_container","statusId","status_container","components_hashtag","compose","Drawer","props","_React$Component","call","this","render","_this$props","account","multiColumn","onChange","onClear","onOpenSettings","onShow","onSubmit","searchHidden","searchValue","submitted","isSearchPage","computedClass","classNames","role","drawer_search","drawer_account","composer","mascot","alt","draggable","src","React","Component","wrap","state","me","dispatch","changeSearch","clearSearch","showSearch","submitSearch","e","preventDefault","stopPropagation","openModal"],"mappings":"iOAeMA,EAAWC,YAAe,CAC9BC,UAAS,CAAAC,GAAA,oCAAAC,eAAA,kBAITC,cAAa,CAAAF,GAAA,gBAAAC,eAAA,QAIbE,OAAM,CAAAH,GAAA,wBAAAC,eAAA,UAING,cAAa,CAAAJ,GAAA,yB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A,IACxBxE,OAAAC,EAAA,EAAAD,CAACwF,EAAA,EAAD,IACCf,GAAegB,KACdzF,OAAAC,EAAA,EAAAD,CAAA,OAAKE,UAAU,gCAAf,EACEF,OAAAC,EAAA,EAAAD,CAAA,OAAK0F,IAAI,GAAGC,UAAU,QAAQC,IAAKH,SAKvChB,GAAeS,IACflF,OAAAC,EAAA,EAAAD,CAACqC,EAAD,CACEC,QAASA,EACTC,QAAS0C,IAAcF,UAhEhBc,IAAMC,WAmGZC,sBAAK9B,EApII,SAAA+B,GAAK,MAAK,CAChCxB,QAASwB,EAAMxE,MAAM,CAAC,WAAYyE,MAClC7G,QAAS4G,EAAMxE,MAAM,CAAC,WAAY,YAClCc,QAAS0D,EAAMxE,MAAM,CAAC,SAAU,YAChCuD,aAAciB,EAAMxE,MAAM,CAAC,SAAU,WACrCwD,YAAagB,EAAMxE,MAAM,CAAC,SAAU,UACpCyD,UAAWe,EAAMxE,MAAM,CAAC,SAAU,cAClCnC,oBAAqB2G,EAAMxE,MAAM,CAAC,gBAAiB,WACnDlC,uBAAwB0G,EAAMxE,MAAM,CAAC,iBAAkB,gBAAiB,gBAI/C,SAAC0E,EAAD/G,KAAaI,KAAb,MAAyB,CAClDmF,SADkD,SACxC1D,GACRkF,EAASC,YAAanF,KAExB2D,QAJkD,WAKhDuB,EAASE,gBAEXvB,OAPkD,WAQhDqB,EAASG,gBAEXvB,SAVkD,WAWhDoB,EAASI,gBAEX1B,eAbkD,SAalC2B,GACdA,EAAEC,iBACFD,EAAEE,kBACFP,EAASQ,YAAU,WAAY,SAwG8B","file":"flavours/glitch/async/drawer.js","sourcesContent":["// Package imports.\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { defineMessages } from 'react-intl';\nimport { Link } from 'react-router-dom';\n\n// Components.\nimport Icon from 'flavours/glitch/components/icon';\n\n// Utils.\nimport { conditionalRender } from 'flavours/glitch/util/react_helpers';\nimport { signOutLink } from 'flavours/glitch/util/backend_links';\n\n// Messages.\nconst messages = defineMessages({\n community: {\n defaultMessage: 'Local timeline',\n id: 'navigation_bar.community_timeline',\n },\n home_timeline: {\n defaultMessage: 'Home',\n id: 'tabs_bar.home',\n },\n logout: {\n defaultMessage: 'Logout',\n id: 'navigation_bar.logout',\n },\n notifications: {\n defaultMessage: 'Notifications',\n id: 'tabs_bar.notifications',\n },\n public: {\n defaultMessage: 'Federated timeline',\n id: 'navigation_bar.public_timeline',\n },\n settings: {\n defaultMessage: 'App settings',\n id: 'navigation_bar.app_settings',\n },\n start: {\n defaultMessage: 'Getting started',\n id: 'getting_started.heading',\n },\n});\n\n// The component.\nexport default function DrawerHeader ({\n columns,\n unreadNotifications,\n showNotificationsBadge,\n intl,\n onSettingsClick,\n}) {\n\n // Only renders the component if the column isn't being shown.\n const renderForColumn = conditionalRender.bind(null,\n columnId => !columns || !columns.some(\n column => column.get('id') === columnId\n )\n );\n\n // The result.\n return (\n <nav className='drawer--header'>\n <Link\n aria-label={intl.formatMessage(messages.start)}\n title={intl.formatMessage(messages.start)}\n to='/getting-started'\n ><Icon icon='asterisk' /></Link>\n {renderForColumn('HOME', (\n <Link\n aria-label={intl.formatMessage(messages.home_timeline)}\n title={intl.formatMessage(messages.home_timeline)}\n to='/timelines/home'\n ><Icon icon='home' /></Link>\n ))}\n {renderForColumn('NOTIFICATIONS', (\n <Link\n aria-label={intl.formatMessage(messages.notifications)}\n title={intl.formatMessage(messages.notifications)}\n to='/notifications'\n >\n <span className='icon-badge-wrapper'>\n <Icon icon='bell' />\n { showNotificationsBadge && unreadNotifications > 0 && <div className='icon-badge' />}\n </span>\n </Link>\n ))}\n {renderForColumn('COMMUNITY', (\n <Link\n aria-label={intl.formatMessage(messages.community)}\n title={intl.formatMessage(messages.community)}\n to='/timelines/public/local'\n ><Icon icon='users' /></Link>\n ))}\n {renderForColumn('PUBLIC', (\n <Link\n aria-label={intl.formatMessage(messages.public)}\n title={intl.formatMessage(messages.public)}\n to='/timelines/public'\n ><Icon icon='globe' /></Link>\n ))}\n <a\n aria-label={intl.formatMessage(messages.settings)}\n onClick={onSettingsClick}\n href='#'\n title={intl.formatMessage(messages.settings)}\n ><Icon icon='cogs' /></a>\n <a\n aria-label={intl.formatMessage(messages.logout)}\n data-method='delete'\n href={ signOutLink }\n title={intl.formatMessage(messages.logout)}\n ><Icon icon='sign-out' /></a>\n </nav>\n );\n}\n\n// Props.\nDrawerHeader.propTypes = {\n columns: ImmutablePropTypes.list,\n unreadNotifications: PropTypes.number,\n showNotificationsBadge: PropTypes.bool,\n intl: PropTypes.object,\n onSettingsClick: PropTypes.func,\n};\n","import React, { Fragment } from 'react';\nimport { FormattedNumber } from 'react-intl';\n\nexport const shortNumberFormat = number => {\n if (number < 1000) {\n return <FormattedNumber value={number} />;\n } else {\n return <Fragment><FormattedNumber value={number / 1000} maximumFractionDigits={1} />K</Fragment>;\n }\n};\n","import React from 'react';\nimport { Sparklines, SparklinesCurve } from 'react-sparklines';\nimport { FormattedMessage } from 'react-intl';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport Permalink from './permalink';\nimport { shortNumberFormat } from 'flavours/glitch/util/numbers';\n\nconst Hashtag = ({ hashtag }) => (\n <div className='trends__item'>\n <div className='trends__item__name'>\n <Permalink href={hashtag.get('url')} to={`/timelines/tag/${hashtag.get('name')}`}>\n #<span>{hashtag.get('name')}</span>\n </Permalink>\n\n <FormattedMessage id='trends.count_by_accounts' defaultMessage='{count} {rawCount, plural, one {person} other {people}} talking' values={{ rawCount: hashtag.getIn(['history', 0, 'accounts']), count: <strong>{shortNumberFormat(hashtag.getIn(['history', 0, 'accounts']))}</strong> }} />\n </div>\n\n <div className='trends__item__current'>\n {shortNumberFormat(hashtag.getIn(['history', 0, 'uses']))}\n </div>\n\n <div className='trends__item__sparkline'>\n <Sparklines width={50} height={28} data={hashtag.get('history') && hashtag.get('history').reverse().map(day => day.get('uses')).toArray()}>\n <SparklinesCurve style={{ fill: 'none' }} />\n </Sparklines>\n </div>\n </div>\n);\n\nHashtag.propTypes = {\n hashtag: ImmutablePropTypes.map.isRequired,\n};\n\nexport default Hashtag;\n","// Package imports.\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport {\n FormattedMessage,\n defineMessages,\n} from 'react-intl';\nimport spring from 'react-motion/lib/spring';\nimport { Link } from 'react-router-dom';\n\n// Components.\nimport AccountContainer from 'flavours/glitch/containers/account_container';\nimport StatusContainer from 'flavours/glitch/containers/status_container';\nimport Hashtag from 'flavours/glitch/components/hashtag';\n\n// Utils.\nimport Motion from 'flavours/glitch/util/optional_motion';\n\n// Messages.\nconst messages = defineMessages({\n total: {\n defaultMessage: '{count, number} {count, plural, one {result} other {results}}',\n id: 'search_results.total',\n },\n});\n\n// The component.\nexport default function DrawerResults ({\n results,\n visible,\n}) {\n const accounts = results ? results.get('accounts') : null;\n const statuses = results ? results.get('statuses') : null;\n const hashtags = results ? results.get('hashtags') : null;\n\n // This gets the total number of items.\n const count = [accounts, statuses, hashtags].reduce(function (size, item) {\n if (item && item.size) {\n return size + item.size;\n }\n return size;\n }, 0);\n\n // The result.\n return (\n <Motion\n defaultStyle={{ x: -100 }}\n style={{\n x: spring(visible ? 0 : -100, {\n stiffness: 210,\n damping: 20,\n }),\n }}\n >\n {({ x }) => (\n <div\n className='drawer--results'\n style={{\n transform: `translateX(${x}%)`,\n visibility: x === -100 ? 'hidden' : 'visible',\n }}\n >\n <header>\n <FormattedMessage\n {...messages.total}\n values={{ count }}\n />\n </header>\n {accounts && accounts.size ? (\n <section>\n <h5><FormattedMessage id='search_results.accounts' defaultMessage='People' /></h5>\n\n {accounts.map(\n accountId => (\n <AccountContainer\n id={accountId}\n key={accountId}\n />\n )\n )}\n </section>\n ) : null}\n {statuses && statuses.size ? (\n <section>\n <h5><FormattedMessage id='search_results.statuses' defaultMessage='Toots' /></h5>\n\n {statuses.map(\n statusId => (\n <StatusContainer\n id={statusId}\n key={statusId}\n />\n )\n )}\n </section>\n ) : null}\n {hashtags && hashtags.size ? (\n <section>\n <h5><FormattedMessage id='search_results.hashtags' defaultMessage='Hashtags' /></h5>\n\n {hashtags.map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}\n </section>\n ) : null}\n </div>\n )}\n </Motion>\n );\n}\n\n// Props.\nDrawerResults.propTypes = {\n results: ImmutablePropTypes.map,\n visible: PropTypes.bool,\n};\n","// Package imports.\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { defineMessages } from 'react-intl';\nimport classNames from 'classnames';\n\n// Actions.\nimport { openModal } from 'flavours/glitch/actions/modal';\nimport {\n changeSearch,\n clearSearch,\n showSearch,\n submitSearch,\n} from 'flavours/glitch/actions/search';\n\n// Components.\nimport Composer from 'flavours/glitch/features/composer';\nimport DrawerAccount from './account';\nimport DrawerHeader from './header';\nimport DrawerResults from './results';\nimport DrawerSearch from './search';\n\n// Utils.\nimport { me, mascot } from 'flavours/glitch/util/initial_state';\nimport { wrap } from 'flavours/glitch/util/redux_helpers';\n\n// Messages.\nconst messages = defineMessages({\n compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new toot' },\n});\n\n// State mapping.\nconst mapStateToProps = state => ({\n account: state.getIn(['accounts', me]),\n columns: state.getIn(['settings', 'columns']),\n results: state.getIn(['search', 'results']),\n searchHidden: state.getIn(['search', 'hidden']),\n searchValue: state.getIn(['search', 'value']),\n submitted: state.getIn(['search', 'submitted']),\n unreadNotifications: state.getIn(['notifications', 'unread']),\n showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']),\n});\n\n// Dispatch mapping.\nconst mapDispatchToProps = (dispatch, { intl }) => ({\n onChange (value) {\n dispatch(changeSearch(value));\n },\n onClear () {\n dispatch(clearSearch());\n },\n onShow () {\n dispatch(showSearch());\n },\n onSubmit () {\n dispatch(submitSearch());\n },\n onOpenSettings (e) {\n e.preventDefault();\n e.stopPropagation();\n dispatch(openModal('SETTINGS', {}));\n },\n});\n\n// The component.\nclass Drawer extends React.Component {\n\n // Constructor.\n constructor (props) {\n super(props);\n }\n\n // Rendering.\n render () {\n const {\n account,\n columns,\n intl,\n multiColumn,\n onChange,\n onClear,\n onOpenSettings,\n onShow,\n onSubmit,\n results,\n searchHidden,\n searchValue,\n submitted,\n isSearchPage,\n unreadNotifications,\n showNotificationsBadge,\n } = this.props;\n const computedClass = classNames('drawer', 'mbstobon');\n\n // The result.\n return (\n <div className={computedClass} role='region' aria-label={intl.formatMessage(messages.compose)}>\n {multiColumn ? (\n <DrawerHeader\n columns={columns}\n unreadNotifications={unreadNotifications}\n showNotificationsBadge={showNotificationsBadge}\n intl={intl}\n onSettingsClick={onOpenSettings}\n />\n ) : null}\n {(multiColumn || isSearchPage) && <DrawerSearch\n intl={intl}\n onChange={onChange}\n onClear={onClear}\n onShow={onShow}\n onSubmit={onSubmit}\n submitted={submitted}\n value={searchValue}\n /> }\n <div className='drawer__pager'>\n {!isSearchPage && <div className='drawer__inner'>\n <DrawerAccount account={account} />\n <Composer />\n {multiColumn && mascot && (\n <div className='drawer__inner__mastodon'>\n <img alt='' draggable='false' src={mascot} />\n </div>\n )}\n </div>}\n\n {(multiColumn || isSearchPage) &&\n <DrawerResults\n results={results}\n visible={submitted && !searchHidden}\n />}\n </div>\n </div>\n );\n }\n\n}\n\n// Props.\nDrawer.propTypes = {\n intl: PropTypes.object.isRequired,\n isSearchPage: PropTypes.bool,\n multiColumn: PropTypes.bool,\n\n // State props.\n account: ImmutablePropTypes.map,\n columns: ImmutablePropTypes.list,\n results: ImmutablePropTypes.map,\n searchHidden: PropTypes.bool,\n searchValue: PropTypes.string,\n submitted: PropTypes.bool,\n unreadNotifications: PropTypes.number,\n showNotificationsBadge: PropTypes.bool,\n\n // Dispatch props.\n onChange: PropTypes.func,\n onClear: PropTypes.func,\n onShow: PropTypes.func,\n onSubmit: PropTypes.func,\n onOpenSettings: PropTypes.func,\n};\n\n// Connecting and export.\nexport { Drawer as WrappedComponent };\nexport default wrap(Drawer, mapStateToProps, mapDispatchToProps, true);\n"],"sourceRoot":""} |