mirror of
https://github.com/romancm/gamebrary
synced 2024-11-23 11:43:07 +00:00
clean up
This commit is contained in:
parent
97a385b12d
commit
f0317747a5
2 changed files with 26 additions and 26 deletions
|
@ -16,12 +16,18 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
note: {
|
note: {
|
||||||
type: [Object, String],
|
type: [Object, String],
|
||||||
|
default: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
formattedNote() {
|
formattedNote() {
|
||||||
return marked(this.note?.note || this.note);
|
// TODO: remove legacy checks once fully migrated
|
||||||
|
const note = this.note?.note || this.note;
|
||||||
|
|
||||||
|
return typeof note === 'object'
|
||||||
|
? marked(note.note)
|
||||||
|
: marked(note);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!-- TODO: allow notes to be public -->
|
<!-- TODO: allow notes to be public -->
|
||||||
<!-- TODO: pagination? -->
|
<!-- TODO: pagination? -->
|
||||||
<template lang="html">
|
<template lang="html">
|
||||||
<b-container fluid>
|
<b-container>
|
||||||
<portal to="pageTitle">
|
<portal to="pageTitle">
|
||||||
<div>
|
<div>
|
||||||
<b-button
|
<b-button
|
||||||
|
@ -33,51 +33,47 @@
|
||||||
message="Looks like you don't have any notes yet."
|
message="Looks like you don't have any notes yet."
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<b-row v-else>
|
<b-form-row v-else-if="noteGames.length">
|
||||||
<b-col cols="6" v-if="noteGames.length">
|
<b-col
|
||||||
<!-- TODO: make computed for note selector -->
|
v-for="(game, index) in noteGames"
|
||||||
<div
|
:key="index"
|
||||||
v-for="(game, index) in noteGames"
|
cols="8"
|
||||||
:key="index"
|
>
|
||||||
>
|
<aside v-if="game">
|
||||||
<b-img
|
<b-img
|
||||||
v-if="game && game.id"
|
|
||||||
:src="getCoverUrl(game.id)"
|
:src="getCoverUrl(game.id)"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer "
|
||||||
thumbnail
|
width="40"
|
||||||
@click="selectedNote = filteredNotes[index]"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<b-button
|
<b-button
|
||||||
v-if="game && game.name"
|
v-if="game.name"
|
||||||
@click="selectedNote = filteredNotes[index]"
|
variant="link"
|
||||||
>
|
>
|
||||||
{{ game.name }}
|
{{ game.name }}
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
|
||||||
</b-col>
|
|
||||||
|
|
||||||
<b-col>
|
<p class="text-muited small" v-if="filteredNotes[index]">
|
||||||
<game-note :note="selectedNote" v-if="selectedNote" />
|
{{ filteredNotes[index].note }}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</aside>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-form-row>
|
||||||
</b-container>
|
</b-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import EmptyState from '@/components/EmptyState';
|
import EmptyState from '@/components/EmptyState';
|
||||||
import GameNote from '@/components/GameNote';
|
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
EmptyState,
|
EmptyState,
|
||||||
GameNote,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedNote: null,
|
|
||||||
loaded: false,
|
loaded: false,
|
||||||
search: '',
|
search: '',
|
||||||
};
|
};
|
||||||
|
@ -121,8 +117,6 @@ export default {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadGames();
|
this.loadGames();
|
||||||
|
|
||||||
if (this.filteredNotes.length > 0) this.selectedNote = this.filteredNotes[0];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in a new issue