mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-20 05:39:39 +02:00
User Onboarding + Bug Fixes (#1352)
* Bump min supported date to 20 years * Add basic onboarding * User onboarding * Complete onboarding flow * Cleanup, add user profile update test
This commit is contained in:
parent
73e184ad3d
commit
1d20de770f
55 changed files with 1088 additions and 300 deletions
29
app/javascript/controllers/onboarding_controller.js
Normal file
29
app/javascript/controllers/onboarding_controller.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { Controller } from "@hotwired/stimulus";
|
||||
|
||||
// Connects to data-controller="onboarding"
|
||||
export default class extends Controller {
|
||||
setLocale(event) {
|
||||
this.refreshWithParam("locale", event.target.value);
|
||||
}
|
||||
|
||||
setDateFormat(event) {
|
||||
this.refreshWithParam("date_format", event.target.value);
|
||||
}
|
||||
|
||||
setCurrency(event) {
|
||||
this.refreshWithParam("currency", event.target.value);
|
||||
}
|
||||
|
||||
refreshWithParam(key, value) {
|
||||
const url = new URL(window.location);
|
||||
url.searchParams.set(key, value);
|
||||
|
||||
// Preserve existing params by getting the current search string
|
||||
// and appending our new param to it
|
||||
const currentParams = new URLSearchParams(window.location.search);
|
||||
currentParams.set(key, value);
|
||||
|
||||
// Refresh the page with all params
|
||||
window.location.search = currentParams.toString();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue