File tree 10 files changed +118
-23
lines changed
electron/plugins/electronStore
layout/modals/TheSettingsModal/AppSettings/HistoryOptions
10 files changed +118
-23
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,10 @@ export default {
208
208
type : 'boolean' ,
209
209
default : true
210
210
} ,
211
+ 'history.isSaveActivity' : {
212
+ type : 'boolean' ,
213
+ default : true
214
+ } ,
211
215
'homePage.isWithRecentTracksSegment' : {
212
216
type : 'boolean' ,
213
217
default : true
Original file line number Diff line number Diff line change 28
28
</template >
29
29
30
30
<script >
31
- import {
32
- toggle as toggleCheckbox
33
- } from ' @/helpers/actions/plugins/semantic/checkbox'
34
31
import checkboxMixin from ' @/mixins/checkboxMixin'
35
32
36
33
export default {
@@ -43,30 +40,16 @@ export default {
43
40
text: String
44
41
},
45
42
emits: [
46
- ' click' ,
47
43
' isCheckedChange'
48
44
],
49
45
methods: {
50
- handleClick (
51
- event
52
- ) {
53
- this .$emit (
54
- ' click' ,
55
- event
56
- )
57
- },
58
46
change (
59
47
value
60
48
) {
61
49
this .$emit (
62
50
' isCheckedChange' ,
63
51
value
64
52
)
65
- },
66
- toggle () {
67
- toggleCheckbox (
68
- this .$refs .checkbox
69
- )
70
53
}
71
54
}
72
55
}
Original file line number Diff line number Diff line change 5
5
/>
6
6
7
7
<div >
8
+ <SaveOption />
9
+
8
10
<BaseSettingsHistoryDeleteOption
9
11
:scope =" scope"
10
12
/>
16
18
import BaseDivider from ' @/components/BaseDivider.vue'
17
19
import BaseSettingsHistoryDeleteOption
18
20
from ' @/components/settings/BaseSettingsHistoryDeleteOption.vue'
21
+ import SaveOption from ' ./ActivitySection/SaveOption.vue'
19
22
20
23
export default {
21
24
name: ' ActivitySection' ,
22
25
components: {
23
26
BaseDivider,
24
- BaseSettingsHistoryDeleteOption
27
+ BaseSettingsHistoryDeleteOption,
28
+ SaveOption
25
29
},
26
30
data () {
27
31
return {
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" main-settings-option-container" >
3
+ <div class =" main-settings-option" >
4
+ <BaseSettingsOptionHeader
5
+ :text =" optionText"
6
+ />
7
+
8
+ <BaseToggle
9
+ ref =" toggle"
10
+ store-key =" history.isSaveActivity"
11
+ :is-checked =" isSaveActivityHistory"
12
+ @click =" handleToggleClick"
13
+ />
14
+ </div >
15
+ </div >
16
+ </template >
17
+
18
+ <script >
19
+ import {
20
+ mapState
21
+ } from ' pinia'
22
+ import historyStore from ' @/stores/history'
23
+ import BaseSettingsOptionHeader
24
+ from ' @/components/headers/settings/BaseSettingsOptionHeader.vue'
25
+ import BaseToggle from ' @/components/toggles/BaseToggle.vue'
26
+ import updateProfile from ' @/helpers/actions/api/profile/update'
27
+
28
+ export default {
29
+ name: ' SaveOption' ,
30
+ components: {
31
+ BaseSettingsOptionHeader,
32
+ BaseToggle
33
+ },
34
+ computed: {
35
+ ... mapState (
36
+ historyStore,
37
+ {
38
+ isSaveActivityHistory: ' isSaveActivity'
39
+ }
40
+ ),
41
+ optionText () {
42
+ return this .$t (
43
+ ' settings.options.app.history.activity.save'
44
+ )
45
+ },
46
+ profileArgs () {
47
+ return {
48
+ isSaveActivityHistory:
49
+ ! this .isSaveActivityHistory
50
+ }
51
+ }
52
+ },
53
+ methods: {
54
+ handleToggleClick () {
55
+ updateProfile (
56
+ this .profileArgs
57
+ ).catch (
58
+ this .handleProfileUpdateError
59
+ )
60
+ },
61
+ handleProfileUpdateError () {
62
+ this .toggleToggle ()
63
+ },
64
+ toggleToggle () {
65
+ this .$refs
66
+ .toggle
67
+ .toggle ()
68
+ }
69
+ }
70
+ }
71
+ </script >
72
+
73
+ <style lang="sass" scoped></style >
Original file line number Diff line number Diff line change 5
5
:class =" {
6
6
inverted: isDarkMode
7
7
}"
8
+ @click =" handleClick"
8
9
>
9
10
<input type =" checkbox" >
10
11
</div >
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ export default function (
16
16
country,
17
17
city,
18
18
status,
19
- isPrivate
19
+ isPrivate,
20
+ isSaveActivityHistory
20
21
}
21
22
) {
22
23
const profileId = profileStore ( ) . id
@@ -41,6 +42,9 @@ export default function (
41
42
status,
42
43
private : (
43
44
isPrivate ? 1 : 0
45
+ ) ,
46
+ save_activity_history : (
47
+ isSaveActivityHistory ? 1 : 0
44
48
)
45
49
}
46
50
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ export function handleError (
12
12
error
13
13
}
14
14
) {
15
+ const form = this ?. $refs ?. form ?. $el
16
+
17
+ if ( ! form ) { return }
18
+
15
19
const isForbidden = (
16
20
error
17
21
. response
@@ -24,8 +28,6 @@ export function handleError (
24
28
?. status === 404
25
29
)
26
30
27
- const form = this . $refs . form . $el
28
-
29
31
if ( isForbidden ) {
30
32
addErrors (
31
33
{
Original file line number Diff line number Diff line change 1
1
import {
2
- set as setCheckbox
2
+ set as setCheckbox ,
3
+ toggle as toggleCheckbox
3
4
} from '@/helpers/actions/plugins/semantic/checkbox'
4
5
import {
5
6
main as mainCheckboxOptions
@@ -9,6 +10,9 @@ export default {
9
10
props : {
10
11
isChecked : Boolean
11
12
} ,
13
+ emits : [
14
+ 'click'
15
+ ] ,
12
16
computed : {
13
17
checkboxOptions ( ) {
14
18
return mainCheckboxOptions (
@@ -28,6 +32,14 @@ export default {
28
32
)
29
33
} ,
30
34
methods : {
35
+ handleClick (
36
+ event
37
+ ) {
38
+ this . $emit (
39
+ 'click' ,
40
+ event
41
+ )
42
+ } ,
31
43
handleChecked ( ) {
32
44
this . change (
33
45
true
@@ -37,6 +49,11 @@ export default {
37
49
this . change (
38
50
false
39
51
)
52
+ } ,
53
+ toggle ( ) {
54
+ toggleCheckbox (
55
+ this . $refs . checkbox
56
+ )
40
57
}
41
58
}
42
59
}
Original file line number Diff line number Diff line change 580
580
"delete" : " Delete search history"
581
581
},
582
582
"activity" : {
583
+ "save" : " Save activity history" ,
583
584
"delete" : " Delete activity history"
584
585
},
585
586
"player" : {
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ const data = {
9
9
savedTracksSearch : null ,
10
10
search : null ,
11
11
isSaveBrowser : null ,
12
- isSavePlayer : null
12
+ isSavePlayer : null ,
13
+ isSaveActivity : null
13
14
}
14
15
} ,
15
16
actions : {
@@ -37,6 +38,11 @@ const data = {
37
38
value
38
39
) {
39
40
this . isSavePlayer = value
41
+ } ,
42
+ setIsSaveActivity (
43
+ value
44
+ ) {
45
+ this . isSaveActivity = value
40
46
}
41
47
}
42
48
}
You can’t perform that action at this time.
0 commit comments