Add translation values to activity log output
This commit is contained in:
parent
06427f8d13
commit
4d30cc9e7e
4 changed files with 25 additions and 5 deletions
|
@ -13,9 +13,11 @@ import { useLocation } from 'react-router';
|
|||
import Spinner from '@/components/elements/Spinner';
|
||||
import { styles as btnStyles } from '@/components/elements/button/index';
|
||||
import classNames from 'classnames';
|
||||
import Translate from '@/components/elements/Translate';
|
||||
|
||||
export default () => {
|
||||
const location = useLocation();
|
||||
|
||||
const { clearAndAddHttpError } = useFlashKey('account');
|
||||
const [ filters, setFilters ] = useState<ActivityLogFilters>({ page: 1, sorts: { timestamp: -1 } });
|
||||
const { data, isValidating, error } = useActivityLogs(filters, {
|
||||
|
@ -90,6 +92,11 @@ export default () => {
|
|||
</Tooltip>
|
||||
}
|
||||
</div>
|
||||
<p className={'mt-1 text-sm'}>
|
||||
<Translate ns={'activity'} values={activity.properties}>
|
||||
{activity.event.replace(':', '.')}
|
||||
</Translate>
|
||||
</p>
|
||||
<div className={'mt-1 flex items-center text-sm'}>
|
||||
<Link
|
||||
to={`?${queryTo({ ip: activity.ip })}`}
|
||||
|
|
14
resources/scripts/components/elements/Translate.tsx
Normal file
14
resources/scripts/components/elements/Translate.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import React from 'react';
|
||||
import { Trans, TransProps, useTranslation } from 'react-i18next';
|
||||
|
||||
type Props = Omit<TransProps, 't'>;
|
||||
|
||||
export default ({ ns, children, ...props }: Props) => {
|
||||
const { t } = useTranslation(ns);
|
||||
|
||||
return (
|
||||
<Trans t={t} {...props}>
|
||||
{children}
|
||||
</Trans>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue