Abuse the translation engine to handle more of the formatting for us

This commit is contained in:
DaneEveritt 2022-06-18 15:28:42 -04:00
parent b052d29a5f
commit 95de4c30fc
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
4 changed files with 94 additions and 51 deletions

View file

@ -27,6 +27,13 @@ export default ({ activity, children }: Props) => {
return current.toString();
};
const properties = Object.keys(activity.properties).reduce((obj, key) => ({
...obj,
[key]: key === 'count' || key.endsWith('_count')
? activity.properties[key]
: `<strong>${activity.properties[key]}</strong>`,
}), {});
return (
<div className={'grid grid-cols-10 py-4 border-b-2 border-gray-800 last:rounded-b last:border-0 group'}>
<div className={'hidden sm:flex sm:col-span-1 items-center justify-center select-none'}>
@ -60,10 +67,8 @@ export default ({ activity, children }: Props) => {
{children}
</div>
</div>
<p className={'mt-1 text-sm break-words line-clamp-2 pr-4'}>
<Translate ns={'activity'} values={activity.properties}>
{activity.event.replace(':', '.')}
</Translate>
<p className={style.description}>
<Translate ns={'activity'} values={properties} i18nKey={activity.event.replace(':', '.')}/>
</p>
<div className={'mt-1 flex items-center text-sm'}>
<Link

View file

@ -9,3 +9,11 @@
@apply w-4 h-4;
}
}
.description {
@apply mt-1 text-sm break-words line-clamp-2 pr-4;
& strong {
@apply text-gray-50 font-semibold;
}
}