diff --git a/public/index.html b/public/index.html index be725d0..0cacc84 100644 --- a/public/index.html +++ b/public/index.html @@ -1127,6 +1127,21 @@

Error< }, FEEDBACK_DISMISS_DELAY); } + function showSuccessToast(message) { + // Show a temporary global success message (toast) + const toast = document.createElement('div'); + toast.className = 'fixed top-4 right-4 z-[100] flex items-start gap-2 rounded-lg border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-900 shadow-lg dark:border-green-900 dark:bg-green-950/30 dark:text-green-400 max-w-md animate-slide-in'; + toast.innerHTML = ` + +
${escapeHtml(message)}
+ `; + document.body.appendChild(toast); + setTimeout(() => { + toast.classList.add('opacity-0', 'transition-opacity', 'duration-500'); + setTimeout(() => toast.remove(), 500); + }, FEEDBACK_DISMISS_DELAY); + } + function showSectionMessage(message, type) { // Show an inline feedback message in the Add PR section on the page const section = document.getElementById('prUrlInput')?.closest('section'); @@ -2512,7 +2527,12 @@

${emptyTitl ${reviewBadge} ${renderReviewerAvatars(pr.reviewers_json)} - ${escapeHtml(mergeableText)} + + + ${escapeHtml(mergeableText)} + ${mergeableText === 'Conflicts' ? `` : ''} + + ${pr.files_changed} ${pr.commits_count || 0} @@ -2589,6 +2609,26 @@

${emptyTitl `; + // Add click handler for the conflict message button + const conflictMessageBtn = row.querySelector('.conflict-message-btn'); + if (conflictMessageBtn) { + conflictMessageBtn.addEventListener('click', async (e) => { + e.stopPropagation(); + const prUrl = conflictMessageBtn.dataset.prUrl; + const authorLogin = conflictMessageBtn.dataset.authorLogin; + const authorMention = authorLogin && /^[a-zA-Z0-9_.-]+$/.test(authorLogin) ? `@${authorLogin}` : 'contributor'; + const message = `Hi ${authorMention}, this PR has merge conflicts that need to be resolved before it can be merged. Could you please fix the conflicts? Thank you!`; + const prUrlWithComment = `${prUrl}?expand=1&body=${encodeURIComponent(message)}`; + try { + await navigator.clipboard.writeText(message); + showSuccessToast('Opening PR with conflict message pre-filled...'); + } catch (err) { + console.error('Failed to copy conflict message:', err); + } + window.open(prUrlWithComment, '_blank', 'noopener,noreferrer'); + }); + } + // Add click handler to highlight the row when clicked row.addEventListener('click', (e) => { // Don't trigger row selection if clicking on the update button or links