In this episode, we focus on displaying team details in the UI. We start by leveraging the relationships we've set up to list all the teams the user belongs to, as well as identifying which team they're currently viewing. We take the existing user settings dropdown in the navigation and essentially duplicate it, setting up a new dropdown just for teams.
We hook up this new dropdown so it displays the name of the current team, making use of the authentication details. Inside the dropdown, we add a link to the team settings (for the currently selected team) and then build a list of all the teams the user is a part of. For each team, we render a dropdown item with the team's name using a simple foreach
loop and the prebuilt dropdown link component.
To visually distinguish the current team, we make a minor styling adjustment. As an extra step, we manually add another team for the user directly in the database to demonstrate how the UI behaves with multiple teams.
By the end of this episode, you'll have a navigation dropdown showing your current team, a settings shortcut, and a list of all your teams. The next step (teased at the end) will be enabling the actual switching between teams when clicking on them.