Fadikkop commited on
Commit
90c32df
·
verified ·
1 Parent(s): eac69cf

Immernoch: die verschiedenen Seiten der Anwendungen werden über bzw. untereinander angezeigt, aber es soll natürlich immer nur die Aktuelle Ansicht zu sehen sein. Außerdem soll in der Timeline die aktuelle Zeit mit einer Linie markiert werden.

Browse files
Files changed (2) hide show
  1. script.js +57 -6
  2. style.css +3 -3
script.js CHANGED
@@ -127,16 +127,23 @@ function switchView(view) {
127
  btn.classList.toggle('active', btn.dataset.view === view);
128
  });
129
 
130
- // Update views
131
  document.querySelectorAll('.view').forEach(v => {
132
- v.classList.toggle('active', v.id === `${view}-view`);
 
133
  });
134
 
 
 
 
 
 
 
 
135
  if (view === 'timeline') {
136
  renderTimeline();
137
  }
138
  }
139
-
140
  // Task Management
141
  function addTask(task) {
142
  const newTask = {
@@ -454,15 +461,59 @@ function renderTimeline() {
454
  // Render scheduled tasks
455
  renderScheduledTasks();
456
  }
457
-
458
  function highlightCurrentHour() {
459
  const now = new Date();
460
  const currentHour = now.getHours();
461
- const hourElement = document.querySelector(`.timeline-hour[data-hour="${currentHour}"]`);
 
 
 
 
 
462
 
 
463
  if (hourElement) {
464
  hourElement.classList.add('bg-gray-750');
465
- hourElement.classList.remove('bg-gray-800');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  }
467
  }
468
  function renderScheduledTasks() {
 
127
  btn.classList.toggle('active', btn.dataset.view === view);
128
  });
129
 
130
+ // Hide all views first
131
  document.querySelectorAll('.view').forEach(v => {
132
+ v.classList.remove('active');
133
+ v.style.display = 'none';
134
  });
135
 
136
+ // Show only the active view
137
+ const activeView = document.getElementById(`${view}-view`);
138
+ if (activeView) {
139
+ activeView.style.display = 'block';
140
+ activeView.classList.add('active');
141
+ }
142
+
143
  if (view === 'timeline') {
144
  renderTimeline();
145
  }
146
  }
 
147
  // Task Management
148
  function addTask(task) {
149
  const newTask = {
 
461
  // Render scheduled tasks
462
  renderScheduledTasks();
463
  }
 
464
  function highlightCurrentHour() {
465
  const now = new Date();
466
  const currentHour = now.getHours();
467
+ const currentMinute = now.getMinutes();
468
+
469
+ // Highlight current hour
470
+ document.querySelectorAll('.timeline-hour').forEach(el => {
471
+ el.classList.remove('bg-gray-750');
472
+ });
473
 
474
+ const hourElement = document.querySelector(`.timeline-hour[data-hour="${currentHour}"]`);
475
  if (hourElement) {
476
  hourElement.classList.add('bg-gray-750');
477
+ }
478
+
479
+ // Add current time indicator line
480
+ document.getElementById('current-time-indicator')?.remove();
481
+
482
+ const timelineContainer = document.getElementById('timeline-hours');
483
+ if (timelineContainer) {
484
+ const indicator = document.createElement('div');
485
+ indicator.id = 'current-time-indicator';
486
+ indicator.style.position = 'absolute';
487
+ indicator.style.left = '0';
488
+ indicator.style.right = '0';
489
+ indicator.style.height = '2px';
490
+ indicator.style.backgroundColor = '#ef4444';
491
+ indicator.style.zIndex = '10';
492
+
493
+ const hourElement = document.querySelector(`.timeline-hour[data-hour="${currentHour}"]`);
494
+ if (hourElement) {
495
+ const hourTop = hourElement.offsetTop;
496
+ const hourHeight = hourElement.offsetHeight;
497
+ const minutePosition = (currentMinute / 60) * hourHeight;
498
+
499
+ indicator.style.top = `${hourTop + minutePosition}px`;
500
+ timelineContainer.appendChild(indicator);
501
+
502
+ // Add time label
503
+ const timeLabel = document.createElement('div');
504
+ timeLabel.textContent = now.toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit' });
505
+ timeLabel.style.position = 'absolute';
506
+ timeLabel.style.left = '0';
507
+ timeLabel.style.top = `${hourTop + minutePosition - 10}px`;
508
+ timeLabel.style.backgroundColor = '#ef4444';
509
+ timeLabel.style.color = 'white';
510
+ timeLabel.style.padding = '2px 8px';
511
+ timeLabel.style.borderRadius = '4px';
512
+ timeLabel.style.fontSize = '12px';
513
+ timeLabel.style.zIndex = '10';
514
+
515
+ indicator.appendChild(timeLabel);
516
+ }
517
  }
518
  }
519
  function renderScheduledTasks() {
style.css CHANGED
@@ -61,8 +61,8 @@
61
  .timeline-hour {
62
  @apply relative border-b border-gray-700;
63
  min-height: 60px;
 
64
  }
65
-
66
  .timeline-task-block {
67
  @apply absolute rounded-lg cursor-move transition-all;
68
  transition: all 0.2s ease;
@@ -103,11 +103,11 @@ input[type="color"] {
103
 
104
  /* View transitions */
105
  .view {
106
- @apply hidden;
107
  }
108
 
109
  .view.active {
110
- @apply block;
111
  animation: fadeIn 0.3s ease-in-out;
112
  }
113
  @keyframes fadeIn {
 
61
  .timeline-hour {
62
  @apply relative border-b border-gray-700;
63
  min-height: 60px;
64
+ position: relative;
65
  }
 
66
  .timeline-task-block {
67
  @apply absolute rounded-lg cursor-move transition-all;
68
  transition: all 0.2s ease;
 
103
 
104
  /* View transitions */
105
  .view {
106
+ display: none;
107
  }
108
 
109
  .view.active {
110
+ display: block;
111
  animation: fadeIn 0.3s ease-in-out;
112
  }
113
  @keyframes fadeIn {