8 – How to show the user's status?

I created a TWIG template for the "Teaser" view of the user account.

I want to show a logo and change its color according to the user's status:

  • When the user has logged in Online

  • When the user has logged in and the last access is less than 30 minutes Absent

  • When the user is offline Disconnected

How to visualize the state of the user?

I think it should be possible to create conditions in TWIG.