[build] upgrade eslint to 9.37.0 (#88)
Co-authored-by: tobi <tobi.smethurst@protonmail.com> Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88 Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org> Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
+69
-67
@@ -1,32 +1,32 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { PureComponent } from 'react';
|
||||
import PropTypes from "prop-types";
|
||||
import { PureComponent } from "react";
|
||||
|
||||
import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from 'react-intl';
|
||||
import { defineMessages, injectIntl, FormattedMessage, FormattedDate } from "react-intl";
|
||||
|
||||
import classNames from 'classnames';
|
||||
import classNames from "classnames";
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import ImmutablePropTypes from "react-immutable-proptypes";
|
||||
import ImmutablePureComponent from "react-immutable-pure-component";
|
||||
|
||||
import TransitionMotion from 'react-motion/lib/TransitionMotion';
|
||||
import spring from 'react-motion/lib/spring';
|
||||
import ReactSwipeableViews from 'react-swipeable-views';
|
||||
import TransitionMotion from "react-motion/lib/TransitionMotion";
|
||||
import spring from "react-motion/lib/spring";
|
||||
import ReactSwipeableViews from "react-swipeable-views";
|
||||
|
||||
import { AnimatedNumber } from 'flavours/glitch/components/animated_number';
|
||||
import { Icon } from 'flavours/glitch/components/icon';
|
||||
import { IconButton } from 'flavours/glitch/components/icon_button';
|
||||
import EmojiPickerDropdown from 'flavours/glitch/features/compose/containers/emoji_picker_dropdown_container';
|
||||
import unicodeMapping from 'flavours/glitch/features/emoji/emoji_unicode_mapping_light';
|
||||
import { autoPlayGif, reduceMotion, disableSwiping, mascot } from 'flavours/glitch/initial_state';
|
||||
import { assetHost } from 'flavours/glitch/utils/config';
|
||||
import elephantUIPlane from 'mastodon/../images/elephant_ui_plane.svg';
|
||||
import { AnimatedNumber } from "flavours/glitch/components/animated_number";
|
||||
import { Icon } from "flavours/glitch/components/icon";
|
||||
import { IconButton } from "flavours/glitch/components/icon_button";
|
||||
import EmojiPickerDropdown from "flavours/glitch/features/compose/containers/emoji_picker_dropdown_container";
|
||||
import unicodeMapping from "flavours/glitch/features/emoji/emoji_unicode_mapping_light";
|
||||
import { autoPlayGif, reduceMotion, disableSwiping, mascot } from "flavours/glitch/initial_state";
|
||||
import { assetHost } from "flavours/glitch/utils/config";
|
||||
import elephantUIPlane from "mastodon/../images/elephant_ui_plane.svg";
|
||||
|
||||
|
||||
|
||||
const messages = defineMessages({
|
||||
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||
previous: { id: 'lightbox.previous', defaultMessage: 'Previous' },
|
||||
next: { id: 'lightbox.next', defaultMessage: 'Next' },
|
||||
close: { id: "lightbox.close", defaultMessage: "Close" },
|
||||
previous: { id: "lightbox.previous", defaultMessage: "Previous" },
|
||||
next: { id: "lightbox.next", defaultMessage: "Next" },
|
||||
});
|
||||
|
||||
class Content extends ImmutablePureComponent {
|
||||
@@ -58,47 +58,47 @@ class Content extends ImmutablePureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const links = node.querySelectorAll('a');
|
||||
const links = node.querySelectorAll("a");
|
||||
|
||||
for (var i = 0; i < links.length; ++i) {
|
||||
let link = links[i];
|
||||
|
||||
if (link.classList.contains('status-link')) {
|
||||
if (link.classList.contains("status-link")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
link.classList.add('status-link');
|
||||
link.classList.add("status-link");
|
||||
|
||||
let mention = this.props.announcement.get('mentions').find(item => link.href === item.get('url'));
|
||||
let mention = this.props.announcement.get("mentions").find(item => link.href === item.get("url"));
|
||||
|
||||
if (mention) {
|
||||
link.addEventListener('click', this.onMentionClick.bind(this, mention), false);
|
||||
link.setAttribute('title', mention.get('acct'));
|
||||
} else if (link.textContent[0] === '#' || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === '#')) {
|
||||
link.addEventListener('click', this.onHashtagClick.bind(this, link.text), false);
|
||||
link.addEventListener("click", this.onMentionClick.bind(this, mention), false);
|
||||
link.setAttribute("title", mention.get("acct"));
|
||||
} else if (link.textContent[0] === "#" || (link.previousSibling && link.previousSibling.textContent && link.previousSibling.textContent[link.previousSibling.textContent.length - 1] === "#")) {
|
||||
link.addEventListener("click", this.onHashtagClick.bind(this, link.text), false);
|
||||
} else {
|
||||
let status = this.props.announcement.get('statuses').find(item => link.href === item.get('url'));
|
||||
let status = this.props.announcement.get("statuses").find(item => link.href === item.get("url"));
|
||||
if (status) {
|
||||
link.addEventListener('click', this.onStatusClick.bind(this, status), false);
|
||||
link.addEventListener("click", this.onStatusClick.bind(this, status), false);
|
||||
}
|
||||
link.setAttribute('title', link.href);
|
||||
link.classList.add('unhandled-link');
|
||||
link.setAttribute("title", link.href);
|
||||
link.classList.add("unhandled-link");
|
||||
}
|
||||
|
||||
link.setAttribute('target', '_blank');
|
||||
link.setAttribute('rel', 'noopener noreferrer');
|
||||
link.setAttribute("target", "_blank");
|
||||
link.setAttribute("rel", "noopener noreferrer");
|
||||
}
|
||||
}
|
||||
|
||||
onMentionClick = (mention, e) => {
|
||||
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
this.context.router.history.push(`/@${mention.get('acct')}`);
|
||||
this.context.router.history.push(`/@${mention.get("acct")}`);
|
||||
}
|
||||
};
|
||||
|
||||
onHashtagClick = (hashtag, e) => {
|
||||
hashtag = hashtag.replace(/^#/, '');
|
||||
hashtag = hashtag.replace(/^#/, "");
|
||||
|
||||
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
@@ -109,7 +109,7 @@ class Content extends ImmutablePureComponent {
|
||||
onStatusClick = (status, e) => {
|
||||
if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault();
|
||||
this.context.router.history.push(`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`);
|
||||
this.context.router.history.push(`/@${status.getIn(["account", "acct"])}/${status.get("id")}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,11 +118,11 @@ class Content extends ImmutablePureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const emojis = currentTarget.querySelectorAll('.custom-emoji');
|
||||
const emojis = currentTarget.querySelectorAll(".custom-emoji");
|
||||
|
||||
for (var i = 0; i < emojis.length; i++) {
|
||||
let emoji = emojis[i];
|
||||
emoji.src = emoji.getAttribute('data-original');
|
||||
emoji.src = emoji.getAttribute("data-original");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -131,11 +131,11 @@ class Content extends ImmutablePureComponent {
|
||||
return;
|
||||
}
|
||||
|
||||
const emojis = currentTarget.querySelectorAll('.custom-emoji');
|
||||
const emojis = currentTarget.querySelectorAll(".custom-emoji");
|
||||
|
||||
for (var i = 0; i < emojis.length; i++) {
|
||||
let emoji = emojis[i];
|
||||
emoji.src = emoji.getAttribute('data-static');
|
||||
emoji.src = emoji.getAttribute("data-static");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -146,7 +146,7 @@ class Content extends ImmutablePureComponent {
|
||||
<div
|
||||
className='announcements__item__content translate'
|
||||
ref={this.setRef}
|
||||
dangerouslySetInnerHTML={{ __html: announcement.get('contentHtml') }}
|
||||
dangerouslySetInnerHTML={{ __html: announcement.get("contentHtml") }}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
/>
|
||||
@@ -168,7 +168,7 @@ class Emoji extends PureComponent {
|
||||
|
||||
if (unicodeMapping[emoji]) {
|
||||
const { filename, shortCode } = unicodeMapping[this.props.emoji];
|
||||
const title = shortCode ? `:${shortCode}:` : '';
|
||||
const title = shortCode ? `:${shortCode}:` : "";
|
||||
|
||||
return (
|
||||
<img
|
||||
@@ -180,7 +180,7 @@ class Emoji extends PureComponent {
|
||||
/>
|
||||
);
|
||||
} else if (emojiMap.get(emoji)) {
|
||||
const filename = (autoPlayGif || hovered) ? emojiMap.getIn([emoji, 'url']) : emojiMap.getIn([emoji, 'static_url']);
|
||||
const filename = (autoPlayGif || hovered) ? emojiMap.getIn([emoji, "url"]) : emojiMap.getIn([emoji, "static_url"]);
|
||||
const shortCode = `:${emoji}:`;
|
||||
|
||||
return (
|
||||
@@ -217,10 +217,10 @@ class Reaction extends ImmutablePureComponent {
|
||||
handleClick = () => {
|
||||
const { reaction, announcementId, addReaction, removeReaction } = this.props;
|
||||
|
||||
if (reaction.get('me')) {
|
||||
removeReaction(announcementId, reaction.get('name'));
|
||||
if (reaction.get("me")) {
|
||||
removeReaction(announcementId, reaction.get("name"));
|
||||
} else {
|
||||
addReaction(announcementId, reaction.get('name'));
|
||||
addReaction(announcementId, reaction.get("name"));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -231,16 +231,16 @@ class Reaction extends ImmutablePureComponent {
|
||||
render () {
|
||||
const { reaction } = this.props;
|
||||
|
||||
let shortCode = reaction.get('name');
|
||||
let shortCode = reaction.get("name");
|
||||
|
||||
if (unicodeMapping[shortCode]) {
|
||||
shortCode = unicodeMapping[shortCode].shortCode;
|
||||
}
|
||||
|
||||
return (
|
||||
<button className={classNames('reactions-bar__item', { active: reaction.get('me') })} onClick={this.handleClick} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} title={`:${shortCode}:`} style={this.props.style}>
|
||||
<span className='reactions-bar__item__emoji'><Emoji hovered={this.state.hovered} emoji={reaction.get('name')} emojiMap={this.props.emojiMap} /></span>
|
||||
<span className='reactions-bar__item__count'><AnimatedNumber value={reaction.get('count')} /></span>
|
||||
<button className={classNames("reactions-bar__item", { active: reaction.get("me") })} onClick={this.handleClick} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} title={`:${shortCode}:`} style={this.props.style}>
|
||||
<span className='reactions-bar__item__emoji'><Emoji hovered={this.state.hovered} emoji={reaction.get("name")} emojiMap={this.props.emojiMap} /></span>
|
||||
<span className='reactions-bar__item__count'><AnimatedNumber value={reaction.get("count")} /></span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class ReactionsBar extends ImmutablePureComponent {
|
||||
|
||||
handleEmojiPick = data => {
|
||||
const { addReaction, announcementId } = this.props;
|
||||
addReaction(announcementId, data.native.replace(/:/g, ''));
|
||||
addReaction(announcementId, data.native.replace(/:/g, ""));
|
||||
};
|
||||
|
||||
willEnter () {
|
||||
@@ -272,10 +272,10 @@ class ReactionsBar extends ImmutablePureComponent {
|
||||
|
||||
render () {
|
||||
const { reactions } = this.props;
|
||||
const visibleReactions = reactions.filter(x => x.get('count') > 0);
|
||||
const visibleReactions = reactions.filter(x => x.get("count") > 0);
|
||||
|
||||
const styles = visibleReactions.map(reaction => ({
|
||||
key: reaction.get('name'),
|
||||
key: reaction.get("name"),
|
||||
data: reaction,
|
||||
style: { scale: reduceMotion ? 1 : spring(1, { stiffness: 150, damping: 13 }) },
|
||||
})).toArray();
|
||||
@@ -283,12 +283,12 @@ class ReactionsBar extends ImmutablePureComponent {
|
||||
return (
|
||||
<TransitionMotion styles={styles} willEnter={this.willEnter} willLeave={this.willLeave}>
|
||||
{items => (
|
||||
<div className={classNames('reactions-bar', { 'reactions-bar--empty': visibleReactions.isEmpty() })}>
|
||||
<div className={classNames("reactions-bar", { "reactions-bar--empty": visibleReactions.isEmpty() })}>
|
||||
{items.map(({ key, data, style }) => (
|
||||
<Reaction
|
||||
key={key}
|
||||
reaction={data}
|
||||
style={{ transform: `scale(${style.scale})`, position: style.scale < 0.5 ? 'absolute' : 'static' }}
|
||||
style={{ transform: `scale(${style.scale})`, position: style.scale < 0.5 ? "absolute" : "static" }}
|
||||
announcementId={this.props.announcementId}
|
||||
addReaction={this.props.addReaction}
|
||||
removeReaction={this.props.removeReaction}
|
||||
@@ -317,39 +317,39 @@ class Announcement extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
state = {
|
||||
unread: !this.props.announcement.get('read'),
|
||||
unread: !this.props.announcement.get("read"),
|
||||
};
|
||||
|
||||
componentDidUpdate () {
|
||||
const { selected, announcement } = this.props;
|
||||
if (!selected && this.state.unread !== !announcement.get('read')) {
|
||||
this.setState({ unread: !announcement.get('read') });
|
||||
if (!selected && this.state.unread !== !announcement.get("read")) {
|
||||
this.setState({ unread: !announcement.get("read") });
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { announcement } = this.props;
|
||||
const { unread } = this.state;
|
||||
const startsAt = announcement.get('starts_at') && new Date(announcement.get('starts_at'));
|
||||
const endsAt = announcement.get('ends_at') && new Date(announcement.get('ends_at'));
|
||||
const startsAt = announcement.get("starts_at") && new Date(announcement.get("starts_at"));
|
||||
const endsAt = announcement.get("ends_at") && new Date(announcement.get("ends_at"));
|
||||
const now = new Date();
|
||||
const hasTimeRange = startsAt && endsAt;
|
||||
const skipYear = hasTimeRange && startsAt.getFullYear() === endsAt.getFullYear() && endsAt.getFullYear() === now.getFullYear();
|
||||
const skipEndDate = hasTimeRange && startsAt.getDate() === endsAt.getDate() && startsAt.getMonth() === endsAt.getMonth() && startsAt.getFullYear() === endsAt.getFullYear();
|
||||
const skipTime = announcement.get('all_day');
|
||||
const skipTime = announcement.get("all_day");
|
||||
|
||||
return (
|
||||
<div className='announcements__item'>
|
||||
<strong className='announcements__item__range'>
|
||||
<FormattedMessage id='announcement.announcement' defaultMessage='Announcement' />
|
||||
{hasTimeRange && <span> · <FormattedDate value={startsAt} hour12={false} year={(skipYear || startsAt.getFullYear() === now.getFullYear()) ? undefined : 'numeric'} month='short' day='2-digit' hour={skipTime ? undefined : '2-digit'} minute={skipTime ? undefined : '2-digit'} /> - <FormattedDate value={endsAt} hour12={false} year={(skipYear || endsAt.getFullYear() === now.getFullYear()) ? undefined : 'numeric'} month={skipEndDate ? undefined : 'short'} day={skipEndDate ? undefined : '2-digit'} hour={skipTime ? undefined : '2-digit'} minute={skipTime ? undefined : '2-digit'} /></span>}
|
||||
{hasTimeRange && <span> · <FormattedDate value={startsAt} hour12={false} year={(skipYear || startsAt.getFullYear() === now.getFullYear()) ? undefined : "numeric"} month='short' day='2-digit' hour={skipTime ? undefined : "2-digit"} minute={skipTime ? undefined : "2-digit"} /> - <FormattedDate value={endsAt} hour12={false} year={(skipYear || endsAt.getFullYear() === now.getFullYear()) ? undefined : "numeric"} month={skipEndDate ? undefined : "short"} day={skipEndDate ? undefined : "2-digit"} hour={skipTime ? undefined : "2-digit"} minute={skipTime ? undefined : "2-digit"} /></span>}
|
||||
</strong>
|
||||
|
||||
<Content announcement={announcement} />
|
||||
|
||||
<ReactionsBar
|
||||
reactions={announcement.get('reactions')}
|
||||
announcementId={announcement.get('id')}
|
||||
reactions={announcement.get("reactions")}
|
||||
announcementId={announcement.get("id")}
|
||||
addReaction={this.props.addReaction}
|
||||
removeReaction={this.props.removeReaction}
|
||||
emojiMap={this.props.emojiMap}
|
||||
@@ -397,7 +397,9 @@ class Announcements extends ImmutablePureComponent {
|
||||
const { dismissAnnouncement, announcements } = this.props;
|
||||
const { index } = this.state;
|
||||
const announcement = announcements.get(index);
|
||||
if (!announcement.get('read')) dismissAnnouncement(announcement.get('id'));
|
||||
if (!announcement.get("read")) {
|
||||
dismissAnnouncement(announcement.get("id"));
|
||||
}
|
||||
}
|
||||
|
||||
handleChangeIndex = index => {
|
||||
@@ -428,7 +430,7 @@ class Announcements extends ImmutablePureComponent {
|
||||
<ReactSwipeableViews animateHeight animateTransitions={!reduceMotion} index={index} onChangeIndex={this.handleChangeIndex}>
|
||||
{announcements.map((announcement, idx) => (
|
||||
<Announcement
|
||||
key={announcement.get('id')}
|
||||
key={announcement.get("id")}
|
||||
announcement={announcement}
|
||||
emojiMap={this.props.emojiMap}
|
||||
addReaction={this.props.addReaction}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import ImmutablePropTypes from "react-immutable-proptypes";
|
||||
import ImmutablePureComponent from "react-immutable-pure-component";
|
||||
|
||||
import { ImmutableHashtag as Hashtag } from 'flavours/glitch/components/hashtag';
|
||||
import { ImmutableHashtag as Hashtag } from "flavours/glitch/components/hashtag";
|
||||
|
||||
export default class Trends extends ImmutablePureComponent {
|
||||
|
||||
@@ -41,12 +41,12 @@ export default class Trends extends ImmutablePureComponent {
|
||||
return (
|
||||
<div className='getting-started__trends'>
|
||||
<h4>
|
||||
<Link to={'/explore/tags'}>
|
||||
<Link to={"/explore/tags"}>
|
||||
<FormattedMessage id='trends.trending_now' defaultMessage='Trending now' />
|
||||
</Link>
|
||||
</h4>
|
||||
|
||||
{trends.take(3).map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
|
||||
{trends.take(3).map(hashtag => <Hashtag key={hashtag.get("name")} hashtag={hashtag} />)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+7
-7
@@ -1,15 +1,15 @@
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { Map as ImmutableMap } from "immutable";
|
||||
import { connect } from "react-redux";
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
import { addReaction, removeReaction, dismissAnnouncement } from 'flavours/glitch/actions/announcements';
|
||||
import { addReaction, removeReaction, dismissAnnouncement } from "flavours/glitch/actions/announcements";
|
||||
|
||||
import Announcements from '../components/announcements';
|
||||
import Announcements from "../components/announcements";
|
||||
|
||||
const customEmojiMap = createSelector([state => state.get('custom_emojis')], items => items.reduce((map, emoji) => map.set(emoji.get('shortcode'), emoji), ImmutableMap()));
|
||||
const customEmojiMap = createSelector([state => state.get("custom_emojis")], items => items.reduce((map, emoji) => map.set(emoji.get("shortcode"), emoji), ImmutableMap()));
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
announcements: state.getIn(['announcements', 'items']),
|
||||
announcements: state.getIn(["announcements", "items"]),
|
||||
emojiMap: customEmojiMap(state),
|
||||
});
|
||||
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { connect } from "react-redux";
|
||||
|
||||
import { fetchTrendingHashtags } from 'flavours/glitch/actions/trends';
|
||||
import { fetchTrendingHashtags } from "flavours/glitch/actions/trends";
|
||||
|
||||
import Trends from '../components/trends';
|
||||
import Trends from "../components/trends";
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
trends: state.getIn(['trends', 'tags', 'items']),
|
||||
trends: state.getIn(["trends", "tags", "items"]),
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import PropTypes from "prop-types";
|
||||
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { defineMessages, injectIntl } from "react-intl";
|
||||
|
||||
import { Helmet } from 'react-helmet';
|
||||
import { Helmet } from "react-helmet";
|
||||
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { List as ImmutableList } from "immutable";
|
||||
import ImmutablePropTypes from "react-immutable-proptypes";
|
||||
import ImmutablePureComponent from "react-immutable-pure-component";
|
||||
import { connect } from "react-redux";
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
import { fetchFollowRequests } from 'flavours/glitch/actions/accounts';
|
||||
import { fetchLists } from 'flavours/glitch/actions/lists';
|
||||
import { openModal } from 'flavours/glitch/actions/modal';
|
||||
import Column from 'flavours/glitch/features/ui/components/column';
|
||||
import ColumnLink from 'flavours/glitch/features/ui/components/column_link';
|
||||
import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading';
|
||||
import LinkFooter from 'flavours/glitch/features/ui/components/link_footer';
|
||||
import { me, showTrends } from 'flavours/glitch/initial_state';
|
||||
import { preferencesLink } from 'flavours/glitch/utils/backend_links';
|
||||
import { fetchFollowRequests } from "flavours/glitch/actions/accounts";
|
||||
import { fetchLists } from "flavours/glitch/actions/lists";
|
||||
import { openModal } from "flavours/glitch/actions/modal";
|
||||
import Column from "flavours/glitch/features/ui/components/column";
|
||||
import ColumnLink from "flavours/glitch/features/ui/components/column_link";
|
||||
import ColumnSubheading from "flavours/glitch/features/ui/components/column_subheading";
|
||||
import LinkFooter from "flavours/glitch/features/ui/components/link_footer";
|
||||
import { me, showTrends } from "flavours/glitch/initial_state";
|
||||
import { preferencesLink } from "flavours/glitch/utils/backend_links";
|
||||
|
||||
import NavigationBar from '../compose/components/navigation_bar';
|
||||
import NavigationBar from "../compose/components/navigation_bar";
|
||||
|
||||
import TrendsContainer from './containers/trends_container';
|
||||
import TrendsContainer from "./containers/trends_container";
|
||||
|
||||
|
||||
const messages = defineMessages({
|
||||
heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
|
||||
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
|
||||
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
|
||||
public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
|
||||
navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation' },
|
||||
settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' },
|
||||
community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
|
||||
explore: { id: 'navigation_bar.explore', defaultMessage: 'Explore' },
|
||||
direct: { id: 'navigation_bar.direct', defaultMessage: 'Private mentions' },
|
||||
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },
|
||||
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
|
||||
settings: { id: 'navigation_bar.app_settings', defaultMessage: 'App settings' },
|
||||
follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
|
||||
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
|
||||
keyboard_shortcuts: { id: 'navigation_bar.keyboard_shortcuts', defaultMessage: 'Keyboard shortcuts' },
|
||||
lists_subheading: { id: 'column_subheading.lists', defaultMessage: 'Lists' },
|
||||
misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' },
|
||||
menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
|
||||
heading: { id: "getting_started.heading", defaultMessage: "Getting started" },
|
||||
home_timeline: { id: "tabs_bar.home", defaultMessage: "Home" },
|
||||
notifications: { id: "tabs_bar.notifications", defaultMessage: "Notifications" },
|
||||
public_timeline: { id: "navigation_bar.public_timeline", defaultMessage: "Federated timeline" },
|
||||
navigation_subheading: { id: "column_subheading.navigation", defaultMessage: "Navigation" },
|
||||
settings_subheading: { id: "column_subheading.settings", defaultMessage: "Settings" },
|
||||
community_timeline: { id: "navigation_bar.community_timeline", defaultMessage: "Local timeline" },
|
||||
explore: { id: "navigation_bar.explore", defaultMessage: "Explore" },
|
||||
direct: { id: "navigation_bar.direct", defaultMessage: "Private mentions" },
|
||||
bookmarks: { id: "navigation_bar.bookmarks", defaultMessage: "Bookmarks" },
|
||||
preferences: { id: "navigation_bar.preferences", defaultMessage: "Preferences" },
|
||||
settings: { id: "navigation_bar.app_settings", defaultMessage: "App settings" },
|
||||
follow_requests: { id: "navigation_bar.follow_requests", defaultMessage: "Follow requests" },
|
||||
lists: { id: "navigation_bar.lists", defaultMessage: "Lists" },
|
||||
keyboard_shortcuts: { id: "navigation_bar.keyboard_shortcuts", defaultMessage: "Keyboard shortcuts" },
|
||||
lists_subheading: { id: "column_subheading.lists", defaultMessage: "Lists" },
|
||||
misc: { id: "navigation_bar.misc", defaultMessage: "Misc" },
|
||||
menu: { id: "getting_started.heading", defaultMessage: "Getting started" },
|
||||
});
|
||||
|
||||
const makeMapStateToProps = () => {
|
||||
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
|
||||
const getOrderedLists = createSelector([state => state.get("lists")], lists => {
|
||||
if (!lists) {
|
||||
return lists;
|
||||
}
|
||||
|
||||
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title')));
|
||||
return lists.toList().filter(item => !!item).sort((a, b) => a.get("title").localeCompare(b.get("title")));
|
||||
});
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
lists: getOrderedLists(state),
|
||||
myAccount: state.getIn(['accounts', me]),
|
||||
columns: state.getIn(['settings', 'columns']),
|
||||
unreadFollowRequests: state.getIn(['user_lists', 'follow_requests', 'items'], ImmutableList()).size,
|
||||
unreadNotifications: state.getIn(['notifications', 'unread']),
|
||||
myAccount: state.getIn(["accounts", me]),
|
||||
columns: state.getIn(["settings", "columns"]),
|
||||
unreadFollowRequests: state.getIn(["user_lists", "follow_requests", "items"], ImmutableList()).size,
|
||||
unreadNotifications: state.getIn(["notifications", "unread"]),
|
||||
});
|
||||
|
||||
return mapStateToProps;
|
||||
@@ -70,7 +70,7 @@ const mapDispatchToProps = dispatch => ({
|
||||
fetchFollowRequests: () => dispatch(fetchFollowRequests()),
|
||||
fetchLists: () => dispatch(fetchLists()),
|
||||
openSettings: () => dispatch(openModal({
|
||||
modalType: 'SETTINGS',
|
||||
modalType: "SETTINGS",
|
||||
modalProps: {},
|
||||
})),
|
||||
});
|
||||
@@ -128,19 +128,19 @@ class GettingStarted extends ImmutablePureComponent {
|
||||
let listItems = [];
|
||||
|
||||
if (multiColumn) {
|
||||
if (signedIn && !columns.find(item => item.get('id') === 'HOME')) {
|
||||
if (signedIn && !columns.find(item => item.get("id") === "HOME")) {
|
||||
navItems.push(<ColumnLink key='home' icon='home' text={intl.formatMessage(messages.home_timeline)} to='/home' />);
|
||||
}
|
||||
|
||||
if (!columns.find(item => item.get('id') === 'NOTIFICATIONS')) {
|
||||
if (!columns.find(item => item.get("id") === "NOTIFICATIONS")) {
|
||||
navItems.push(<ColumnLink key='notifications' icon='bell' text={intl.formatMessage(messages.notifications)} badge={badgeDisplay(unreadNotifications)} to='/notifications' />);
|
||||
}
|
||||
|
||||
if (!columns.find(item => item.get('id') === 'COMMUNITY')) {
|
||||
if (!columns.find(item => item.get("id") === "COMMUNITY")) {
|
||||
navItems.push(<ColumnLink key='community_timeline' icon='users' text={intl.formatMessage(messages.community_timeline)} to='/public/local' />);
|
||||
}
|
||||
|
||||
if (!columns.find(item => item.get('id') === 'PUBLIC')) {
|
||||
if (!columns.find(item => item.get("id") === "PUBLIC")) {
|
||||
navItems.push(<ColumnLink key='public_timeline' icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/public' />);
|
||||
}
|
||||
}
|
||||
@@ -150,15 +150,15 @@ class GettingStarted extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
if (signedIn) {
|
||||
if (!multiColumn || !columns.find(item => item.get('id') === 'DIRECT')) {
|
||||
if (!multiColumn || !columns.find(item => item.get("id") === "DIRECT")) {
|
||||
navItems.push(<ColumnLink key='conversations' icon='envelope' text={intl.formatMessage(messages.direct)} to='/conversations' />);
|
||||
}
|
||||
|
||||
if (!multiColumn || !columns.find(item => item.get('id') === 'BOOKMARKS')) {
|
||||
if (!multiColumn || !columns.find(item => item.get("id") === "BOOKMARKS")) {
|
||||
navItems.push(<ColumnLink key='bookmarks' icon='bookmark' text={intl.formatMessage(messages.bookmarks)} to='/bookmarks' />);
|
||||
}
|
||||
|
||||
if (myAccount.get('locked') || unreadFollowRequests > 0) {
|
||||
if (myAccount.get("locked") || unreadFollowRequests > 0) {
|
||||
navItems.push(<ColumnLink key='follow_requests' icon='user-plus' text={intl.formatMessage(messages.follow_requests)} badge={badgeDisplay(unreadFollowRequests, 40)} to='/follow_requests' />);
|
||||
}
|
||||
|
||||
@@ -167,8 +167,8 @@ class GettingStarted extends ImmutablePureComponent {
|
||||
listItems = listItems.concat([
|
||||
<div key='9'>
|
||||
<ColumnLink key='lists' icon='bars' text={intl.formatMessage(messages.lists)} to='/lists' />
|
||||
{lists.filter(list => !columns.find(item => item.get('id') === 'LIST' && item.getIn(['params', 'id']) === list.get('id'))).map(list =>
|
||||
<ColumnLink key={`list-${list.get('id')}`} to={`/lists/${list.get('id')}`} icon='list-ul' text={list.get('title')} />,
|
||||
{lists.filter(list => !columns.find(item => item.get("id") === "LIST" && item.getIn(["params", "id"]) === list.get("id"))).map(list =>
|
||||
<ColumnLink key={`list-${list.get("id")}`} to={`/lists/${list.get("id")}`} icon='list-ul' text={list.get("title")} />,
|
||||
)}
|
||||
</div>,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user