-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add Scrum Preview Modal Functionality #79
base: master
Are you sure you want to change the base?
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.
@@ -158,6 +158,64 @@ function handleGsocClick() { | |||
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 |
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: