create menu

This commit is contained in:
enzoggqs 2022-12-14 19:30:29 -03:00
parent 07c4caa7b4
commit 1af0cf3df7
5 changed files with 109 additions and 4 deletions

View File

@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useEtherStore } from "../store/ether"; import { useEtherStore } from "../store/ether";
import { ref } from "vue";
import blockchain from "../utils/blockchain"; import blockchain from "../utils/blockchain";
// Store reference // Store reference
@ -8,6 +9,10 @@ const etherStore = useEtherStore();
const { walletAddress, balance } = storeToRefs(etherStore); const { walletAddress, balance } = storeToRefs(etherStore);
const emit = defineEmits(["disconnectUser"]);
const menuToggle = ref<boolean>(false);
//Methods //Methods
const connectMetaMask = () => { const connectMetaMask = () => {
blockchain.connectProvider(); blockchain.connectProvider();
@ -29,6 +34,14 @@ const formatWalletBalance = (): string => {
return fixed; return fixed;
}; };
// const disconnectWallet = () => {
// menuToggle.value = false;
// };
const log = () => {
console.log(menuToggle.value);
};
</script> </script>
<template> <template>
@ -56,10 +69,63 @@ const formatWalletBalance = (): string => {
<span class="default-text"> Ethereum </span> <span class="default-text"> Ethereum </span>
<img alt="Chevron Down" src="@/assets/chevronDown.svg" /> <img alt="Chevron Down" src="@/assets/chevronDown.svg" />
</div> </div>
<div class="top-bar-info"> <div class="flex flex-col">
<img alt="Account image" src="@/assets/account.svg" /> <div
<span class="default-text text-sm">{{ formatWalletAddress() }}</span> class="top-bar-info"
<img alt="Chevron Down" src="@/assets/chevronDown.svg" /> @mouseover="menuToggle = true"
@mouseout="menuToggle = false"
:style="{
backgroundColor: menuToggle ? '#F9F9F9' : 'transparent',
}"
>
<img alt="Account image" src="@/assets/account.svg" />
<span
class="default-text text-sm"
:style="{
color: menuToggle ? '#000000' : 'rgb(249 250 251)',
}"
>
{{ formatWalletAddress() }}
</span>
<img alt="Chevron Down" src="@/assets/chevronDown.svg" />
</div>
<div
v-show="menuToggle"
class="mt-10 absolute w-full text-black"
@mouseover="menuToggle = true"
@mouseout="menuToggle = false"
>
<div class="pl-4 mt-2">
<div class="bg-white rounded-md z-10">
<div
class="menu-button px-4 rounded-md cursor-pointer"
onclick="window.location='/bid_history'"
>
<div class="py-4 text-end font-semibold text-xs">
Histórico de compras
</div>
<hr />
</div>
<div
class="menu-button px-4 cursor-pointer"
onclick="window.location='/manage_bids'"
>
<div class="py-4 text-end font-semibold text-xs">
Gerenciar Ofertas
</div>
<hr />
</div>
<div
class="menu-button px-4 py-1 rounded-md cursor-pointer"
@click="emit('disconnectUser', {})"
>
<div class="py-3 text-end font-semibold text-xs">
Desconectar
</div>
</div>
</div>
</div>
</div>
</div> </div>
<div class="top-bar-info"> <div class="top-bar-info">
<span class="default-text text-sm"> <span class="default-text text-sm">
@ -91,4 +157,8 @@ header {
.top-bar-info { .top-bar-info {
@apply flex justify-between gap-2 px-4 py-2 border-amber-500 border-2 rounded; @apply flex justify-between gap-2 px-4 py-2 border-amber-500 border-2 rounded;
} }
.menu-button:hover {
background-color: #E5E7EB;
}
</style> </style>

View File

@ -1,6 +1,8 @@
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue"; import HomeView from "../views/HomeView.vue";
import MockView from "../views/MockView.vue"; import MockView from "../views/MockView.vue";
import BidHistoryView from "../views/BidHistoryView.vue";
import ManageBidsView from "../views/ManageBidsView.vue";
const router = createRouter({ const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL), history: createWebHistory(import.meta.env.BASE_URL),
@ -15,6 +17,16 @@ const router = createRouter({
name: "mock", name: "mock",
component: MockView, component: MockView,
}, },
{
path: "/bid_history",
name: "bid history",
component: BidHistoryView,
},
{
path: "/manage_bids",
name: "manage bids",
component: ManageBidsView,
},
], ],
}); });

View File

@ -0,0 +1,8 @@
<script setup lang="ts">
</script>
<template>
<div>Histórico de ofertas</div>
</template>
<style scoped></style>

View File

@ -62,6 +62,12 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
// Valor = tokenValue // Valor = tokenValue
} }
}; };
const disconnectUser = ({}: any) => {
console.log('entrou')
etherStore.setWalletAddress("");
flowStep.value == Step.Search;
};
</script> </script>
<template> <template>
@ -77,6 +83,7 @@ const confirmBuyClick = async ({ selectedDeposit, tokenValue }: any) => {
/> />
<ValidationComponent v-if="loadingLock" /> <ValidationComponent v-if="loadingLock" />
</div> </div>
<div @disconnect-user="disconnectUser"></div>
</template> </template>
<style scoped></style> <style scoped></style>

View File

@ -0,0 +1,8 @@
<script setup lang="ts">
</script>
<template>
<div>Gerenciar Ofertas</div>
</template>
<style scoped></style>