Merge pull request #16 from liftlearning/toggle-want-to-button

Toggle Want to (Buy/Sell) button
This commit is contained in:
Enzo Gabriel 2023-01-05 12:06:27 -03:00 committed by GitHub
commit e58e5a54cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import router from "@/router";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useEtherStore } from "../store/ether"; import { useEtherStore } from "../store/ether";
import { ref } from "vue"; import { ref } from "vue";
@ -8,7 +7,7 @@ import blockchain from "../utils/blockchain";
// Store reference // Store reference
const etherStore = useEtherStore(); const etherStore = useEtherStore();
const { walletAddress, balance } = storeToRefs(etherStore); const { walletAddress, balance, sellerView } = storeToRefs(etherStore);
const menuOpenToggle = ref<boolean>(false); const menuOpenToggle = ref<boolean>(false);
const menuHoverToggle = ref<boolean>(false); const menuHoverToggle = ref<boolean>(false);
@ -57,13 +56,9 @@ const closeMenu = () => {
height="75" height="75"
/> />
<div class="flex gap-4 items-center"> <div class="flex gap-4 items-center">
<button <RouterLink :to="sellerView ? '/' : '/seller'" class="default-button">
type="button" {{ sellerView ? "Quero comprar" : "Quero vender" }}
class="default-button" </RouterLink>
v-on:click="router.push('/seller')"
>
Quero vender
</button>
<button <button
type="button" type="button"
v-if="!walletAddress" v-if="!walletAddress"
@ -259,7 +254,7 @@ header {
} }
.default-button { .default-button {
@apply px-4 py-2 rounded text-gray-50 font-semibold text-base; @apply px-4 py-2 rounded text-gray-50 font-semibold text-base hover:bg-transparent;
} }
.account-info { .account-info {

View File

@ -5,6 +5,7 @@ export const useEtherStore = defineStore("ether", {
walletAddress: "", walletAddress: "",
balance: "", balance: "",
loadingLock: false, loadingLock: false,
sellerView: false,
// Depósitos válidos para compra // Depósitos válidos para compra
depositsValidList: [] as any[], depositsValidList: [] as any[],
// Depósitos adicionados na blockchain // Depósitos adicionados na blockchain
@ -28,6 +29,9 @@ export const useEtherStore = defineStore("ether", {
setLoadingLock(isLoadingLock: boolean) { setLoadingLock(isLoadingLock: boolean) {
this.loadingLock = isLoadingLock; this.loadingLock = isLoadingLock;
}, },
setSellerView(sellerView: boolean) {
this.sellerView = sellerView;
},
setDepositsValidList(depositsValidList: any[]) { setDepositsValidList(depositsValidList: any[]) {
this.depositsValidList = depositsValidList; this.depositsValidList = depositsValidList;
}, },

View File

@ -15,8 +15,10 @@ enum Step {
List, List,
} }
// States
const etherStore = useEtherStore(); const etherStore = useEtherStore();
etherStore.setSellerView(false);
// States
const { loadingLock, walletAddress, locksAddedList } = storeToRefs(etherStore); const { loadingLock, walletAddress, locksAddedList } = storeToRefs(etherStore);
const flowStep = ref<Step>(Step.Search); const flowStep = ref<Step>(Step.Search);
const pixTarget = ref<string>(""); const pixTarget = ref<string>("");

View File

@ -5,6 +5,7 @@ import ValidationComponent from "../components/LoadingComponent.vue";
import blockchain from "../utils/blockchain"; import blockchain from "../utils/blockchain";
import { ref } from "vue"; import { ref } from "vue";
import { useEtherStore } from "@/store/ether";
enum Step { enum Step {
Search, Search,
@ -12,6 +13,9 @@ enum Step {
Network, Network,
} }
const etherStore = useEtherStore();
etherStore.setSellerView(true);
const flowStep = ref<Step>(Step.Sell); const flowStep = ref<Step>(Step.Sell);
const loading = ref<boolean>(false); const loading = ref<boolean>(false);