-
Notifications
You must be signed in to change notification settings - Fork 2
/
SettingsModal.vue
102 lines (101 loc) · 2.86 KB
/
SettingsModal.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<template>
<div class="modal-content">
<div class="settings-layout">
<div class="setting-left">
<div class="settings-picture" :style="{'background-image': 'url(' + pictureUrl + ')'}"></div>
</div>
<div class="setting-right">
<div class="modal-data">
<div class="modal-form">
<label for="userName">Your name</label>
<br />
<input
type="text"
name="userName"
spellcheck="true"
class="modal-form-title"
v-model="userName">
</div>
<div class="modal-form">
<label for="email">Your email</label>
<br />
<input
type="text"
name="email"
spellcheck="true"
class="modal-form-title"
v-model="email">
</div>
<div class="modal-form">
<label for="theme">Preferred theme *</label>
<br />
<select name="theme" v-model="theme">
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<div class="modal-form">
<label for="language">Language *</label>
<br />
<select name="language" v-model="language">
<option value="en">English</option>
<option value="fr">French</option>
</select>
</div>
<div class="modal-form">
<label for="profilePicture">Your picture</label>
<br />
<input
type="text"
name="profilePicture"
spellcheck="false"
class="modal-form-title"
v-model="pictureUrl">
</div>
<div class="modal-form">
<label for="tracking">Tracking *</label>
<br />
<label class="modal-settings-checkboxLabel"><input
type="checkbox"
name="tracking"
v-model="tracking">I agree be tracked to help improve this app</label>
</div>
<p class="settings-roadmapName">* This is still an early version, some of these features are not implemented yet</p>
</div>
</div>
</div>
<div class="modal-actions">
<button type="button" class="bttn-secondary" @click="$emit('toggleModal')">Cancel changes</button>
<button type="button" class="bttn-primary" @click="updateSettings">Save</button>
</div>
</div>
</template>
<script>
export default {
props: ['userSettings'],
data: function(){
// @TODO: add format validation
return {
userName: this.userSettings.userName,
email: this.userSettings.email,
theme: this.userSettings.preferences.theme,
language: this.userSettings.preferences.language,
pictureUrl: this.userSettings.profilePicture,
tracking: this.userSettings.preferences.tracking
}
},
methods: {
updateSettings() {
this.$emit('updateSettings', {
userName: this.userName,
email: this.email.toLowerCase(),
theme: this.theme,
language: this.language,
pictureUrl: this.pictureUrl.toLowerCase(),
tracking: this.tracking
});
this.$emit('toggleModal');
}
}
}
</script>