pl-fe: Remove some immutable usage
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@ -15,8 +15,8 @@ const AdminTabs: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const match = useRouteMatch();
|
||||
|
||||
const approvalCount = useAppSelector(state => state.admin.awaitingApproval.count());
|
||||
const reportsCount = useAppSelector(state => state.admin.openReports.count());
|
||||
const approvalCount = useAppSelector(state => state.admin.awaitingApproval.length);
|
||||
const reportsCount = useAppSelector(state => state.admin.openReports.length);
|
||||
|
||||
const tabs = [{
|
||||
name: '/pl-fe/admin',
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import { OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@ -22,9 +21,9 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
||||
const intl = useIntl();
|
||||
const history = useHistory();
|
||||
const dispatch = useAppDispatch();
|
||||
const accountIds = useAppSelector<ImmutableOrderedSet<string>>((state) => state.admin.get('latestUsers').take(limit));
|
||||
const accountIds = useAppSelector<Array<string>>((state) => state.admin.latestUsers.slice(0, limit));
|
||||
|
||||
const [total, setTotal] = useState<number | undefined>(accountIds.size);
|
||||
const [total, setTotal] = useState<number | undefined>(accountIds.length);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(fetchUsers({
|
||||
@ -46,7 +45,7 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
||||
onActionClick={handleAction}
|
||||
actionTitle={intl.formatMessage(messages.expand, { count: total })}
|
||||
>
|
||||
{accountIds.take(limit).map((account) => (
|
||||
{accountIds.slice(0, limit).map((account) => (
|
||||
<AccountContainer key={account} id={account} withRelationship={false} withDate />
|
||||
))}
|
||||
</Widget>
|
||||
|
||||
@ -18,7 +18,7 @@ const UnapprovedAccount: React.FC<IUnapprovedAccount> = ({ accountId }) => {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
const { account } = useAccount(accountId);
|
||||
const adminAccount = useAppSelector(state => state.admin.users.get(accountId));
|
||||
const adminAccount = useAppSelector(state => state.admin.users[accountId]);
|
||||
|
||||
if (!account) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user