diff --git a/resources/views/front/career/intern_dashboard.blade.php b/resources/views/front/career/intern_dashboard.blade.php index 7f93bfc..e57296e 100644 --- a/resources/views/front/career/intern_dashboard.blade.php +++ b/resources/views/front/career/intern_dashboard.blade.php @@ -394,8 +394,42 @@ Henüz hiç commit bulunamadı veya deponuz tanımlanmadı. Lütfen deponuzu tanımlayın ve commitlerinizi gönderin. - @@ -459,12 +493,15 @@ }); const githubRepoUrl = @json($intern->github_repo); + let commitDays = []; + let activeDayIndex = 0; function loadGithubCommits() { const loader = document.getElementById('commits-loader'); const errorEl = document.getElementById('commits-error'); const emptyEl = document.getElementById('commits-empty'); - const timelineEl = document.getElementById('commits-timeline'); + const navEl = document.getElementById('journal-carousel-nav'); + const containerEl = document.getElementById('commits-timeline-container'); if (!githubRepoUrl) { emptyEl.classList.remove('hidden'); @@ -474,8 +511,9 @@ loader.classList.remove('hidden'); errorEl.classList.add('hidden'); emptyEl.classList.add('hidden'); - timelineEl.classList.add('hidden'); - timelineEl.innerHTML = ''; + navEl.classList.add('hidden'); + containerEl.classList.add('hidden'); + commitDays = []; // Parse owner and repo let repoClean = githubRepoUrl.replace(/https?:\/\/(www\.)?github\.com\//i, ''); @@ -528,53 +566,27 @@ const sortedDates = Object.keys(grouped).sort(); - timelineEl.classList.remove('hidden'); - - sortedDates.forEach((date, index) => { - const dayNum = index + 1; - const dayCommits = grouped[date]; - - // Format date as DD.MM.YYYY + commitDays = sortedDates.map((date, index) => { const dateParts = date.split('-'); - const formattedDate = `${dateParts[2]}.${dateParts[1]}.${dateParts[0]}`; - - // Generate commits list HTML - let commitsListHtml = ''; - dayCommits.forEach(c => { - const message = c.commit.message; - const authorDate = new Date(c.commit.author.date); - const timeStr = authorDate.toLocaleTimeString('tr-TR', { hour: '2-digit', minute: '2-digit' }); - const shaShort = c.sha.substring(0, 7); - const commitUrl = c.html_url; - - commitsListHtml += ` -
-
- ${timeStr} - - ${shaShort} - -
-

${escapeHtml(message)}

-
- `; - }); - - const dayCardHtml = ` -
-
-
- ${dayNum}. Gün - ${formattedDate} -
-
- ${commitsListHtml} -
-
-
- `; - timelineEl.insertAdjacentHTML('beforeend', dayCardHtml); + return { + date: date, + dayNum: index + 1, + formattedDate: `${dateParts[2]}.${dateParts[1]}.${dateParts[0]}`, + commits: grouped[date] + }; }); + + if (commitDays.length === 0) { + emptyEl.classList.remove('hidden'); + return; + } + + activeDayIndex = 0; + navEl.classList.remove('hidden'); + containerEl.classList.remove('hidden'); + + renderDayTabs(); + renderActiveDay(); }) .catch(err => { loader.classList.add('hidden'); @@ -583,6 +595,109 @@ }); } + function renderDayTabs() { + const container = document.getElementById('day-tabs-container'); + container.innerHTML = ''; + + commitDays.forEach((day, index) => { + const isActive = index === activeDayIndex; + const activeClass = isActive + ? 'text-blue-700 bg-blue-50 border border-blue-200 font-extrabold shadow-sm' + : 'bg-white hover:bg-slate-50 text-slate-600 border border-slate-200/60 font-semibold hover:text-blue-600'; + + const tab = document.createElement('button'); + tab.type = 'button'; + tab.className = `px-5 py-2 rounded-xl transition-all flex flex-col items-center justify-center ${activeClass}`; + tab.innerHTML = ` + ${day.dayNum}. Gün + ${day.formattedDate} + `; + tab.onclick = () => { + activeDayIndex = index; + renderDayTabs(); + renderActiveDay(); + }; + container.appendChild(tab); + }); + + // Handle scroll to active element + const activeTab = container.children[activeDayIndex]; + if (activeTab) { + activeTab.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' }); + } + + // Disable/enable arrows + const prevBtn = document.getElementById('prev-day-btn'); + const nextBtn = document.getElementById('next-day-btn'); + + prevBtn.disabled = activeDayIndex === 0; + prevBtn.classList.toggle('opacity-40', activeDayIndex === 0); + prevBtn.classList.toggle('cursor-not-allowed', activeDayIndex === 0); + + nextBtn.disabled = activeDayIndex === commitDays.length - 1; + nextBtn.classList.toggle('opacity-40', activeDayIndex === commitDays.length - 1); + nextBtn.classList.toggle('cursor-not-allowed', activeDayIndex === commitDays.length - 1); + } + + function renderActiveDay() { + const card = document.getElementById('active-day-card'); + + // Smooth transition + card.style.opacity = '0.3'; + card.style.transform = 'translateY(5px)'; + + setTimeout(() => { + const day = commitDays[activeDayIndex]; + + document.getElementById('active-day-title').textContent = `${day.dayNum}. Gün`; + document.getElementById('active-day-date').innerHTML = ` ${day.formattedDate}`; + document.getElementById('active-day-commit-count').textContent = `${day.commits.length} Commit`; + + const eventsContainer = document.getElementById('timeline-events'); + eventsContainer.innerHTML = ''; + + day.commits.forEach(c => { + const message = c.commit.message; + const authorDate = new Date(c.commit.author.date); + const timeStr = authorDate.toLocaleTimeString('tr-TR', { hour: '2-digit', minute: '2-digit' }); + const shaShort = c.sha.substring(0, 7); + const commitUrl = c.html_url; + + const eventHtml = ` +
+ +
+
+
+ +
+
+ ${timeStr} + + ${shaShort} + +
+

${escapeHtml(message)}

+
+
+ `; + eventsContainer.insertAdjacentHTML('beforeend', eventHtml); + }); + + card.style.opacity = '1'; + card.style.transform = 'translateY(0)'; + }, 150); + } + + function navigateDay(dir) { + const newIndex = activeDayIndex + dir; + if (newIndex >= 0 && newIndex < commitDays.length) { + activeDayIndex = newIndex; + renderDayTabs(); + renderActiveDay(); + } + } + function escapeHtml(text) { if (!text) return ''; return text @@ -679,6 +794,13 @@ .tab-btn.active span.text-slate-800 { color: #1e40af !important; } + .no-scrollbar::-webkit-scrollbar { + display: none; + } + .no-scrollbar { + -ms-overflow-style: none; + scrollbar-width: none; + } @endpush @endsection