Skip to content

Commit

Permalink
fix: Remove useless stores and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
RezaRahemtola committed May 31, 2024
1 parent a63dc26 commit 9dc2657
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/components/PersonaDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineComponent({
const usernameInputRef = ref('user');
function updatePersona() {
personasStore.setPersona(persona);
personasStore.persona = persona;
}
return {
Expand Down
18 changes: 9 additions & 9 deletions src/components/PersonaDropDown.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<template>
<q-btn-dropdown
no-caps
unelevated
rounded
:icon="'img:' + personasStore.persona.avatarUrl"
dropdown-icon="img:icons/svg/chevron-down.svg"
:label="personasStore.persona.name"
class="no-shadow rounded-img personas-dropdown q-py-sm"
dropdown-icon="img:icons/svg/chevron-down.svg"
no-caps
rounded
text-color="primary"
:label="personasStore.persona.name"
unelevated
>
<q-list>
<q-item
clickable
v-close-popup
v-for="persona of personasStore.personas"
:key="persona.id"
v-close-popup
:name="persona.id"
clickable
@click="setPersona(persona.id)"
>
<q-avatar size="32px" class="q-mr-md">
<q-avatar class="q-mr-md" size="32px">
<img :src="persona.avatarUrl" />
</q-avatar>
<q-item-section>
Expand All @@ -41,7 +41,7 @@ export default defineComponent({
const personasStore = usePersonasStore();
function setPersona(id) {
personasStore.setPersona(personasStore.personas.find((persona) => persona.id === id));
personasStore.persona = personasStore.personas.find((persona) => persona.id === id);
}
return {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export default defineComponent({
}
console.log('set persona from chat');
personasStore.setPersona(chatRef.value.persona);
personasStore.persona = chatRef.value.persona;
// Extract the chat properties
let title = chatRef.value.title;
let username = chatRef.value.username;
Expand Down
34 changes: 16 additions & 18 deletions src/pages/PointsInfo.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<q-page class="flex flex-center bg-dark_deleted font-mulish text-purple-700">
<div class="row q-pa-xl q-col-gutter-md">
<q-card flat class="col-12 text-center">
<q-card class="col-12 text-center" flat>
<q-card-section class="bg-dark-page_deleted">
<div class="text-h4 text-bold">Earn Libertai Points</div>
</q-card-section>
Expand All @@ -15,7 +15,7 @@
<p>How to participate:</p>
</q-card-section>
</q-card>
<q-card flat class="col-6 text-center column">
<q-card class="col-6 text-center column" flat>
<q-card-section class="bg-purple-50">
<div class="text-h6 text-semibold">Stake ALEPH</div>
</q-card-section>
Expand All @@ -26,7 +26,7 @@
</p>
</q-card-section>
</q-card>
<q-card flat class="col-6 text-center column">
<q-card class="col-6 text-center column" flat>
<q-card-section class="bg-purple-50">
<div class="text-h6 text-semibold">aleph.im Core Channel Node Operator</div>
</q-card-section>
Expand All @@ -37,7 +37,7 @@
</p>
</q-card-section>
</q-card>
<q-card flat class="col-6 text-center column">
<q-card class="col-6 text-center column" flat>
<q-card-section class="bg-purple-50">
<div class="text-h6 text-semibold">aleph.im Resource Node Operator</div>
</q-card-section>
Expand All @@ -48,7 +48,7 @@
</p>
</q-card-section>
</q-card>
<q-card flat class="col-6 text-center column">
<q-card class="col-6 text-center column" flat>
<q-card-section class="bg-purple-50">
<div class="text-h6 text-semibold">Connect your wallet and Start earning points today!</div>
</q-card-section>
Expand All @@ -59,31 +59,31 @@
</p>
</q-card-section>
</q-card>
<q-card flat class="col-12 text-center">
<q-card class="col-12 text-center" flat>
<q-card-section class="bg-purple-50">
<div class="text-h6">Check your points</div>
</q-card-section>
<q-card-section class="q-pt-none bg-purple-50">
<q-input
v-model="address"
bottom-slots
counter
:rules="addressRules"
autofocus
rounded
standout
bg-color="secondary"
bottom-slots
class="q-pa-lg"
counter
input-class="text-light"
label="Address"
label-color="grey"
maxlength="42"
:rules="addressRules"
rounded
standout
>
<template v-slot:prepend>
<q-icon name="wallet" />
</template>

<template v-slot:hint> Enter an address to check if there are points associated with it. </template>
<template v-slot:hint> Enter an address to check if there are points associated with it.</template>
</q-input>
<div v-if="addressVerifier(address) === true" class="text-h6 text-bold q-pa-lg">
<div v-if="points.getAddressPoints(address) === 0">
Expand All @@ -93,11 +93,11 @@
You have points!<br /><br />
<q-btn
:to="{ name: 'points-detail', params: { address: address } }"
label="View details"
color="white"
text-color="primary"
label="View details"
no-caps
rounded
text-color="primary"
/>
</div>
</div>
Expand All @@ -108,15 +108,13 @@
</template>

<script>
import { defineComponent, ref, onMounted, nextTick } from 'vue';
import { useCounterStore } from '../stores/counter-store';
import { defineComponent, nextTick, onMounted, ref } from 'vue';
import { usePoints } from '../stores/points';
import { ethers } from 'ethers';
export default defineComponent({
name: 'PointsInfo',
setup() {
const counter = useCounterStore();
const expanded = ref(false);
const points = usePoints();
const address = ref('');
Expand All @@ -141,12 +139,12 @@ export default defineComponent({
return 'Invalid address';
}
}
// points.points is an object, let's check if it's empty
// const count = ref(0)
return {
points,
counter,
expanded,
address,
addressVerifier,
Expand Down
15 changes: 0 additions & 15 deletions src/stores/counter-store.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/stores/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/stores/personas-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,4 @@ export const usePersonasStore = defineStore('personas', {
persona: defaultPersonas[0],
}),
getters: {},
actions: {
setPersona(persona) {
// you can directly mutate the state
this.persona = persona;
},
},
});

0 comments on commit 9dc2657

Please sign in to comment.