Skip to content
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

implemented other tabs looks when in opposite mode #25

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions popupWindow/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ h4 {
overflow-y: auto;
}

.bg-container.other {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
overflow-x: hidden;
}

/* Input and Button Styling */
input[type="text"], input[type="text"]:hover {
border: none;
Expand Down
33 changes: 26 additions & 7 deletions popupWindow/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ document.addEventListener('DOMContentLoaded', () => {
};

const wrongContent = {
workTab: `<h2>You should be in rest mode!!</h2>`,
restTab: `<h2>You should be in work mode!!</h2>`,
workTab: `<div class="bg-container other">
<h2>Work</h2>
<h2>You're in rest mode!</h2>
<button id="endRestEarly" class="edit-buttons" style="transform: translateY(300%);width: 120px;">End rest early</button>
</div>
`,
restTab: `<div class="bg-container other">
<h2>Rest</h2>
<h2>You're in work mode!</h2>
<button id="endWorkEarly" class="edit-buttons" style="transform: translateY(300%);width: 120px;">End work early</button>
</div>
`,
};

const loadWrongContent = {
Expand Down Expand Up @@ -120,12 +130,11 @@ document.addEventListener('DOMContentLoaded', () => {

chrome.storage.onChanged.addListener((changes) => {
if (changes.mode) {
const currentContent = document.getElementsByClassName('selected-box')[0];
if (currentContent.id === 'workIcon' && changes.mode.newValue === 'Rest') {
if (changes.mode.newValue === 'Rest') {
const button = document.getElementById('restIcon');
changeMainContent('restTab', content, loadContent, button);
}
else if (currentContent.id === 'restIcon' && changes.mode.newValue === 'Work') {
else if (changes.mode.newValue === 'Work') {
const button = document.getElementById('workIcon');
changeMainContent('workTab', content, loadContent, button);
}
Expand Down Expand Up @@ -464,7 +473,12 @@ function loadWorkTab() {
}

function loadChangedWorkTab() {
// haven't done yet
const endModeButton = document.getElementById('endRestEarly');
endModeButton.addEventListener('click', ()=> {
chrome.storage.sync.set({ mode: 'Work' }, ()=> {
document.getElementById('workIcon').click();
});
})
}

// REST TAB
Expand All @@ -474,7 +488,12 @@ function loadRestTab() {
}

function loadChangedRestTab() {
// haven't done yet
const endModeButton = document.getElementById('endWorkEarly');
endModeButton.addEventListener('click', ()=> {
chrome.storage.sync.set({ mode: 'Rest' }, ()=> {
document.getElementById('restIcon').click();
});
})
}

// SETTINGS
Expand Down