Ask for the user's name on first launch through a /welcome route, store it in the preferences namespace via a user service, and redirect between welcome and the dashboard based on whether a name exists. Replace the hardcoded greeting name and make it editable in place, with save/cancel handling and a first-run prompt matching the dashboard style.
22 lines
443 B
JavaScript
22 lines
443 B
JavaScript
import { tracked } from '@glimmer/tracking';
|
|
|
|
// Test double for the `user` service. `name` is tracked so templates that read
|
|
// it re-render exactly as they do against the real service.
|
|
export default class FakeUser {
|
|
@tracked name;
|
|
calls = [];
|
|
|
|
constructor(name = null) {
|
|
this.name = name;
|
|
}
|
|
|
|
get hasName() {
|
|
return Boolean(this.name);
|
|
}
|
|
|
|
async setName(value) {
|
|
this.calls.push(value);
|
|
this.name = value;
|
|
}
|
|
}
|