@@ -19,7 +19,7 @@
@@ -30,20 +30,24 @@
* @desc: ...
* -------------------------------------------
* Created Date: 18th December 2023
- * Modified: Wed Mar 06 2024
+ * Modified: Thu Jun 20 2024
**/
export default {
data() {
return {
- source: {
- is: 'library',
- },
+ is: 'library',
}
},
computed: {
...mapStores(useDataStore),
+
+ source() {
+ let slug = this.$route.params?.slug[0] || null
+ if (slug == 'pinned') return 'pinned'
+ return 'library'
+ },
},
methods: {
diff --git a/plugins/0.app.js b/plugins/0.app.js
index 0fffd29..6ec7e8a 100644
--- a/plugins/0.app.js
+++ b/plugins/0.app.js
@@ -6,7 +6,7 @@
* @desc: ...
* -------------------------------------------
* Created Date: 20th December 2023
- * Modified: Tue May 07 2024
+ * Modified: Thu Jun 20 2024
*/
// import { reactive } from 'vue'
@@ -21,7 +21,7 @@ let $state = null
let $repos = null
let app = {
- v: '0.12.0 β', //β
+ v: '0.13.1 β', //β
// Global app state
// Controls modules boundaries
diff --git a/plugins/analytics.client.js b/plugins/analytics.client.js
deleted file mode 100644
index 1356161..0000000
--- a/plugins/analytics.client.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import { inject } from '@vercel/analytics'
-
-export default defineNuxtPlugin(() => {
- inject()
-})
diff --git a/plugins/dayjs.js b/plugins/dayjs.js
index e5b97e4..e5f2874 100644
--- a/plugins/dayjs.js
+++ b/plugins/dayjs.js
@@ -1,5 +1,4 @@
/**
- * @project: KAAM
* @file: \plugins\dayjs.js
* @desc: https://kas.kim/blog/using-dayjs-in-nuxt-3-as-plugin/
* -------------------------------------------
diff --git a/plugins/vuetify.js b/plugins/vuetify.js
new file mode 100644
index 0000000..61841a9
--- /dev/null
+++ b/plugins/vuetify.js
@@ -0,0 +1,94 @@
+import 'vuetify/styles'
+import { createVuetify } from 'vuetify'
+
+// import * as labs from 'vuetify/labs/components'
+// import * as components from 'vuetify/components'
+// import * as directives from 'vuetify/directives'
+
+import {
+ VBtn,
+ VChip,
+ VIcon,
+ VForm,
+ VSpacer,
+ VDialog,
+ VSnackbar,
+ VTextField,
+ VColorPicker,
+ VProgressLinear,
+ VCard,
+ VCardText,
+ VCardTitle,
+ VCardActions,
+} from 'vuetify/components'
+
+import { md2 } from 'vuetify/blueprints'
+import { en } from 'vuetify/locale'
+
+export default defineNuxtPlugin((nuxtApp) => {
+ const vuetify = createVuetify({
+ ssr: true,
+
+ blueprint: md2,
+ theme: {
+ defaultTheme: 'dark',
+ },
+
+ locale: {
+ locale: 'en',
+ fallback: 'en',
+ messages: { en },
+ },
+
+ components: {
+ VBtn,
+ VIcon,
+ VChip,
+ VForm,
+ VDialog,
+ VSpacer,
+ VSnackbar,
+ VTextField,
+ VColorPicker,
+ VProgressLinear,
+
+ VCard,
+ VCardText,
+ VCardTitle,
+ VCardActions,
+
+ // ...labs,
+ // ...components,
+ },
+
+ defaults: {
+ global: {
+ ripple: false,
+ },
+
+ VBtn: {
+ variant: 'elevated',
+
+ style: [{ textTransform: 'none' }],
+ },
+
+ VTextField: {
+ class: '',
+ variant: 'solo',
+ flat: true,
+ density: 'compact',
+ hideDetails: 'auto',
+ },
+
+ VCard: {
+ style: [{ background: '#20222b' }],
+ },
+
+ VSelect: { variant: 'outlined' },
+ },
+
+ // directives,
+ })
+
+ nuxtApp.vueApp.use(vuetify)
+})
diff --git a/public/img/changelog/2024-06.png b/public/img/changelog/2024-06.png
new file mode 100644
index 0000000..43ebe64
Binary files /dev/null and b/public/img/changelog/2024-06.png differ
diff --git a/stores/collectionStore.js b/stores/collectionStore.js
index bcde746..ca2b8b8 100644
--- a/stores/collectionStore.js
+++ b/stores/collectionStore.js
@@ -3,12 +3,12 @@
* @desc: ...
* -------------------------------------------
* Created Date: 14th December 2023
- * Modified: Thu Dec 14 2023
+ * Modified: Thu May 09 2024
*/
let $nuxt = null
-export const useCollectionsStore = defineStore('collections', {
+export const useCollectionStore = defineStore('collection', {
state: () => ({
meta: {
time: 0,
@@ -57,5 +57,5 @@ export const useCollectionsStore = defineStore('collections', {
//| https://pinia.vuejs.org/cookbook/hot-module-replacement.html
//+-------------------------------------------------
if (import.meta.hot) {
- import.meta.hot.accept(acceptHMRUpdate(useCollectionsStore, import.meta.hot))
+ import.meta.hot.accept(acceptHMRUpdate(useCollectionStore, import.meta.hot))
}
diff --git a/stores/dataStore.js b/stores/dataStore.js
index b1d1764..0fd358b 100644
--- a/stores/dataStore.js
+++ b/stores/dataStore.js
@@ -5,7 +5,7 @@
* @desc: ...
* -------------------------------------------
* Created Date: 14th November 2023
- * Modified: Sat May 04 2024
+ * Modified: Thu Jun 20 2024
*/
let $nuxt = null
@@ -212,14 +212,19 @@ export const useDataStore = defineStore('data', {
//+-------------------------------------------------
searchHash(f = {}) {
let emptyString = !f.string || f.string?.length < 3
+ let dirty = ['genres', 'anotherArrayProperty'].some(
+ (prop) => Array.isArray(f[prop]) && f[prop].length > 0
+ )
if (f.sortBy == 'rand') return null
- if (f.sortBy == 'score' && f.sortDir == 'desc' && emptyString) return null
+ if (f.sortBy == 'score' && f.sortDir == 'desc' && emptyString && !dirty) return null
if (f.sortBy == 'playtime' && emptyString) return null
delete f.mods
delete f.show
delete f.states
+
+ if (emptyString) delete f.string
if (!f.released) delete f.released
if (f.genres?.length == 0) delete f.genres
@@ -484,7 +489,7 @@ export const useDataStore = defineStore('data', {
if (item.api_id) index.api[item.api_id] = item.uuid
if (item.steam_id) index.steam[item.steam_id] = item.uuid
- if (this.isLibrary(item) && !index.lib.includes(item.uuid)) {
+ if ((this.isLibrary(item) && !index.lib.includes(item.uuid)) || item.is.dirty) {
index.lib.push(item.uuid)
}
diff --git a/stores/gameStore.js b/stores/gameStore.js
index e60da9e..d547ea8 100644
--- a/stores/gameStore.js
+++ b/stores/gameStore.js
@@ -5,7 +5,7 @@
* @desc: ...
* -------------------------------------------
* Created Date: 11th January 2024
- * Modified: Tue May 07 2024
+ * Modified: Tue May 14 2024
*/
let $nuxt = null
@@ -13,7 +13,9 @@ let $data = null
export const useGameStore = defineStore('game', {
state: () => ({
- app: {},
+ app: {
+ is: {},
+ },
}),
//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -26,6 +28,11 @@ export const useGameStore = defineStore('game', {
// Modify data
// * create()
// * update()
+ // * normalize()
+ //
+ // Getters
+ // * _score()
+ // * _playtime()
//
//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -240,29 +247,28 @@ export const useGameStore = defineStore('game', {
// Avoid very high scores not verified
//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if (!app.scores) score = score - 10
+ if (!app.scores) score = score - 25
if (app.score >= 96 && !app.scores) {
- score = 60
+ score = 50
}
- // Reduce the final score if the amount of reviews is low
- //+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if (app.score > 90 && app.scores?.steamCount < 100) score *= 0.8
- if (app.score > 93 && app.scores?.steamCount < 3000) score *= 0.8
+ // // Reduce the final score if the amount of reviews is low
+ // //+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ if (app.scores?.steamCount < 100) score *= 0.7
+ else if (app.scores?.steamCount < 1000) score *= 0.8
+ else if (app.scores?.steamCount < 3000) score *= 0.9
- if (app.score >= 95 && app.scores?.steamCount < 3000) score *= 0.8
- if (app.score >= 95 && app.scores?.steamCount < 15000) score *= 0.8
+ if (app.score >= 95 && app.scores?.steamCount < 16000) score *= 0.8
- if (app.scores?.igdbCount < 90) score *= 0.9
+ // On games outside of steam...
+ //+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ if (app.scores.igdb > 0 && app.scores?.igdbCount < 90) score *= 0.8
// Only when there is only igdb
//+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- if (app.scores && !app.scores?.steamCount) {
- if (app.scores?.igdb >= 90 && !app.scores.igdbCount) score *= 0.8
- }
-
- // if (app.scores?.steamCount < 100) score = score * 0.6
- // else if (app.scores?.steamCount < 1000) score = score * 0.8
+ // if (app.scores && !app.scores?.steamCount) {
+ // if (app.scores?.igdb >= 90 && !app.scores.igdbCount) score *= 0.8
+ // }
return score
},
diff --git a/stores/stateStore.js b/stores/stateStore.js
index 209066e..4afa3d4 100644
--- a/stores/stateStore.js
+++ b/stores/stateStore.js
@@ -5,7 +5,7 @@
* @desc: ...
* -------------------------------------------
* Created Date: 14th December 2023
- * Modified: Wed Apr 10 2024
+ * Modified: Thu Jun 20 2024
*/
let $nuxt = null
@@ -43,16 +43,6 @@ export const useStateStore = defineStore('state', {
// getCurrentlyPlaying() {
// return this.playing
// },
- // //+-------------------------------------------------
- // // list()
- // // Returns the array of states
- // // -----
- // // Created on Fri Jan 12 2024
- // // Updated on Sat Feb 10 2024 - Made a getter
- // //+-------------------------------------------------
- // list() {
- // return this.states
- // },
},
actions: {
@@ -67,16 +57,6 @@ export const useStateStore = defineStore('state', {
return this.index[state]?.length || 0
},
- // //+-------------------------------------------------
- // // list()
- // // Returns the array of states
- // // -----
- // // Created on Fri Jan 12 2024
- // //+-------------------------------------------------
- // async list() {
- // return this.states
- // },
-
//+-------------------------------------------------
// get()
// Returns a single state by id
@@ -87,30 +67,60 @@ export const useStateStore = defineStore('state', {
return this.states.find((state) => state.id === id)
},
- // async add(data) {
- // const $nuxt = useNuxtApp()
- // const id = await $nuxt.$db.states.add(data)
- // return id
- // },
-
// async update(data) {
// const $nuxt = useNuxtApp()
// const id = await $nuxt.$db.states.put(data)
// return id
// },
+ //+-------------------------------------------------
+ // create()
+ // Creates a new state and saves it to the DB
+ // -----
+ // Created on Tue Jun 18 2024
+ //+-------------------------------------------------
+ async create(data) {
+ delete data.action
+
+ data.created_at = dates.now()
+ data.updated_at = dates.now()
+
+ const id = await $nuxt.$db.states.put(data)
+ await this.load(true)
+
+ return id
+ },
+
+ //+-------------------------------------------------
+ // update()
+ // Update a state and reload
+ // -----
+ // Created on Thu Jun 20 2024
+ //+-------------------------------------------------
+ async update(data) {
+ delete data.action
+
+ data.updated_at = dates.now()
+ await $nuxt.$db.states.put(data)
+ await this.load(true)
+ },
+
async delete(id) {
this.states = this.states.filter((state) => state.id !== id)
+
await $nuxt.$db.states.delete(id)
+ await this.load(true)
+
+ return true
},
//+-------------------------------------------------
- // sortState()
- //
+ // sort()
+ // Sorts a state in a direction and saves both states
// -----
// Created on Wed Jan 17 2024
//+-------------------------------------------------
- sortState(direction, id) {
+ sort(direction, id) {
let states = this.states
const index = states.findIndex((item) => item.id === id)
@@ -118,16 +128,29 @@ export const useStateStore = defineStore('state', {
const temp = states[index].order
states[index].order = states[index - 1].order
states[index - 1].order = temp
+
+ $nuxt.$db.states.bulkPut([
+ { ...states[index], nonCloneableProp: undefined },
+ { ...states[index - 1], nonCloneableProp: undefined },
+ ])
}
if (index < states.length - 1 && direction === 'down') {
const temp = states[index].order
states[index].order = states[index + 1].order
states[index + 1].order = temp
+
+ $nuxt.$db.states.bulkPut([
+ { ...states[index], nonCloneableProp: undefined },
+ { ...states[index - 1], nonCloneableProp: undefined },
+ ])
}
this.states = states.sort((a, b) => a.order - b.order)
console.warn('🔃 Sorted states', this.states)
+ $nuxt.$toast.success('Order saved', {
+ // description: 'Monday, January 3rd at 6:00pm',
+ })
},
//+-------------------------------------------------
@@ -140,8 +163,14 @@ export const useStateStore = defineStore('state', {
// - ✅ emits a state change event
// -----
// Created on Sat Jan 06 2024
+ // Updated on Fri May 10 2024 - Added pinned
//+-------------------------------------------------
set(uuid, state) {
+ if (state == 'pinned') {
+ this.pin(uuid)
+ return
+ }
+
let obj = this.keyed[state]
let app = $data.get(uuid)
let old = app.state || null
@@ -178,6 +207,38 @@ export const useStateStore = defineStore('state', {
this.indexLibrary()
},
+ //+-------------------------------------------------
+ // function()
+ //
+ // -----
+ // Created on Fri May 10 2024
+ //+-------------------------------------------------
+ pin(uuid) {
+ let app = $data.get(uuid)
+ let old = app.is?.pinned || false
+
+ // Update the pin status
+ // on $game and $data
+ //+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ app.is.dirty = true
+ app.is.pinned = !old
+
+ $game.app.is.pinned = !old
+ $game.update(uuid, { ...app })
+
+ $nuxt.$mitt.emit('pinned:change', {
+ uuid: uuid,
+ pinned: !old,
+ })
+
+ $nuxt.$toast.success('Game has been ' + (old ? 'unpinned' : 'pinned'), {
+ // description: 'Monday, January 3rd at 6:00pm',
+ })
+
+ this.indexLibrary()
+ },
+
//+-------------------------------------------------
// indexLibrary()
// Creates an index Array of UUIDs for each state
@@ -201,7 +262,9 @@ export const useStateStore = defineStore('state', {
}
})
- this.pinned = library.filter((app) => app.is && app.is.pinned)
+ this.pinned = library
+ .filter((app) => app.is && app.is.pinned)
+ .map((app) => app.uuid)
},
//+-------------------------------------------------
@@ -209,9 +272,10 @@ export const useStateStore = defineStore('state', {
// Loads the state array from DB to this
// -----
// Created on Sat Jan 06 2024
+ // Updated on Wed Jun 19 2024 - Reload
//+-------------------------------------------------
- async load() {
- if (this.meta.loaded) return
+ async load(reload = false) {
+ if (this.meta.loaded && !reload) return
const states = await $nuxt.$db.states.toArray()
diff --git a/utils/notify.js b/utils/notify.js
index 5fc8e35..980f72f 100644
--- a/utils/notify.js
+++ b/utils/notify.js
@@ -8,7 +8,8 @@
export default {
show(params) {
- useNuxtApp().$emit('notifications:show', {
+ let $nuxt = useNuxtApp()
+ $nuxt.$mitt.emit('notification:show', {
// type: 'error',
text: 'Debes revisar los campos antes de continuar',
...params,
diff --git a/utils/search.js b/utils/search.js
index c315383..b3ee380 100644
--- a/utils/search.js
+++ b/utils/search.js
@@ -3,7 +3,7 @@
* @desc: ...
* -------------------------------------------
* Created Date: 9th January 2024
- * Modified: Wed May 01 2024
+ * Modified: Thu Jun 20 2024
*/
export default {
@@ -39,11 +39,11 @@ export default {
// Match with app.state
//+---------------------------------------
if (filters?.states?.length) {
- if (!filters.states.includes(app.state)) {
- // if (app.state !== filters.state) {
- filtered.push(uuid)
- // console.warn('🛑 Skipping as not in state', filters.state, app.name)
+ const { states } = filters
+ const isPinned = states.includes('pinned')
+ if ((isPinned && !app.is?.pinned) || (!isPinned && !states.includes(app.state))) {
+ filtered.push(uuid)
continue
}
}