Point the directory's Email button at the selected teammate
Angular · Angular · intermediate · modification
Small change to the team directory: the toolbar Email button used to open a message to the shared team alias; now it targets the teammate the user has selected in the roster. The detail panel already reads from the same `selected` signal, so this just reuses it. Clicked through a few teammates and the composer opened to the right address every time.
The directory is the app's main left sidebar and is open by default. Users routinely click around the toolbar before picking anyone, so the panel spends real time in its no-selection state — the `selected` signal is null until a roster row is clicked.
Requirements
- The directory toolbar has an Email button that starts a new message to the currently selected teammate.
- A teammate is selected by clicking their row. Nothing is selected when the panel first loads, and the detail area shows an empty state until a row is clicked.
- The Email button is always visible in the toolbar. When no teammate is selected it must be a safe no-op — do not start a message.
Files touched
- src/app/directory/team-directory.ts
--- src/app/directory/team-directory.ts
selected = signal<Teammate | null>(null);
- // Toolbar action: start a new email to the whole team.
+ // Toolbar action: start a new email to the selected teammate.
composeEmail(): void {
- this.composer.openTo('[email protected]');
+ const address = this.selected()!.email;
+ this.composer.openTo(address || '');
}
}