mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-17 10:13:30 -06:00
Add characters route link to top, add Vuex sorted characters getter
This commit is contained in:
42
src/App.vue
42
src/App.vue
@@ -2,8 +2,10 @@
|
|||||||
<div id="app">
|
<div id="app">
|
||||||
<b-navbar>
|
<b-navbar>
|
||||||
<b-navbar-brand>
|
<b-navbar-brand>
|
||||||
<router-link :to="{ name: 'Home' }" class="no-link">The Office Quotes</router-link>
|
<router-link :to="{ name: 'Home' }" class="no-link">
|
||||||
<b-badge style="font-size: 0.80rem;" class="mx-2" v-if="showBreakpointMarker" variant="dark">
|
The Office Quotes
|
||||||
|
</router-link>
|
||||||
|
<b-badge v-if="showBreakpointMarker" style="font-size: 0.80rem;" class="mx-2" variant="dark">
|
||||||
<span id="marker-xs" class="d-sm-none">XS</span>
|
<span id="marker-xs" class="d-sm-none">XS</span>
|
||||||
<span id="marker-sm" class="d-none d-sm-block d-md-none">SM</span>
|
<span id="marker-sm" class="d-none d-sm-block d-md-none">SM</span>
|
||||||
<span id="marker-md" class="d-none d-md-block d-lg-none">MD</span>
|
<span id="marker-md" class="d-none d-md-block d-lg-none">MD</span>
|
||||||
@@ -23,29 +25,39 @@
|
|||||||
About
|
About
|
||||||
</router-link>
|
</router-link>
|
||||||
</b-nav-item>
|
</b-nav-item>
|
||||||
|
<b-nav-item href="#">
|
||||||
|
<router-link :to="{ name: 'Characters' }" class="no-link">
|
||||||
|
Characters
|
||||||
|
</router-link>
|
||||||
|
</b-nav-item>
|
||||||
</b-navbar-nav>
|
</b-navbar-nav>
|
||||||
</b-collapse>
|
</b-collapse>
|
||||||
</b-navbar>
|
</b-navbar>
|
||||||
<ais-instant-search index-name="prod_THEOFFICEQUOTES" :search-client="searchClient"
|
<ais-instant-search
|
||||||
:insights-client="insightsClient">
|
index-name="prod_THEOFFICEQUOTES" :search-client="searchClient"
|
||||||
|
:insights-client="insightsClient"
|
||||||
|
>
|
||||||
<b-container :fluid="true" class="py-2 px-lg-5 px-md-4">
|
<b-container :fluid="true" class="py-2 px-lg-5 px-md-4">
|
||||||
<b-row class="my-3 pl-1" cols="12">
|
<b-row class="my-3 pl-1" cols="12">
|
||||||
<b-col lg="3" xl="2" md="12">
|
<b-col lg="3" xl="2" md="12">
|
||||||
<ais-search-box @keydown.native="showResults" ref="searchbox" placeholder="Search here…"/>
|
<ais-search-box ref="searchbox" placeholder="Search here…" @keydown.native="showResults" />
|
||||||
<Skeleton secondary_color="#3e3e3e" border_radius="1px" primary_color="#4A4A4A"
|
<Skeleton
|
||||||
:inner_style="{ 'min-height': '35.6px' }"></Skeleton>
|
secondary_color="#3e3e3e" border_radius="1px"
|
||||||
|
primary_color="#4A4A4A"
|
||||||
|
:inner_style="{ 'min-height': '35.6px' }"
|
||||||
|
/>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row align-h="start" cols="12">
|
<b-row align-h="start" cols="12">
|
||||||
<b-col lg="3" xl="2" md="12">
|
<b-col lg="3" xl="2" md="12">
|
||||||
<SeasonList></SeasonList>
|
<SeasonList />
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col lg="8" xl="7" md="12" class="pt-md-2 pt-lg-0">
|
<b-col lg="8" xl="7" md="12" class="pt-md-2 pt-lg-0">
|
||||||
<router-view/>
|
<router-view />
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
</b-container>
|
</b-container>
|
||||||
<ais-configure :clickAnalytics="true"/>
|
<ais-configure :click-analytics="true" />
|
||||||
</ais-instant-search>
|
</ais-instant-search>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -119,16 +131,16 @@ export default {
|
|||||||
insightsClient: window.aa,
|
insightsClient: window.aa,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
showBreakpointMarker() {
|
||||||
|
return process.env.NODE_ENV === 'development';
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showResults() {
|
showResults() {
|
||||||
if (this.$refs.searchbox.currentRefinement !== "" && this.$route.path !== "/search_results")
|
if (this.$refs.searchbox.currentRefinement !== "" && this.$route.path !== "/search_results")
|
||||||
this.$router.push({name: "SearchResults"});
|
this.$router.push({name: "SearchResults"});
|
||||||
},
|
},
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
showBreakpointMarker() {
|
|
||||||
return process.env.NODE_ENV === 'development';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
11
src/store.js
11
src/store.js
@@ -167,6 +167,17 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
getCharacter: (state) => (character_id) => {
|
getCharacter: (state) => (character_id) => {
|
||||||
return state.characters[character_id];
|
return state.characters[character_id];
|
||||||
|
},
|
||||||
|
getSortedCharacters: (state) => () => {
|
||||||
|
let keys = Object.keys(state.characters);
|
||||||
|
console.log(keys)
|
||||||
|
keys.sort((a, b) => {
|
||||||
|
const a_count = state.characters[a].appearances;
|
||||||
|
const b_count = state.characters[b].appearances
|
||||||
|
if (a_count < b_count) return 1;
|
||||||
|
else return -1;
|
||||||
|
})
|
||||||
|
return keys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user