Skip to content

Commit

Permalink
fix(reports): remove og:image column on mobile by default
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Dec 29, 2020
1 parent 81a6be2 commit 6863da7
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,29 @@ export default {
setDefaultFields() {
let fields = [];
// find default preset
let defaultPreset;
for (let i in this.$store.state.columnPresets) {
const preset = this.$store.state.columnPresets[i];
if (preset.default) {
fields = preset.columns;
if (preset.default || preset.name === 'default') {
defaultPreset = preset;
break;
}
}
if (fields.length === 0 && this.$store.state.columnPresets.default) {
fields = this.$store.state.columnPresets.default.columns;
if (!defaultPreset) return;
fields = [...defaultPreset.columns];
// remove og:image on mobile
if (window.screen.width < 640) {
const index = fields.indexOf('og_image');
if (index !== -1) fields.splice(index, 1);
}
// default if no fields
if (fields.length === 0) {
fields = defaultPreset.columns;
}
this.setFields(fields);
Expand Down

0 comments on commit 6863da7

Please sign in to comment.