[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:
@@ -3,22 +3,22 @@
|
||||
@typescript-eslint/no-unsafe-assignment,
|
||||
@typescript-eslint/no-unsafe-member-access
|
||||
-- the settings store is not yet typed */
|
||||
import { useCallback } from 'react';
|
||||
import { useCallback } from "react";
|
||||
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
||||
import { useAppSelector, useAppDispatch } from "mastodon/store";
|
||||
|
||||
import { changeSetting } from '../../../actions/settings';
|
||||
import SettingToggle from '../../notifications/components/setting_toggle';
|
||||
import { changeSetting } from "../../../actions/settings";
|
||||
import SettingToggle from "../../notifications/components/setting_toggle";
|
||||
|
||||
export const ColumnSettings: React.FC = () => {
|
||||
const settings = useAppSelector((state) => state.settings.get('home'));
|
||||
const settings = useAppSelector((state) => state.settings.get("home"));
|
||||
|
||||
const dispatch = useAppDispatch();
|
||||
const onChange = useCallback(
|
||||
(key: string, checked: boolean) => {
|
||||
dispatch(changeSetting(['home', ...key], checked));
|
||||
dispatch(changeSetting(["home", key.split("")], checked));
|
||||
},
|
||||
[dispatch],
|
||||
);
|
||||
@@ -36,7 +36,7 @@ export const ColumnSettings: React.FC = () => {
|
||||
<SettingToggle
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
settingPath={['shows', 'reblog']}
|
||||
settingPath={["shows", "reblog"]}
|
||||
onChange={onChange}
|
||||
label={
|
||||
<FormattedMessage
|
||||
@@ -51,7 +51,7 @@ export const ColumnSettings: React.FC = () => {
|
||||
<SettingToggle
|
||||
prefix='home_timeline'
|
||||
settings={settings}
|
||||
settingPath={['shows', 'reply']}
|
||||
settingPath={["shows", "reply"]}
|
||||
onChange={onChange}
|
||||
label={
|
||||
<FormattedMessage
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
export const CriticalUpdateBanner = () => (
|
||||
<div className='warning-banner'>
|
||||
@@ -13,7 +13,7 @@ export const CriticalUpdateBanner = () => (
|
||||
<FormattedMessage
|
||||
id='home.pending_critical_update.body'
|
||||
defaultMessage='Please update your Mastodon server as soon as possible!'
|
||||
/>{' '}
|
||||
/>{" "}
|
||||
<a href='/admin/software_updates'>
|
||||
<FormattedMessage
|
||||
id='home.pending_critical_update.link'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { FormattedMessage } from "react-intl";
|
||||
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import background from 'mastodon/../images/friends-cropped.png';
|
||||
import { DismissableBanner } from 'mastodon/components/dismissable_banner';
|
||||
import background from "mastodon/../images/friends-cropped.png";
|
||||
import { DismissableBanner } from "mastodon/components/dismissable_banner";
|
||||
|
||||
export const ExplorePrompt = () => (
|
||||
<DismissableBanner id='home.explore_prompt'>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { PureComponent } from 'react';
|
||||
import PropTypes from "prop-types";
|
||||
import { PureComponent } from "react";
|
||||
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
import { defineMessages, injectIntl, FormattedMessage } from "react-intl";
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { Helmet } from 'react-helmet';
|
||||
import classNames from "classnames";
|
||||
import { Helmet } from "react-helmet";
|
||||
|
||||
import { List as ImmutableList } from 'immutable';
|
||||
import { connect } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import { List as ImmutableList } from "immutable";
|
||||
import { connect } from "react-redux";
|
||||
import { createSelector } from "reselect";
|
||||
|
||||
import { fetchAnnouncements, toggleShowAnnouncements } from 'mastodon/actions/announcements';
|
||||
import { IconWithBadge } from 'mastodon/components/icon_with_badge';
|
||||
import { NotSignedInIndicator } from 'mastodon/components/not_signed_in_indicator';
|
||||
import AnnouncementsContainer from 'mastodon/features/getting_started/containers/announcements_container';
|
||||
import { me, criticalUpdatesPending } from 'mastodon/initial_state';
|
||||
import { fetchAnnouncements, toggleShowAnnouncements } from "mastodon/actions/announcements";
|
||||
import { IconWithBadge } from "mastodon/components/icon_with_badge";
|
||||
import { NotSignedInIndicator } from "mastodon/components/not_signed_in_indicator";
|
||||
import AnnouncementsContainer from "mastodon/features/getting_started/containers/announcements_container";
|
||||
import { me, criticalUpdatesPending } from "mastodon/initial_state";
|
||||
|
||||
import { addColumn, removeColumn, moveColumn } from '../../actions/columns';
|
||||
import { expandHomeTimeline } from '../../actions/timelines';
|
||||
import Column from '../../components/column';
|
||||
import ColumnHeader from '../../components/column_header';
|
||||
import StatusListContainer from '../ui/containers/status_list_container';
|
||||
import { addColumn, removeColumn, moveColumn } from "../../actions/columns";
|
||||
import { expandHomeTimeline } from "../../actions/timelines";
|
||||
import Column from "../../components/column";
|
||||
import ColumnHeader from "../../components/column_header";
|
||||
import StatusListContainer from "../ui/containers/status_list_container";
|
||||
|
||||
import { ColumnSettings } from './components/column_settings';
|
||||
import { CriticalUpdateBanner } from './components/critical_update_banner';
|
||||
import { ExplorePrompt } from './components/explore_prompt';
|
||||
import { ColumnSettings } from "./components/column_settings";
|
||||
import { CriticalUpdateBanner } from "./components/critical_update_banner";
|
||||
import { ExplorePrompt } from "./components/explore_prompt";
|
||||
|
||||
const messages = defineMessages({
|
||||
title: { id: 'column.home', defaultMessage: 'Home' },
|
||||
show_announcements: { id: 'home.show_announcements', defaultMessage: 'Show announcements' },
|
||||
hide_announcements: { id: 'home.hide_announcements', defaultMessage: 'Hide announcements' },
|
||||
title: { id: "column.home", defaultMessage: "Home" },
|
||||
show_announcements: { id: "home.show_announcements", defaultMessage: "Show announcements" },
|
||||
hide_announcements: { id: "home.hide_announcements", defaultMessage: "Hide announcements" },
|
||||
});
|
||||
|
||||
const getHomeFeedSpeed = createSelector([
|
||||
state => state.getIn(['timelines', 'home', 'items'], ImmutableList()),
|
||||
state => state.getIn(['timelines', 'home', 'pendingItems'], ImmutableList()),
|
||||
state => state.get('statuses'),
|
||||
state => state.getIn(["timelines", "home", "items"], ImmutableList()),
|
||||
state => state.getIn(["timelines", "home", "pendingItems"], ImmutableList()),
|
||||
state => state.get("statuses"),
|
||||
], (statusIds, pendingStatusIds, statusMap) => {
|
||||
const recentStatusIds = pendingStatusIds.size > 0 ? pendingStatusIds : statusIds;
|
||||
const statuses = recentStatusIds.filter(id => id !== null).map(id => statusMap.get(id)).filter(status => status?.get('account') !== me).take(20);
|
||||
const statuses = recentStatusIds.filter(id => id !== null).map(id => statusMap.get(id)).filter(status => status?.get("account") !== me).take(20);
|
||||
|
||||
if (statuses.isEmpty()) {
|
||||
return {
|
||||
@@ -47,7 +47,7 @@ const getHomeFeedSpeed = createSelector([
|
||||
};
|
||||
}
|
||||
|
||||
const datetimes = statuses.map(status => status.get('created_at', 0));
|
||||
const datetimes = statuses.map(status => status.get("created_at", 0));
|
||||
const oldest = new Date(datetimes.min());
|
||||
const newest = new Date(datetimes.max());
|
||||
const averageGap = (newest - oldest) / (1000 * (statuses.size + 1)); // Average gap between posts on first page in seconds
|
||||
@@ -59,23 +59,23 @@ const getHomeFeedSpeed = createSelector([
|
||||
});
|
||||
|
||||
const homeTooSlow = createSelector([
|
||||
state => state.getIn(['timelines', 'home', 'isLoading']),
|
||||
state => state.getIn(['timelines', 'home', 'isPartial']),
|
||||
state => state.getIn(["timelines", "home", "isLoading"]),
|
||||
state => state.getIn(["timelines", "home", "isPartial"]),
|
||||
getHomeFeedSpeed,
|
||||
], (isLoading, isPartial, speed) =>
|
||||
!isLoading && !isPartial // Only if the home feed has finished loading
|
||||
&& (
|
||||
(speed.gap > (30 * 60) // If the average gap between posts is more than 30 minutes
|
||||
|| (Date.now() - speed.newest) > (1000 * 3600)) // If the most recent post is from over an hour ago
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
hasUnread: state.getIn(['timelines', 'home', 'unread']) > 0,
|
||||
isPartial: state.getIn(['timelines', 'home', 'isPartial']),
|
||||
hasAnnouncements: !state.getIn(['announcements', 'items']).isEmpty(),
|
||||
unreadAnnouncements: state.getIn(['announcements', 'items']).count(item => !item.get('read')),
|
||||
showAnnouncements: state.getIn(['announcements', 'show']),
|
||||
hasUnread: state.getIn(["timelines", "home", "unread"]) > 0,
|
||||
isPartial: state.getIn(["timelines", "home", "isPartial"]),
|
||||
hasAnnouncements: !state.getIn(["announcements", "items"]).isEmpty(),
|
||||
unreadAnnouncements: state.getIn(["announcements", "items"]).count(item => !item.get("read")),
|
||||
showAnnouncements: state.getIn(["announcements", "show"]),
|
||||
tooSlow: homeTooSlow(state),
|
||||
});
|
||||
|
||||
@@ -104,7 +104,7 @@ class HomeTimeline extends PureComponent {
|
||||
if (columnId) {
|
||||
dispatch(removeColumn(columnId));
|
||||
} else {
|
||||
dispatch(addColumn('HOME', {}));
|
||||
dispatch(addColumn("HOME", {}));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,7 +176,7 @@ class HomeTimeline extends PureComponent {
|
||||
announcementsButton = (
|
||||
<button
|
||||
type='button'
|
||||
className={classNames('column-header__button', { 'active': showAnnouncements })}
|
||||
className={classNames("column-header__button", { "active": showAnnouncements })}
|
||||
title={intl.formatMessage(showAnnouncements ? messages.hide_announcements : messages.show_announcements)}
|
||||
aria-label={intl.formatMessage(showAnnouncements ? messages.hide_announcements : messages.show_announcements)}
|
||||
onClick={this.handleToggleAnnouncementsClick}
|
||||
|
||||
Reference in New Issue
Block a user