Skip to content

Commit 90a8cf5

Browse files
author
JohnRay1997
committedJun 1, 2021
Final
1 parent 811d0f1 commit 90a8cf5

12 files changed

+453
-153
lines changed
 

‎package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": {
1111
"core-js": "^3.6.5",
1212
"uid": "^2.0.0",
13-
"vue": "^3.0.0",
13+
"vue": "^3.0.11",
1414
"vue-router": "^4.0.0-0",
1515
"vuex": "^4.0.0-0"
1616
},

‎src/App.vue

+79-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
<template>
2-
<div class="app" v-if="invoicesLoaded">
3-
<Navigation />
4-
<div class="app-content flex flex-column">
5-
<NewInvoice v-if="newInvoice" />
6-
<router-view />
2+
<div v-if="invoicesLoaded">
3+
<div class="app flex" v-if="!mobile">
4+
<Navigation />
5+
<div class="app-content flex flex-column">
6+
<Modal v-if="modalActive" />
7+
<transition name="invoice">
8+
<NewInvoice v-if="newInvoice" />
9+
</transition>
10+
<router-view />
11+
</div>
12+
</div>
13+
<div class="mobile-message flex" v-else>
14+
<h2>Sorry, this app is not supported on Mobile Devices</h2>
15+
<p>To use this app, please use a computer or Tablet</p>
716
</div>
817
</div>
918
</template>
@@ -12,30 +21,43 @@
1221
import { mapActions, mapState } from "vuex";
1322
import Navigation from "./components/Navigation";
1423
import NewInvoice from "./components/NewInvoice";
24+
import Modal from "./components/Modal";
1525
export default {
1626
name: "App",
1727
components: {
1828
Navigation,
1929
NewInvoice,
30+
Modal,
2031
},
2132
data() {
2233
return {
23-
testing: null,
34+
windownWidth: null,
35+
mobile: null,
2436
};
2537
},
2638
created() {
2739
this.getInvoiceData();
40+
window.addEventListener("resize", this.checkScreen);
2841
},
2942
methods: {
30-
...mapActions({
31-
getInvoiceData: "GET_INVOICES",
32-
}),
43+
...mapActions(["GET_INVOICES"]),
44+
45+
getInvoiceData() {
46+
this.GET_INVOICES();
47+
},
48+
49+
checkScreen() {
50+
this.windownWidth = window.innerWidth;
51+
if (this.windownWidth <= 750) {
52+
this.mobile = true;
53+
return;
54+
}
55+
this.mobile = false;
56+
return;
57+
},
3358
},
3459
computed: {
35-
...mapState({
36-
newInvoice: "newInvoice",
37-
invoicesLoaded: "invoicesLoaded",
38-
}),
60+
...mapState(["newInvoice", "invoicesLoaded", "modalActive"]),
3961
},
4062
};
4163
</script>
@@ -50,17 +72,47 @@ export default {
5072
font-family: "Poppins", sans-serif;
5173
}
5274
75+
// animated invoice
76+
.invoice-enter-active,
77+
.invoice-leave-active {
78+
transition: 0.8s ease all;
79+
}
80+
81+
.invoice-enter-from,
82+
.invoice-leave-to {
83+
transform: translateX(-700px);
84+
}
85+
5386
.app {
5487
background-color: #141625;
55-
display: flex;
5688
min-height: 100vh;
89+
flex-direction: column;
90+
@media (min-width: 900px) {
91+
flex-direction: row;
92+
}
5793
5894
.app-content {
95+
padding: 0 20px;
5996
flex: 1;
6097
position: relative;
6198
}
6299
}
63100
101+
.mobile-message {
102+
flex-direction: column;
103+
text-align: center;
104+
padding: 20px;
105+
height: 100vh;
106+
justify-content: center;
107+
align-items: center;
108+
background-color: #141625;
109+
color: #fff;
110+
111+
p {
112+
margin-top: 16px;
113+
}
114+
}
115+
64116
// button styling
65117
66118
button,
@@ -86,6 +138,14 @@ button,
86138
background-color: #7c5dfa;
87139
}
88140
141+
.green {
142+
background-color: #33d69f;
143+
}
144+
145+
.orange {
146+
background-color: #ff8f00;
147+
}
148+
89149
// utility classes
90150
91151
.flex {
@@ -98,9 +158,13 @@ button,
98158
99159
.container {
100160
width: 100%;
101-
padding-top: 72px;
161+
padding: 40px 10px;
102162
max-width: 850px;
103163
margin: 0 auto;
164+
165+
@media (min-width: 800px) {
166+
padding-top: 72px;
167+
}
104168
}
105169
106170
.nav-link {
16.3 KB
Loading
+1
Loading

‎src/components/Invoice.vue

+4-17
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,7 @@
22
<router-link :to="{ name: 'Invoice', params: { invoiceId: invoice.invoiceId } }" class="invoice flex">
33
<div class="left flex">
44
<span class="tracking-number">#{{ invoice.invoiceId }}</span>
5-
<span class="due-date"
6-
>Due
7-
{{
8-
new Date(invoice.paymentDueDateUnix).toLocaleDateString("en-us", {
9-
year: "numeric",
10-
month: "short",
11-
day: "numeric",
12-
})
13-
}}</span
14-
>
5+
<span class="due-date">Due {{ invoice.paymentDueDate }}</span>
156
<span class="person">{{ invoice.clientName }}</span>
167
</div>
178
<div class="right flex">
@@ -55,14 +46,8 @@ export default {
5546
align-items: center;
5647
5748
.left {
49+
align-items: center;
5850
flex-basis: 60%;
59-
}
60-
61-
.right {
62-
flex-basis: 40%;
63-
}
64-
65-
.left {
6651
gap: 16px;
6752
span {
6853
flex: 1;
@@ -74,6 +59,8 @@ export default {
7459
}
7560
7661
.right {
62+
gap: 16px;
63+
flex-basis: 40%;
7764
align-items: center;
7865
7966
.price {

‎src/components/Modal.vue

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,28 @@
1111
</template>
1212

1313
<script>
14+
import { mapMutations, mapState } from "vuex";
1415
export default {
1516
methods: {
17+
...mapMutations(["TOGGLE_INVOICE", "TOGGLE_EDITING_INVOICE", "TOGGLE_MODAL"]),
18+
1619
closeModal() {
17-
this.$emit("close-modal");
20+
this.TOGGLE_MODAL();
1821
},
1922
2023
closeInvoice() {
21-
this.$store.commit("TOGGLE_INVOICE");
24+
this.TOGGLE_MODAL();
25+
this.TOGGLE_INVOICE();
26+
// only toggling editing invoice
27+
// if currently being edited
28+
if (this.editInvoice) {
29+
this.TOGGLE_EDITING_INVOICE();
30+
}
2231
},
2332
},
33+
computed: {
34+
...mapState(["editInvoice"]),
35+
},
2436
};
2537
</script>
2638

‎src/components/Navigation.vue

+15-28
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<template>
2-
<header>
2+
<header class="flex">
33
<div class="branding">
4-
<img src="@/assets/Logo.png" alt="" />
4+
<img src="@/assets/file-invoice-dollar-solid.png" alt="" />
55
</div>
6-
<hr />
7-
<img class="profile" src="@/assets/profile.jpeg" alt="" />
86
</header>
97
</template>
108

@@ -14,42 +12,31 @@ export default {};
1412

1513
<style lang="scss" scoped>
1614
header {
17-
border-radius: 0 20px 20px 0;
18-
min-width: 90px;
19-
align-items: center;
20-
display: flex;
21-
flex-direction: column;
22-
min-height: 100%;
15+
z-index: 99;
16+
// align-items: center;
17+
flex-direction: row;
2318
color: #fff;
2419
background-color: #1e2139;
20+
@media (min-width: 900px) {
21+
min-height: 100%;
22+
flex-direction: column;
23+
min-width: 90px;
24+
border-radius: 0 20px 20px 0;
25+
}
2526
}
2627
2728
.branding {
2829
border-radius: 0 20px 20px 0;
2930
padding: 24px;
3031
display: flex;
3132
justify-content: center;
32-
width: 100%;
3333
background-color: #7c5dfa;
3434
img {
35-
width: 30px;
35+
width: auto;
3636
height: 30px;
3737
}
38-
}
39-
40-
hr {
41-
margin-top: auto;
42-
width: 100%;
43-
height: 1px;
44-
border-color: #979797;
45-
}
46-
47-
.profile {
48-
margin: 20px 0;
49-
50-
object-fit: cover;
51-
width: 40px;
52-
height: 40px;
53-
border-radius: 50%;
38+
@media (min-width: 900px) {
39+
width: 100%;
40+
}
5441
}
5542
</style>

0 commit comments

Comments
 (0)
Please sign in to comment.