My app has a specific page called “Activity” where the content of the page varies depending on which Activity the user is currently accessing.
I have set it up to use individual reusable elements for each Activity’s content, since they are all completely unique and quite complex with their own workflows. This seemed to be the recommended approach after reading this helpful post: A guide to advanced use of reusables
So my intended functionality is that the user clicks to view a particular Activity, which navigates them to the Activity page and sends the current Activity like so:
When the Activity page loads, I need to hide all the reusable elements except for the one which is associated with the current Activity that the user selected.
The only way I can think of to do this right now is to manually code in the unique ID of the activity as the data source for the repeatable element like the below screenshot…
…and then show a group containing the reusable element only when the page URL matches the reusable element’s data source:
I also considered setting a custom state on page load and manually assigning each Activity to a number, and then whenever the custom state matches that Activity’s number, show the group.
But it’s effectively the same, manual process. I feel like I’m missing something obvious here but I can’t think of a better way. Is there a better way to approach this that is more dynamic, e.g. by somehow associating a reusable element with a particular “thing” in the database?