Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/install: MVP #31

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</script>

<!-- <script type="module" src="http://localhost:5001/assets-v1/cdn/interceptor/index.local.js"></script> -->
<script type="module" src="https://layer8devproxy.net/assets-v1/cdn/interceptor/index.local.js"></script>
<!-- <script type="module" src="https://layer8devproxy.net/assets-v1/cdn/interceptor/index.local.js"></script> -->
</head>
<body>
<div id="app"></div>
Expand Down
50 changes: 22 additions & 28 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
"cy:open": "cypress open"
},
"dependencies": {
"ethers": "^6.8.0",
"jwt-decode": "^3.1.2",
"layer8_interceptor": "^0.0.7",
"layer8_middleware": "^0.0.6",
"pinia": "^2.1.6",
"pinia-plugin-persistedstate": "^3.2.0",
"siwe": "^2.1.4",
"vue": "^3.3.4",
"vue-router": "^4.2.4",
"ethers": "^6.8.0",
"siwe": "^2.1.4"
"vue-router": "^4.2.4"
},
"devDependencies": {
"@faker-js/faker": "^8.1.0",
Expand Down Expand Up @@ -51,4 +53,4 @@
"vitest": "^0.34.4",
"vue-tsc": "^1.8.11"
}
}
}
97 changes: 48 additions & 49 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
<script setup lang='ts'>
<script setup lang="ts">
import { useAppStore } from '@/stores/app'
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import { useAppStore } from '@/stores/app'

const appStore = useAppStore()
function shortenEthereumAddress(address: string) {
if (address.length < 8) {
return address; // Address is too short to shorten.
return address // Address is too short to shorten.
}

const prefix = address.slice(0, 6);
const suffix = address.slice(-4);
const prefix = address.slice(0, 6)
const suffix = address.slice(-4)

return `${prefix}...${suffix}`;
return `${prefix}...${suffix}`
}
</script>

<template>
<header>
<img alt='Vue logo' class='logo' src='@/assets/logo.svg' width='125' height='125' />
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />

<div>
<HelloWorld msg='Poems, Poems, Everywhere; Very, very, soon!' />
<p v-if='appStore.getToken' class='text-right text-xl'>Welcome {{ shortenEthereumAddress(appStore.getUser.eth_address)}}</p>
<HelloWorld msg="Poems, Poems, Everywhere; Very, very, soon!" />
<p v-if="appStore.getToken" class="text-right text-xl">Welcome {{ shortenEthereumAddress(appStore.getUser.eth_address) }}</p>
<nav>
<RouterLink to='/'>Home</RouterLink>
<RouterLink to='/poems/create' v-if='appStore.getToken'>Create Poem</RouterLink>
<RouterLink to='/login' v-if='!appStore.getToken'>Login</RouterLink>
<RouterLink to='/account' v-if='appStore.getToken'>My Account</RouterLink>
<a v-if='appStore.getToken' @click.prevent='appStore.setToken("")'>Logout</a>

<RouterLink to="/">Home</RouterLink>
<RouterLink to="/poems/create" v-if="appStore.getToken">Create Poem</RouterLink>
<RouterLink to="/login" v-if="!appStore.getToken">Login</RouterLink>
<RouterLink to="/account" v-if="appStore.getToken">My Account</RouterLink>
<a v-if="appStore.getToken" @click.prevent="appStore.setToken('')">Logout</a>
</nav>
</div>
</header>
Expand All @@ -38,60 +37,60 @@ function shortenEthereumAddress(address: string) {

<style scoped>
header {
width: 100%;
line-height: 1.5;
max-height: 100vh;
width: 100%;
line-height: 1.5;
max-height: 100vh;
}

.logo {
display: block;
margin: 0 auto 2rem;
display: block;
margin: 0 auto 2rem;
}

nav {
display: flex;
justify-content: flex-end;
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
display: flex;
justify-content: flex-end;
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}

nav a.router-link-exact-active {
color: var(--color-text);
color: var(--color-text);
}

nav a.router-link-exact-active:hover {
background-color: transparent;
background-color: transparent;
}

nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}

nav a:first-of-type {
border: 0;
border: 0;
}

@media (min-width: 1024px) {
header {
display: flex;
justify-content: space-between;
}

.logo {
margin: 0 2rem 0 0;
}

nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;

padding: 1rem 0;
margin-top: 1rem;
}
header {
display: flex;
justify-content: space-between;
}

.logo {
margin: 0 2rem 0 0;
}

nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;

padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
Loading
Loading