diff --git a/src/components/Game/GameSubPage.vue b/src/components/Game/GameSubPage.vue deleted file mode 100644 index a3c9cead..00000000 --- a/src/components/Game/GameSubPage.vue +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - diff --git a/src/pages/GameNotesPage.vue b/src/pages/GameNotesPage.vue index 00e91303..bc4e3fba 100644 --- a/src/pages/GameNotesPage.vue +++ b/src/pages/GameNotesPage.vue @@ -1,51 +1,77 @@ @@ -53,14 +79,13 @@ import { mapState } from 'vuex'; import GameNote from '@/components/GameNote'; -import GameSubPage from '@/components/Game/GameSubPage'; import MarkdownCheatsheet from '@/components/MarkdownCheatsheet'; +// TODO: consolidate getGameCoverUrl import { getGameCoverUrl } from '@/utils'; export default { components: { GameNote, - GameSubPage, MarkdownCheatsheet, }, @@ -73,7 +98,7 @@ export default { }, computed: { - ...mapState(['notes', 'game']), + ...mapState(['notes', 'game', 'games']), gameCoverUrl() { return getGameCoverUrl(this.game); @@ -95,6 +120,14 @@ data() { }, methods: { + getCoverUrl(gameId) { + const game = this.games[gameId]; + + return game && game.cover && game.cover.image_id + ? `https://images.igdb.com/igdb/image/upload/t_cover_small_2x/${game.cover.image_id}.jpg` + : '/no-image.jpg'; + }, + loadNote() { if (this.game.id !== this.$route.params.id) { this.loadGame(); diff --git a/src/pages/GameTagsPage.vue b/src/pages/GameTagsPage.vue index 70d6e142..01b8cba9 100644 --- a/src/pages/GameTagsPage.vue +++ b/src/pages/GameTagsPage.vue @@ -27,9 +27,7 @@ -
- -
+ diff --git a/src/pages/NotesPage.vue b/src/pages/NotesPage.vue index b97174a3..4f8b1e63 100644 --- a/src/pages/NotesPage.vue +++ b/src/pages/NotesPage.vue @@ -15,6 +15,7 @@ Notes + - + > + + + + {{ game.name }} + + + + + + + + @@ -57,6 +77,7 @@ export default { data() { return { + selectedNote: null, loaded: false, search: '', }; @@ -69,6 +90,10 @@ export default { return this.loaded && !Object.keys(this.notes).length; }, + noteGames() { + return Object.keys(this.notes).map((id) => this.games[id]); + }, + // TODO: move to getter? filteredNotes() { return Object.values(this.notes) @@ -96,21 +121,11 @@ export default { mounted() { this.loadGames(); + + if (this.filteredNotes.length > 0) this.selectedNote = this.filteredNotes[0]; }, methods: { - getNoteHeight(noteLength) { - if (noteLength < 50) { - return 100; - } - - if (noteLength < 200) { - return 300; - } - - return 200; - }, - async loadGames() { const gamesList = Object.keys(this.notes).length ? Object.keys(this.notes).toString() @@ -142,24 +157,3 @@ export default { }, }; - -