AccountContainer: use withDate

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
merge-requests/1216/head
marcin mikołajczak 2022-04-14 15:26:27 +02:00
rodzic 39b819241f
commit 580633c915
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -35,6 +35,7 @@ interface IAccount {
showProfileHoverCard?: boolean,
timestamp?: string | Date,
timestampUrl?: string,
withDate?: boolean,
withRelationship?: boolean,
}
@ -51,6 +52,7 @@ const Account = ({
showProfileHoverCard = true,
timestamp,
timestampUrl,
withDate = false,
withRelationship = true,
}: IAccount) => {
const overflowRef = React.useRef<HTMLDivElement>(null);
@ -122,6 +124,8 @@ const Account = ({
);
}
if (withDate) timestamp = account.created_at;
const LinkEl: any = showProfileHoverCard ? Link : 'div';
return (

Wyświetl plik

@ -24,10 +24,10 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
const dispatch = useAppDispatch();
const intl = useIntl();
const accountIds = useAppSelector<ImmutableOrderedSet<string>>((state) => state.admin.get('latestUsers'));
const accountIds = useAppSelector<ImmutableOrderedSet<string>>((state) => state.admin.get('latestUsers').take(limit));
const hasDates = useAppSelector((state) => accountIds.every(id => !!state.accounts.getIn([id, 'created_at'])));
const [total, setTotal] = useState(0);
const [total, setTotal] = useState(accountIds.size);
useEffect(() => {
dispatch(fetchUsers(['local', 'active'], 1, null, limit))
@ -49,7 +49,7 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
return (
<Widget title={intl.formatMessage(messages.title)}>
{accountIds.take(limit).map((account) => (
<AccountContainer key={account} id={account} withRelationship={false} />
<AccountContainer key={account} id={account} withRelationship={false} withDate />
))}
{!!expandCount && (
<Link className='wtf-panel__expand-btn' to='/admin/users'>