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.
19 lines
512 B
JavaScript
19 lines
512 B
JavaScript
import { modifier } from 'ember-modifier';
|
|
|
|
// Focuses an element when it enters the DOM. Pass `select=true` to also select
|
|
// its current text, and `when=false` to skip focusing (e.g. focus should return
|
|
// to a re-rendered element only after some interactions).
|
|
export default modifier(
|
|
(element, _positional, { select = false, when = true } = {}) => {
|
|
if (!when) {
|
|
return;
|
|
}
|
|
|
|
element.focus();
|
|
|
|
if (select && typeof element.select === 'function') {
|
|
element.select();
|
|
}
|
|
}
|
|
);
|