Skip to content
This repository has been archived by the owner on Oct 9, 2022. It is now read-only.

Commit

Permalink
feat(smart-playlist): add empty rule by default
Browse files Browse the repository at this point in the history
  • Loading branch information
phanan committed Oct 11, 2021
1 parent 55ed32b commit b4a157a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/components/playlist/smart-playlist/create-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default Vue.extend({
data: () => ({
name: '',
ruleGroups: [] as SmartPlaylistRuleGroup[],
ruleGroups: [playlistStore.createEmptySmartPlaylistRuleGroup()] as SmartPlaylistRuleGroup[],
meta: {
loading: false
}
Expand Down
5 changes: 3 additions & 2 deletions js/components/playlist/smart-playlist/form-base.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ form {
.rules {
background: rgba(0, 0, 0, .1);
padding: 12px;
border-radius: 5px;
border: 1px solid rgba(255, 255, 255, .1);
padding: .75rem;
border-radius: .3rem;
input[type=text], input[type=number], input[type=datetime] {
display: inline-block;
Expand Down
2 changes: 1 addition & 1 deletion js/components/playlist/smart-playlist/rule-group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default Vue.extend({
.rule-group {
margin-bottom: 1rem;
padding-bottom: .5rem;
border-bottom: 1px solid rgba(0, 0, 0, .15);
border-bottom: 1px solid rgba(255, 255, 255, .1);
> * + * {
margin-bottom: .5rem;
Expand Down
10 changes: 6 additions & 4 deletions js/stores/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ export const playlistStore = {
value: ['']
}),

createEmptySmartPlaylistRuleGroup: (): SmartPlaylistRuleGroup => ({
id: (new Date()).getTime(),
rules: []
}),
createEmptySmartPlaylistRuleGroup (): SmartPlaylistRuleGroup {
return {
id: (new Date()).getTime(),
rules: [this.createEmptySmartPlaylistRule()]
}
},

/**
* Serialize the rule (groups) to be ready for database.
Expand Down

0 comments on commit b4a157a

Please sign in to comment.