From 51d86af72ded5d0109e9465e149af8794dbb05cd Mon Sep 17 00:00:00 2001 From: Upayan Mazumder Date: Mon, 6 Jan 2025 20:23:40 +0530 Subject: [PATCH] Add activity whitelist to filter displayed activities --- app/src/components/activity/activity.js | 45 +++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/app/src/components/activity/activity.js b/app/src/components/activity/activity.js index 7b1fd81..1a3b27f 100644 --- a/app/src/components/activity/activity.js +++ b/app/src/components/activity/activity.js @@ -37,6 +37,7 @@ const formatElapsedTime = (startTimestamp) => { const Activity = () => { const [guildStatistics, setGuildStatistics] = useState(null); + const activityWhitelist = ['Spotify', 'Visual Studio Code']; useEffect(() => { const fetchData = async () => { @@ -58,35 +59,35 @@ const Activity = () => { } return ( -
+
{guildStatistics.map((guild, guildIndex) => (
-
+
{getStatusIcon(guild.discordstatus)} {guild.discordstatus}
    - {guild.activities.map((activity, activityIndex) => ( -
    - {activity.largeImageURL && ( - {activity.largeText} - )} -

    {activity.name}

    -

    {activity.details}

    -

    {activity.state}

    -

    - {formatElapsedTime(activity.startTimestamp)} -

    -
    - ))} + {guild.activities + .filter(activity => activityWhitelist.includes(activity.name)) + .map((activity, activityIndex) => ( +
    + {activity.largeImageURL && ( + {activity.largeText} + )} +

    {activity.name}

    +

    {activity.details}

    +

    {activity.state}

    +

    + {formatElapsedTime(activity.startTimestamp)} +

    +
    + ))}
- )) - } -
+ ))} +
); };