some really basic styling out of the way, ready to build out UI
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<strong>We're sorry but budgit.client doesn't work properly without JavaScript
|
<strong>We're sorry but budgit.client doesn't work properly without JavaScript
|
||||||
enabled. Please enable it to continue.</strong>
|
enabled. Please enable it to continue.</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app" class="h-screen"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
<script type="module" src="./src/main.js"></script>
|
<script type="module" src="./src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<header>
|
<header class="text-slate-50">
|
||||||
<Navbar />
|
<Navbar />
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main class="text-slate-50 bg-stone-900 h-full">
|
||||||
<router-view />
|
<router-view />
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer class="text-slate-50 bg-stone-800">
|
||||||
<div>
|
<div>
|
||||||
Made with 💖 by CodeWorks
|
An <a href="https://github.com/annikyet">Annika</a> project.
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="component">
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
setup(){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -1,45 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<span class="navbar-text">
|
<span class="navbar-text">
|
||||||
<button
|
<button class="btn selectable text-success lighten-30 text-uppercase my-2 my-lg-0" @click="login"
|
||||||
class="btn selectable text-success lighten-30 text-uppercase my-2 my-lg-0"
|
v-if="!user.isAuthenticated">
|
||||||
@click="login"
|
|
||||||
v-if="!user.isAuthenticated"
|
|
||||||
>
|
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="dropdown my-2 my-lg-0" v-else>
|
<div class="" v-else>
|
||||||
<div
|
<div class="flex" id="authDropdown">
|
||||||
class="dropdown-toggle selectable"
|
<router-link :to="{ name: 'Account' }">
|
||||||
data-bs-toggle="dropdown"
|
<div class="flex">
|
||||||
aria-expanded="false"
|
<div v-if="account.picture" class="">
|
||||||
id="authDropdown"
|
<img :src="account.picture" alt="account photo" height="40" class="max-h-8" />
|
||||||
>
|
</div>
|
||||||
<div v-if="account.picture">
|
|
||||||
<img
|
|
||||||
:src="account.picture"
|
|
||||||
alt="account photo"
|
|
||||||
height="40"
|
|
||||||
class="rounded"
|
|
||||||
/>
|
|
||||||
<span class="mx-3 text-success lighten-30">{{ account.name }}</span>
|
<span class="mx-3 text-success lighten-30">{{ account.name }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="dropdown-menu p-0 list-group w-100"
|
|
||||||
aria-labelledby="authDropdown"
|
|
||||||
>
|
|
||||||
<router-link :to="{ name: 'Account' }">
|
|
||||||
<div class="list-group-item list-group-item-action hoverable">
|
|
||||||
Manage Account
|
|
||||||
</div>
|
|
||||||
</router-link>
|
</router-link>
|
||||||
<div
|
<div class="hover:text-green-300" @click="logout">
|
||||||
class="list-group-item list-group-item-action hoverable text-danger"
|
|
||||||
@click="logout"
|
|
||||||
>
|
|
||||||
<i class="mdi mdi-logout"></i>
|
<i class="mdi mdi-logout"></i>
|
||||||
logout
|
<!-- logout -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -69,15 +47,18 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
// @import "https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css";
|
||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
display: block;
|
display: block;
|
||||||
transform: scale(0);
|
transform: scale(0);
|
||||||
transition: all 0.15s linear;
|
transition: all 0.15s linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-menu.show {
|
.dropdown-menu.show {
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.hoverable {
|
.hoverable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark px-3">
|
<nav class="flex justify-between items-end w-screen bg-stone-800 p-2">
|
||||||
<router-link class="navbar-brand d-flex" :to="{ name: 'Home' }">
|
<div class="flex justify-start items-end">
|
||||||
<div class="d-flex flex-column align-items-center">
|
<router-link :to="{ name: 'Overview' }">
|
||||||
<img alt="logo" src="../assets/img/cw-logo.png" height="45" />
|
<h3 class="text-4xl mr-10 text-green-300 hover:text-slate-50">Budg.it</h3>
|
||||||
</div>
|
|
||||||
</router-link>
|
</router-link>
|
||||||
<button
|
<router-link :to="{ name: 'Transactions' }">
|
||||||
class="navbar-toggler"
|
<p class="hidden md:block">Transactions</p>
|
||||||
type="button"
|
|
||||||
data-bs-toggle="collapse"
|
|
||||||
data-bs-target="#navbarText"
|
|
||||||
aria-controls="navbarText"
|
|
||||||
aria-expanded="false"
|
|
||||||
aria-label="Toggle navigation"
|
|
||||||
>
|
|
||||||
<span class="navbar-toggler-icon" />
|
|
||||||
</button>
|
|
||||||
<div class="collapse navbar-collapse" id="navbarText">
|
|
||||||
<ul class="navbar-nav me-auto">
|
|
||||||
<li>
|
|
||||||
<router-link
|
|
||||||
:to="{ name: 'About' }"
|
|
||||||
class="btn text-success lighten-30 selectable text-uppercase"
|
|
||||||
>
|
|
||||||
About
|
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<!-- LOGIN COMPONENT HERE -->
|
|
||||||
<Login />
|
|
||||||
</div>
|
</div>
|
||||||
|
<Login class="hidden md:block" />
|
||||||
|
<div class="block md:hidden mdi mdi-menu"></div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -45,9 +30,11 @@ export default {
|
|||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-link {
|
.nav-link {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-nav .router-link-exact-active {
|
.navbar-nav .router-link-exact-active {
|
||||||
border-bottom: 2px solid var(--bs-success);
|
border-bottom: 2px solid var(--bs-success);
|
||||||
border-bottom-left-radius: 0;
|
border-bottom-left-radius: 0;
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
|
||||||
|
@layer components {
|
||||||
|
a {
|
||||||
|
@apply hover:text-green-300;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="component">
|
||||||
|
<h1>overviewpage</h1>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
setup(){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<div class="component">
|
||||||
|
<h1>transactionspage</h1>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
setup(){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -8,13 +8,13 @@ function loadPage(page) {
|
|||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
name: 'Home',
|
name: 'Overview',
|
||||||
component: loadPage('HomePage')
|
component: loadPage('OverviewPage')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/about',
|
path: '/transactions',
|
||||||
name: 'About',
|
name: 'Transactions',
|
||||||
component: loadPage('AboutPage')
|
component: loadPage('TransactionsPage')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/account',
|
path: '/account',
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import { Auth0Provider } from '@bcwdev/auth0provider'
|
||||||
|
import { accountService } from '../services/AccountService'
|
||||||
|
import { categoriesService } from '../services/CategoriesService'
|
||||||
|
import { transactionsService } from '../services/TransactionsService'
|
||||||
|
import BaseController from '../utils/BaseController'
|
||||||
|
|
||||||
|
// export class CategoriesController extends BaseController {
|
||||||
|
// constructor() {
|
||||||
|
// super('api/categories')
|
||||||
|
// this.router
|
||||||
|
// .use(Auth0Provider.getAuthorizedUserInfo)
|
||||||
|
// .post('', this.create)
|
||||||
|
// .get('', this.getAll)
|
||||||
|
// .get('/:id', this.getById)
|
||||||
|
// .put('/:id', this.modify)
|
||||||
|
// .delete('/:id', this.remove)
|
||||||
|
// }
|
||||||
|
|
||||||
|
export class TransactionsController extends BaseController {
|
||||||
|
constructor() {
|
||||||
|
super('api/transactions')
|
||||||
|
this.router
|
||||||
|
.use(Auth0Provider.getAuthorizedUserInfo)
|
||||||
|
.post('', this.create)
|
||||||
|
.get('', this.getAll)
|
||||||
|
}
|
||||||
|
|
||||||
|
async create(req, res, next) {
|
||||||
|
try {
|
||||||
|
req.body.accountId = req.userInfo.id
|
||||||
|
const dbTransaction = await transactionsService.create(req.body)
|
||||||
|
return res.send(dbTransaction)
|
||||||
|
} catch (error) {
|
||||||
|
next(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAll(req, res, next) {
|
||||||
|
try {
|
||||||
|
const allTransactions = await transactionsService.getAll(req.userInfo.id)
|
||||||
|
return res.send(allTransactions)
|
||||||
|
} catch (error) {
|
||||||
|
next(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { dbContext } from '../db/DbContext'
|
||||||
|
import { BadRequest } from '../utils/Errors'
|
||||||
|
|
||||||
|
class TransactionsService {
|
||||||
|
async create(newTransaction) {
|
||||||
|
const dbTransaction = await dbContext.Transactions.create(newTransaction)
|
||||||
|
if (!dbTransaction) {
|
||||||
|
throw new BadRequest("transaction does not exist")
|
||||||
|
}
|
||||||
|
return dbTransaction
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAll(accountId) {
|
||||||
|
if (!accountId) {
|
||||||
|
throw new BadRequest("User not logged in")
|
||||||
|
}
|
||||||
|
const allTransactions = await dbContext.Transactions.find({accountId: accountId})
|
||||||
|
return allTransactions
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export const transactionsService = new TransactionsService()
|
||||||
Reference in New Issue
Block a user