-
Notifications
You must be signed in to change notification settings - Fork 93
Add Scrum Preview Modal Functionality #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's Guide by SourceryThis pull request introduces a Scrum preview modal with copy functionality. The modal displays the generated Scrum content, allowing users to preview and copy it to their clipboard. The implementation involves adding HTML for the modal, JavaScript for handling modal interactions and clipboard functionality, and CSS for styling. The modal logic was moved to Sequence diagram for generating and copying Scrum contentsequenceDiagram
participant User
participant Popup
participant Modal
User->>Popup: Clicks 'Generate Scrum' button
Popup->>Popup: Retrieves data (project name, username, reason)
Popup->>Popup: Generates Scrum content
Popup->>Modal: Displays Scrum content in modal
User->>Modal: Clicks 'Copy' button
Modal->>Modal: Copies Scrum content to clipboard
Modal->>Modal: Shows 'Copied successfully!' toast
Modal-->>User: Scrum content copied
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Preeti9764 - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a templating library to generate the scrum content instead of string concatenation.
- It would be good to add some error handling to the clipboard copy operation.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/scripts/main.js
Outdated
chrome.storage.local.set({ gsoc: 1 }); | ||
handleLastWeekContributionChange(); | ||
} | ||
document.getElementById("openModal").addEventListener("click", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider extracting the modal and clipboard handling logic into well-named helper functions to improve code organization and readability by reducing inline nesting and complexity within event listeners, promoting a more modular structure..
Consider extracting the modal and clipboard handling logic into small, well-named helper functions. For example, you can refactor the inline callbacks like this:
function showScrumModal() {
chrome.storage.local.get(['projectName', 'githubUsername', 'userReason'], (items) => {
const projectName = items.projectName || "[Project]";
const githubUsername = items.githubUsername || "[Username]";
const userReason = items.userReason || "None";
// TEMP: Hardcoded sample data (replace later with GitHub API logic)
const pastWork = [
`(${projectName}) - Made PR (#71) - Fixes issue #69 : Enhanced feedback to Selection/Deselection of CheckBox open`,
`(${projectName}) - Opened Issue(#69) - UI Issue with Checkbox Selection/Deselection Feedback open`,
`(${projectName}) - Reviewed PR - #70 (Fixed UI Issue with Checkbox Selection/Deselection Feedback) open`
].join('\n');
const scrum = `1. What did I do last week?\n ${pastWork}\n\n 2. What I plan to do this week?\n\n 3. What is stopping me from doing my work?\n ${userReason}`;
document.getElementById("scrumContent").textContent = scrum;
// Show modal & disable body scroll
const modal = document.getElementById("scrumModal");
modal.style.display = "flex"; // changed from block to flex for proper centering
document.body.style.overflow = "hidden";
});
}
function hideScrumModal() {
document.getElementById("scrumModal").style.display = "none";
document.body.style.overflow = "";
}
function copyScrumContent() {
const content = document.getElementById("scrumContent").textContent;
const toast = document.getElementById("toast");
navigator.clipboard.writeText(content).then(() => {
toast.classList.add("show");
toast.style.display = "block";
setTimeout(() => {
toast.classList.remove("show");
toast.style.display = "none";
}, 3000);
});
}
Then, attach them to your events:
document.getElementById("openModal").addEventListener("click", showScrumModal);
document.getElementById("closeModal").addEventListener("click", hideScrumModal);
document.getElementById("copyScrum").addEventListener("click", copyScrumContent);
This refactoring reduces inline nesting and improves readability while keeping functionality intact.
@hongquan Can you review this PR and guide me for further change |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a few comments, also the modal can be significantly better, I'm not sure if they are hyperlinks, also make sure the copy button copies the preview in rich HTML and not just text. Thanks!
Thanks for the feedback! I've improved the modal's styling to make it cleaner and more readable, and ensured that all links are clearly visible and properly styled as hyperlinks. The copy button now copies the content in rich HTML format, preserving both the formatting and the links. I've also addressed the other comments you left—let me know if there's anything else you'd like me to adjust. |
|
@mariobehling @hpdang Can you please take a look and suggest changes i could do to enhance this pr |
@Preeti9764 Yes, I’ve already reviewed it and it works well. However, from a UI perspective, having the popup appear on a separate screen doesn’t provide a comfortable viewing experience for users. I think we should consider the approach used in PR #76, where the popup appears on the same screen, it feels more natural. Did you see my comment on that other PR? May be you have an idea because your PR works well without the unmatched issue |
Thank you for the feedback! I completely understand your point regarding the UX and agree that having the preview appear inline (as in PR #76) would feel more seamless and intuitive for users. |
Yes, I’ve seen your comment on the other PR. I believe the issue there could likely be resolved by making some adjustments to how the GitHub data is fetched and handled. Ensuring proper synchronization during data retrieval can help prevent mismatches between the generated scrum and the preview report. |
Closed this PR for now, let's focus on #76 |
Fixed Issue: #74
Changes:
Why:
Enhances user experience by providing a preview and copy functionality before pushing Scrum reports.
Screenshots for the change:
Summary by Sourcery
Add a preview modal for generated Scrum reports with copy functionality
New Features:
Enhancements:
Chores: