diff --git a/anwendung/src/components/CalenderView.jsx b/anwendung/src/components/CalenderView.jsx index 35ca87a..3cee429 100644 --- a/anwendung/src/components/CalenderView.jsx +++ b/anwendung/src/components/CalenderView.jsx @@ -9,15 +9,38 @@ export default function CalenderView(p) { function mouse_click(e) { let y_window = e.clientY; let y_target_offset = e.target.getBoundingClientRect().top; - let row = Math.floor((y_window - y_target_offset) / 3) + 1 - let current_list = entries[e.currentTarget.id]; - current_list.push(new CalenderEntry(row - 10, row + 5)); - setT(!t); + let row = Math.floor((y_window - y_target_offset) / 10)+1 + if(row <= 98 && row > 3) { + let current_list = entries[e.currentTarget.id]; + let free = true; + for(let i = 0; i < current_list.length; i++) + { + let current = current_list[i]; + + for(let r = row; r < row + 2; r++) + { + for(let s = current.start_point; s < current.end_point; s++) + { + if (s === r) + { + free = false; + break; + } + } + } + } + + if(free) { + current_list.push(new CalenderEntry(row, row + 2)); + setT(!t); + } + } } function internal_to_time(internal) { - internal /= 15 + internal -= 4 + internal /= 4 let integer = Math.floor(internal) let decimal = internal.toFixed(2); let minutes = Math.floor((decimal - integer) * 60); @@ -30,14 +53,14 @@ export default function CalenderView(p) {
Montag
- {entries["mo"].map(d => (
+ {entries["mo"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

))}
Dienstag
- {entries["tu"].map(d => (
+ {entries["tu"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

@@ -45,7 +68,7 @@ export default function CalenderView(p) {
Mittwoch
- {entries["we"].map(d => (
+ {entries["we"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

@@ -53,7 +76,7 @@ export default function CalenderView(p) {
Donnerstag
- {entries["th"].map(d => (
+ {entries["th"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

@@ -61,14 +84,14 @@ export default function CalenderView(p) {
Freitag
- {entries["fr"].map(d => (
+ {entries["fr"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

))}
Samstag
- {entries["sa"].map(d => (
+ {entries["sa"].map(d => (

{internal_to_time(d.start_point)}

{internal_to_time(d.end_point)}

))} diff --git a/anwendung/src/styles/globals.css b/anwendung/src/styles/globals.css index 6438ccc..3df2942 100644 --- a/anwendung/src/styles/globals.css +++ b/anwendung/src/styles/globals.css @@ -199,7 +199,7 @@ Calender View Test */ width: 500px; - height: 1110px; + height: 1000px; /* End Test */ @@ -220,7 +220,7 @@ Calender View background-color: white; display: grid; grid-template-columns: 100%; - grid-template-rows: repeat(370, 3px); + grid-template-rows: repeat(100, 10px); } .spalte .wochen-tag @@ -235,7 +235,7 @@ Calender View justify-content: center; grid-row-start: 1; - grid-row-end: 10; + grid-row-end: 4; } .entry @@ -252,5 +252,5 @@ Calender View .entry p { color: white; - font-size: 10px; + font-size: 5px; } \ No newline at end of file