Skip to content

Commit 3b2691e

Browse files
author
Phil Wing
committed
Fixed calendar bug, updated some data entry ui
1 parent 71f74a3 commit 3b2691e

File tree

13 files changed

+72
-41
lines changed

13 files changed

+72
-41
lines changed

src/api.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,28 @@
22
import { instance as axios } from './axios'; // Import your configured Axios axios
33
import store from './store'; // Import the Vuex store to access sessionId and other state
44

5+
function verify(){
6+
7+
}
8+
59
// API call to create a new list
610
export async function createList(listData) {
711
const { sessionId } = store.state;
8-
9-
console.log(axios);
10-
12+
console.log("sessionId: "+sessionId);
13+
//console.log(axios);
1114

1215
if (!sessionId) {
1316
throw new Error('No session ID found. User may not be authenticated.');
1417
}
1518

19+
20+
1621
try {
1722
const response = await axios.post(
1823
'/lists/',
19-
listData,
20-
{ headers: { 'Authorization': `Bearer ${sessionId}` } }
24+
{ headers: { 'Authorization': `Bearer ${sessionId}` },
25+
body: JSON.stringify(listData),
26+
},
2127
);
2228
return response.data;
2329
} catch (error) {

src/components/CalendarComponents/DailyCalendar.vue

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
</template>
2121

2222
<script>
23+
import {getTodayDate} from '../../date.js';
2324
export default {
2425
name: "DailyCalendar",
2526
props: {
@@ -38,14 +39,12 @@ export default {
3839
3940
computed: {
4041
combinedEvents() {
41-
const today = this.getTodayDate();
42+
const today = getTodayDate();
4243
const events = [
4344
...this.list1.map((event) => ({ ...event, listType: "list1" })),
4445
...this.list2.map((event) => ({ ...event, listType: "list2" })),
4546
];
4647
47-
console.log('Computed Combined Events:', events.filter((event) => event.scheduledDate === today));
48-
4948
return events.filter((event) => event.scheduledDate === today);
5049
},
5150
},
@@ -70,6 +69,8 @@ export default {
7069
},
7170
7271
getEventStyle(event) {
72+
console.log(event);
73+
console.log(event.scheduledTime);
7374
const startHour = this.parseTime(event.scheduledTime);
7475
let endHour = startHour + event.taskTimeEstimate / 60;
7576
@@ -98,16 +99,10 @@ export default {
9899
this.$emit("event-clicked", { event, listType: event.listType, index });
99100
},
100101
101-
getTodayDate() {
102-
const today = new Date();
103-
const year = today.getFullYear();
104-
const month = (today.getMonth() + 1).toString().padStart(2, "0");
105-
const day = today.getDate().toString().padStart(2, "0");
106-
return `${year}-${month}-${day}`; // Format: YYYY-MM-DD
107-
},
108-
109102
// Updated parseTime method to handle various formats like '2:00pm', '09:59am', '9:59am'
110103
parseTime(time) {
104+
if(time==null)
105+
time=Date.now().toString();
111106
const regex = /(\d{1,2}):(\d{2})(am|pm)/i;
112107
const match = time.trim().match(regex);
113108
if (!match) return 0; // Default if time format is invalid

src/components/DashboardComponents/MultiplayerToggle.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<label class="slider-label">{{ label }}</label>
99
<div class="slider" @click="toggleSlider" :aria-checked="isChecked" role="switch">
1010
<!--Needs to switch between an icon of one person and multiple -->
11-
<div class="slider-tab" :class="{ 'slider-checked': isChecked }">{{ isChecked ? 'Yes' : 'No' }}</div>
11+
<div class="slider-tab" :class="{ 'slider-checked': isChecked }">{{ isChecked ? Yes : No }}</div>
1212
</div>
1313
</div>
1414
</template>
@@ -18,7 +18,7 @@ export default {
1818
props: {
1919
label: {
2020
type: String,
21-
default: 'Yes/No',
21+
default: '',
2222
},
2323
modelValue: {
2424
type: Boolean,
@@ -38,8 +38,7 @@ export default {
3838
methods: {
3939
emitSliderChange() {
4040
this.$emit('update:modelValue', this.isChecked); // Emit for v-model binding
41-
console.log("toggling");
42-
},
41+
},
4342
toggleSlider() {
4443
this.isChecked = !this.isChecked;
4544
this.emitSliderChange(); // Emit the change

src/components/ListItems/DateInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ export default {
155155
}
156156
157157
.date-input {
158-
background-color: #1e1e1e;
159-
color: #cfcfcf;
160-
border: 1px solid #4a4a4a;
158+
background-color: #343541;
159+
color: white;
160+
border: 1px solid white;
161161
border-radius: 4px;
162162
padding: 8px;
163163
width: 90%;

src/components/ListItems/ListElement.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
33

44
<div class="template-container">
5-
<div class="input-grid">
5+
<div v-if="!multiplayer" class="input-grid">
66
<div class='title' :contenteditable="parentPage !== 'dashboard'" ref="titleInput" @keydown.enter.prevent=""
77
spellcheck="false">
88
{{ listName }}
@@ -79,6 +79,10 @@ export default {
7979
listName: {
8080
type: String,
8181
required: false
82+
},
83+
multiplayer: {
84+
type: Boolean,
85+
required: false
8286
}
8387
},
8488
data() {
@@ -128,6 +132,10 @@ export default {
128132
},
129133
mounted() {
130134
135+
},
136+
unmounted(){
137+
this.itemsArray.length = 0;
138+
this.emitList();
131139
},
132140
components: {
133141
DateInput,
@@ -176,6 +184,11 @@ export default {
176184
saveList() {
177185
//LATER Need to add some debounce time maybe 750 ms to only call the api once every 3/4s second and not spam the backend.
178186
//LATER Should also do the async call to save to the backend
187+
188+
189+
this.emitList();
190+
},
191+
emitList(){
179192
this.$emit("update:modelValue", this.itemsArray);
180193
},
181194
newList() {
@@ -184,7 +197,7 @@ export default {
184197
list_description: this.listDescription,
185198
list_items: JSON.stringify([
186199
{
187-
item_description: "Example item",
200+
item_description: "Exampleee item",
188201
item_duration: 30,
189202
recurring_item: false,
190203
},
@@ -212,7 +225,7 @@ export default {
212225
this.itemsArray.push(this.createTestItem("Bruh2"));
213226
214227
this.saveList();
215-
//this.newList();
228+
this.newList();
216229
//Call api get and load initial list
217230
218231
},

src/components/ListItems/MinuteInput.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ export default {
6868
}
6969
7070
.minute-input-field {
71-
background-color: #1e1e1e;
71+
background-color: #343541;
7272
color: #cfcfcf;
73-
border: 1px solid #4a4a4a;
73+
border: 1px solid white;
7474
border-radius: 4px;
7575
padding: 8px;
7676
width: 90%;

src/components/ListItems/TimeInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ export default {
153153
}
154154
155155
.time-input {
156-
background-color: #1e1e1e;
157-
color: #cfcfcf;
158-
border: 1px solid #4a4a4a;
156+
background-color: #343541;
157+
color: white;
158+
border: 1px solid white;
159159
border-radius: 4px;
160160
padding: 8px;
161161
width: 80%;

src/components/SidebarComponents/SideBar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
// { path: '/Lists', label: 'Lists' },
3030
// { path: '/Learn', label: 'Learn' },
3131
// { path: '/Type', label: 'Type' },
32-
// { path: '/About-me', label: 'About Me' },
32+
{ path: '/About-me', label: 'About Me' },
3333
// { path: '/Settings', label: 'Settings' },
3434
{ path: '/Login', label: 'Login' },
3535
];

src/date.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
3+
export function getTodayDate() {
4+
const today = new Date();
5+
const year = today.getFullYear();
6+
const month = (today.getMonth() + 1).toString().padStart(2, "0");
7+
const day = today.getDate().toString().padStart(2, "0");
8+
return `${year}-${month}-${day}`; // Format: YYYY-MM-DD
9+
}
10+
11+
12+

src/router/dashboardRoutes.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
import DashboardWorld from '../views/Dashboard.vue';
2+
import AboutMe from '@/views/AboutMe.vue';
23

34
export default [
45
{
56
path: '/',
67
name: 'dashboard',
78
component: DashboardWorld,
89
},
10+
{
11+
path: '/about-me',
12+
name: 'AboutMe',
13+
component: AboutMe
14+
},
915
];

0 commit comments

Comments
 (0)