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

View file

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

View file

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