Fix add list bugs

This commit is contained in:
Roman Cervantes 2019-04-06 07:41:09 -07:00
parent e1166b9805
commit 33b9730701
3 changed files with 18 additions and 21 deletions

View file

@ -49,7 +49,6 @@
<script>
import { mapState } from 'vuex';
import Panel from '@/components/Panel/Panel';
import Modal from '@/components/Modal/Modal';
import Tags from '@/components/Tags/Tags';
import ShareList from '@/components/ShareList/ShareList';
@ -61,7 +60,6 @@ export default {
Tags,
ShareList,
ListAdd,
Panel,
},
computed: {
@ -108,10 +106,6 @@ export default {
flex-direction: column;
}
.panel.warning {
margin: 0 0 $gp;
}
small {
background: $color-white;
margin-bottom: $gp / 2;

View file

@ -28,7 +28,7 @@
:key="suggestion"
type="button"
:disabled="listNames.includes(suggestion.toLowerCase())"
@click="addList(suggestion)"
@click="addSuggestion(suggestion)"
>
{{ suggestion }}
</button>
@ -57,8 +57,13 @@
<script>
import { mapState } from 'vuex';
import Panel from '@/components/Panel/Panel';
export default {
components: {
Panel,
},
data() {
return {
newListName: '',
@ -102,6 +107,11 @@ export default {
},
methods: {
addSuggestion(suggestion) {
this.newListName = suggestion;
this.addList();
},
focusField() {
this.$nextTick(() => {
this.$emit('scroll');
@ -113,15 +123,14 @@ export default {
this.$store.commit('SET_ADDING_LIST_STATUS', false);
},
addList(e, suggestion) {
const listName = suggestion || this.newListName;
this.$store.commit('ADD_LIST', listName);
addList() {
this.$store.commit('ADD_LIST', this.newListName);
this.$ga.event({
eventCategory: 'list',
eventAction: 'add',
eventLabel: 'listAdded',
eventValue: listName,
eventValue: this.newListName,
});
this.$emit('update');
@ -134,10 +143,6 @@ export default {
this.$emit('scroll');
});
if (suggestion) {
this.$refs.addList.close();
}
this.$store.commit('CLEAR_SEARCH_RESULTS');
this.$store.commit('SET_ACTIVE_LIST_INDEX', this.list.length - 1);
this.$store.commit('SET_SEARCH_ACTIVE', true);
@ -183,6 +188,10 @@ export default {
}
}
.panel.warning {
margin-bottom: $gp / 2;
}
footer {
padding: 0 $gp / 2 $gp / 2;
display: flex;

View file

@ -30,12 +30,6 @@
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/static\/icons\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}