AccountContainer: use withDate
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
39b819241f
commit
580633c915
2 changed files with 7 additions and 3 deletions
|
@ -35,6 +35,7 @@ interface IAccount {
|
||||||
showProfileHoverCard?: boolean,
|
showProfileHoverCard?: boolean,
|
||||||
timestamp?: string | Date,
|
timestamp?: string | Date,
|
||||||
timestampUrl?: string,
|
timestampUrl?: string,
|
||||||
|
withDate?: boolean,
|
||||||
withRelationship?: boolean,
|
withRelationship?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ const Account = ({
|
||||||
showProfileHoverCard = true,
|
showProfileHoverCard = true,
|
||||||
timestamp,
|
timestamp,
|
||||||
timestampUrl,
|
timestampUrl,
|
||||||
|
withDate = false,
|
||||||
withRelationship = true,
|
withRelationship = true,
|
||||||
}: IAccount) => {
|
}: IAccount) => {
|
||||||
const overflowRef = React.useRef<HTMLDivElement>(null);
|
const overflowRef = React.useRef<HTMLDivElement>(null);
|
||||||
|
@ -122,6 +124,8 @@ const Account = ({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (withDate) timestamp = account.created_at;
|
||||||
|
|
||||||
const LinkEl: any = showProfileHoverCard ? Link : 'div';
|
const LinkEl: any = showProfileHoverCard ? Link : 'div';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -24,10 +24,10 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const intl = useIntl();
|
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 hasDates = useAppSelector((state) => accountIds.every(id => !!state.accounts.getIn([id, 'created_at'])));
|
||||||
|
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(accountIds.size);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchUsers(['local', 'active'], 1, null, limit))
|
dispatch(fetchUsers(['local', 'active'], 1, null, limit))
|
||||||
|
@ -49,7 +49,7 @@ const LatestAccountsPanel: React.FC<ILatestAccountsPanel> = ({ limit = 5 }) => {
|
||||||
return (
|
return (
|
||||||
<Widget title={intl.formatMessage(messages.title)}>
|
<Widget title={intl.formatMessage(messages.title)}>
|
||||||
{accountIds.take(limit).map((account) => (
|
{accountIds.take(limit).map((account) => (
|
||||||
<AccountContainer key={account} id={account} withRelationship={false} />
|
<AccountContainer key={account} id={account} withRelationship={false} withDate />
|
||||||
))}
|
))}
|
||||||
{!!expandCount && (
|
{!!expandCount && (
|
||||||
<Link className='wtf-panel__expand-btn' to='/admin/users'>
|
<Link className='wtf-panel__expand-btn' to='/admin/users'>
|
||||||
|
|
Loading…
Reference in a new issue