Skip to content

Commit ed8da0a

Browse files
committed
dynamic ui
1 parent aa97aaa commit ed8da0a

File tree

4 files changed

+54
-8
lines changed

4 files changed

+54
-8
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VUE_APP_API_BASE_URL=https://stevett.pythonanywhere.com
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL;

vue-frontend/warehouse-frontend/src/views/ModePage.vue

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
11
<script>
22
export default {
33
name: 'ModePage',
4+
data() {
5+
return {
6+
operationModes: [],
7+
groupedModes: {},
8+
}
9+
},
10+
mounted() {
11+
this.fetchModes();
12+
},
413
methods: {
14+
async fetchModes() {
15+
try {
16+
const response = await fetch(`/updates/modes.json`);
17+
const data = await response.json();
18+
//alert(data.operation_modes[0].name);
19+
this.operationModes = data.operation_modes;
20+
this.groupModesByCategory();
21+
} catch (error) {
22+
console.error("Error fetching modes:", error);
23+
}
24+
},
25+
groupModesByCategory() {
26+
this.groupedModes = this.operationModes.reduce((acc, mode) => {
27+
if (!acc[mode.category]) {
28+
acc[mode.category] = [];
29+
}
30+
acc[mode.category].push(mode);
31+
return acc;
32+
}, {});
33+
},
534
chooseMode(mode) {
635
// if (this.username) {
736
// this.$router.push("/mode"); // Navigate to Home after login
@@ -28,14 +57,14 @@ export default {
2857
<div class="col-md-2">
2958
<div class="card">
3059
<img src="../assets/work-in-progress.png" alt="Work in Progress" width="50" class="d-block mx-auto">
31-
<br/><p>Work in progress palleting</p>
60+
<p>Work in progress palleting</p>
3261
<button class="btn btn-outline-success w-100" @click="chooseMode('Work in progress palleting')">Start →</button>
3362
</div>
3463
</div>
3564
<div class="col-md-2">
3665
<div class="card">
3766
<img src="../assets/shipping-box.png" alt="Shipping Box" width="50" class="d-block mx-auto">
38-
<br/><p>Shipping box palleting</p>
67+
<p>Shipping box palleting</p>
3968
<button class="btn btn-outline-success w-100" @click="chooseMode('Shipping box palleting')">Start →</button>
4069
</div>
4170
</div>
@@ -49,15 +78,15 @@ export default {
4978
<div class="col-md-2">
5079
<div class="card">
5180
<img src="../assets/desktop.png" alt="Wiped Desktops" width="50" class="d-block mx-auto">
52-
<br/><p>Boxing (Wiped) Desktops for shipping</p>
81+
<p>Boxing (Wiped) Desktops for shipping</p>
5382
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing (Wiped) Desktops for shipping')">Start →</button>
5483
</div>
5584
</div>
5685

5786
<div class="col-md-2">
5887
<div class="card">
5988
<img src="../assets/desktop-imaged.png" alt="Imaged Desktops" width="50" class="d-block mx-auto">
60-
<br/><p>Boxing (Imaged) Desktops for shipping</p>
89+
<p>Boxing (Imaged) Desktops for shipping</p>
6190
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing (Imaged) Desktops for shipping')">Start →</button>
6291
</div>
6392
</div>
@@ -75,7 +104,7 @@ export default {
75104
<div class="col-md-2">
76105
<div class="card">
77106
<img src="../assets/laptop-imaged.png" alt="Imaged Laptops" width="50" class="d-block mx-auto">
78-
<br/><p>Boxing (Imaged) Laptops for shipping</p><br/>
107+
<p>Boxing (Imaged) Laptops for shipping</p>
79108
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing (Imaged) Laptops for shipping')">Start →</button>
80109
</div>
81110
</div>
@@ -87,23 +116,23 @@ export default {
87116
<div class="col-md-2">
88117
<div class="card">
89118
<img src="../assets/monitor.png" alt="Monitors" width="50" class="d-block mx-auto">
90-
<br/><p>Boxing monitors for shipping</p><br/>
119+
<p>Boxing monitors for shipping</p>
91120
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing monitors for shipping')">Start →</button>
92121
</div>
93122
</div>
94123

95124
<div class="col-md-2">
96125
<div class="card">
97126
<img src="../assets/phone.png" alt="Phones and Laptops" width="50" class="d-block mx-auto">
98-
<br/><p>Boxing (Wiped) phones and laptops for shipping</p>
127+
<p>Boxing (Wiped) phones and laptops for shipping</p>
99128
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing (Wiped) phones and laptops for shipping')">Start →</button>
100129
</div>
101130
</div>
102131

103132
<div class="col-md-2">
104133
<div class="card">
105134
<img src="../assets/money.png" alt="For Sale" width="50" class="d-block mx-auto">
106-
<br/><p>Boxing Desktops and Laptops for sale</p><br/>
135+
<p>Boxing Desktops and Laptops for sale</p>
107136
<button class="btn btn-outline-success w-100" @click="chooseMode('Boxing Desktops and Laptops for sale')">Start →</button>
108137
</div>
109138
</div>
@@ -124,6 +153,13 @@ export default {
124153
padding: 20px;
125154
border-radius: 10px;
126155
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
156+
display: flex;
157+
flex-direction: column;
158+
justify-content: space-between; /* Distribute space evenly between elements */
159+
height: 100%; /* Allow the card to stretch */
160+
}
161+
.card img {
162+
padding-bottom: 15px;
127163
}
128164
.btn-outline-success {
129165
border-color: #04A27D;

vue-frontend/warehouse-frontend/vue.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@ const { defineConfig } = require('@vue/cli-service')
22
module.exports = defineConfig({
33
transpileDependencies: true,
44
publicPath: '/turing-trust-warehouse-frontend/',
5+
devServer: {
6+
proxy: {
7+
"/updates": {
8+
target: "http://localhost:3000",
9+
changeOrigin: true,
10+
},
11+
},
12+
}
513
})

0 commit comments

Comments
 (0)