forked from AkkomaGang/akkoma
1 line
No EOL
21 KiB
Text
1 line
No EOL
21 KiB
Text
{"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/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","Hashtag","hashtag","permalink","index_es","values","rawCount","getIn","count","shortNumberFormat","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","fixedWidth","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","value","drawer_account","composer","mascot","alt","draggable","src","React","Component","wrap","state","me","dispatch","changeSearch","clearSearch","showSearch","submitSearch","e","preventDefault","stopPropagation","openModal"],"mappings":"kOAeMA,EAAWC,YAAe,CAC9BC,UAAS,CAAAC,GAAA,oCAAAC,eAAA,kBAITC,cAAa,CAAAF,GAAA,gBAAAC,eAAA,QAIbE,OAAM,CAAAH,GAAA,wBAAAC,eAAA,UAING,cAAa,CAAAJ,GAAA,yBAAAC,eAAA,iBAIbI,OAAM,CAAAL,GAAA,iCAAAC,eAAA,sBAINK,SAAQ,CAAAN,GAAA,8BAAAC,eAAA,gBAI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,EAAD,IACChB,GAAeiB,KACdvF,OAAAC,EAAA,EAAAD,CAAA,OAAKE,UAAU,gCAAf,EACEF,OAAAC,EAAA,EAAAD,CAAA,OAAKwF,IAAI,GAAGC,UAAU,QAAQC,IAAKH,SAKvCjB,GAAeS,IACf/E,OAAAC,EAAA,EAAAD,CAACiC,EAAD,CACEC,QAASA,EACTC,QAAS2C,IAAcF,UAhEhBe,IAAMC,WAmGZC,sBAAK/B,EApII,SAAAgC,GAAK,MAAK,CAChCzB,QAASyB,EAAM3E,MAAM,CAAC,WAAY4E,MAClC3G,QAAS0G,EAAM3E,MAAM,CAAC,WAAY,YAClCe,QAAS4D,EAAM3E,MAAM,CAAC,SAAU,YAChCyD,aAAckB,EAAM3E,MAAM,CAAC,SAAU,WACrC0D,YAAaiB,EAAM3E,MAAM,CAAC,SAAU,UACpC2D,UAAWgB,EAAM3E,MAAM,CAAC,SAAU,cAClC9B,oBAAqByG,EAAM3E,MAAM,CAAC,gBAAiB,WACnD7B,uBAAwBwG,EAAM3E,MAAM,CAAC,iBAAkB,gBAAiB,gBAI/C,SAAC6E,EAAD7G,KAAaI,KAAb,MAAyB,CAClDgF,SADkD,SACxCa,GACRY,EAASC,YAAab,KAExBZ,QAJkD,WAKhDwB,EAASE,gBAEXxB,OAPkD,WAQhDsB,EAASG,gBAEXxB,SAVkD,WAWhDqB,EAASI,gBAEX3B,eAbkD,SAalC4B,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 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 Icon from 'flavours/glitch/components/icon';\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 <Icon icon='search' fixedWidth />\n <FormattedMessage\n {...messages.total}\n values={{ count }}\n />\n </header>\n {accounts && accounts.size ? (\n <section>\n <h5><Icon icon='users' fixedWidth /><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><Icon icon='quote-right' fixedWidth /><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><Icon icon='hashtag' fixedWidth /><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":""} |