assembly/components/Navbar.vue

84 lines
2.5 KiB
Vue
Raw Normal View History

2021-07-17 21:44:21 +00:00
<template>
<div
2021-08-17 18:16:43 +00:00
class="px-4 md:px-8 py-4 border border-b-[#E7E8F1] shadow flex flex-col md:flex-row md:items-center md:justify-between"
2021-07-17 21:44:21 +00:00
>
2021-08-19 16:28:25 +00:00
<div class="flex items-center">
<nuxt-link to="/" class="flex items-center text-[#1874FF]">
<svg
width="28"
height="26"
viewBox="0 0 28 26"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M15.0779 0.655535C14.6014 -0.218507 13.3989 -0.218513 12.9224 0.655524L7.43746 10.7156C7.20102 11.1492 7.49979 11.6888 7.97635 11.6888L20.0238 11.6888C20.5004 11.6888 20.7991 11.1492 20.5627 10.7156L15.0779 0.655535Z"
fill="currentColor"
/>
<path
d="M22.4164 14.1155C22.1793 13.6808 21.5821 13.678 21.3414 14.1105L15.2685 25.0217C15.0271 25.4554 15.3255 26 15.8046 26H26.7568C27.71 26 28.3075 24.9208 27.8346 24.0535L22.4164 14.1155Z"
fill="currentColor"
/>
<path
d="M12.1952 26C12.6742 26 12.9727 25.4554 12.7313 25.0217L6.65864 14.1107C6.41791 13.6782 5.82069 13.6809 5.58364 14.1157L0.16539 24.0535C-0.307493 24.9208 0.290038 26 1.24316 26H12.1952Z"
fill="currentColor"
/>
</svg>
<span class="ml-2 font-extrabold text-lg">ASSEMBLY</span>
</nuxt-link>
2021-07-17 21:44:21 +00:00
2021-08-19 16:28:25 +00:00
<toggle-button
v-if="active && canSimulate"
@change="checked => (checked ? startSimulation() : stopSimulation())"
2021-08-20 21:49:45 +00:00
:checked="!!forkId"
2021-08-19 16:28:25 +00:00
:loading="loading"
class="ml-4 border-l pl-4"
label="Simulation Mode"
>
</toggle-button>
</div>
2021-07-17 21:44:21 +00:00
2021-08-19 16:28:25 +00:00
<div
2021-09-01 18:56:10 +00:00
class="mt-8 md:mt-0 md:ml-auto flex-wrap flex items-center md:justify-center md:space-x-2.5"
2021-08-19 16:28:25 +00:00
>
2021-07-19 19:35:31 +00:00
<AccountSwitcher v-if="active" />
2021-07-17 21:44:21 +00:00
<NetworkSwitcher />
2021-08-20 21:49:45 +00:00
<AccountDropdown />
2021-07-17 21:44:21 +00:00
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from "@nuxtjs/composition-api";
2021-08-19 16:28:25 +00:00
import { useTenderly } from "~/composables/useTenderly";
2021-09-03 13:59:09 +00:00
import { useWeb3 } from "@instadapp/vue-web3";
2021-08-19 16:28:25 +00:00
import ToggleButton from "./common/input/ToggleButton.vue";
2021-07-17 21:44:21 +00:00
export default defineComponent({
2021-08-19 16:28:25 +00:00
components: { ToggleButton },
2021-07-19 19:35:31 +00:00
setup() {
const { active, activate, deactivate } = useWeb3();
2021-08-19 16:28:25 +00:00
const {
canSimulate,
startSimulation,
stopSimulation,
forkId,
2021-08-20 21:49:45 +00:00
loading
2021-08-19 16:28:25 +00:00
} = useTenderly();
2021-07-19 19:35:31 +00:00
return {
active,
activate,
2021-08-19 16:28:25 +00:00
deactivate,
canSimulate,
startSimulation,
stopSimulation,
forkId,
2021-08-20 21:49:45 +00:00
loading
2021-07-19 19:35:31 +00:00
};
}
2021-07-17 21:44:21 +00:00
});
</script>