Skip to content

Commit

Permalink
Lists now auto update while window is open
Browse files Browse the repository at this point in the history
  • Loading branch information
jgavrilo committed Nov 30, 2023
1 parent 79ea17f commit fdd113c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
tag_name: ${{ steps.manifest.outputs.version }}
release_name: Release ${{ steps.manifest.outputs.version }}
body: Fixed more todo list glitches, added spotify player
body: Lists now auto update while window is open
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "GetItTogether",
"version": "1.4.3",
"version": "1.4.4",
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAni8XFkkQ4I+t3clNWVnatNTUPEHK59rsOv461uN3TdXtz4NDw0/2aymf+/LEHyp2Yky2JlyCnxAkndmPbcuDrXHvl7+O8XYeTavVn5Xm96A544dUeSzrzUjgWHGcR9ZJ+g9ahmukamW12TdggrtGJixY6n4rGIx0WW0XPOLUed93kZyN6B1axWj20MJ9Cax71LdVScNISfZ6qIrJZTJSnpnMCKZoo9ZlDIuwaFJn7zhSIajYF0quSazI/Cug9pUfw42f1O+abv46m0Mtzltr5exC4et5jRVEanQRhjwiCMLYP9aKceWkqo+9131arAb44lYrIlZtusT7XQ12By0Z/wIDAQAB",
"description": "A tool set for chrome",
"permissions": [
Expand Down
18 changes: 13 additions & 5 deletions src/js/todo/todoTabMenuManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const tabId = 'local';
var tabId = 'local';

// SECTION - DOMContentLoaded
document.addEventListener('DOMContentLoaded', async function() {
Expand Down Expand Up @@ -33,17 +33,20 @@ async function displayGoogleTabs() {
localTab.className = 'tab-button';
localTab.textContent = 'Local';
localTab.addEventListener('click', function() {
tabId = 'local';
switchTab('local');
});
tabs.appendChild(localTab);

console.log(googleTaskLists);

googleTaskLists.forEach(async (taskList) => {
const button = document.createElement('button');
button.className = 'tab-button';
button.id = taskList.id;
button.textContent = taskList.title;
button.addEventListener('click', function() {
tabId = taskList.id;
switchTab(taskList.id);
});
tabs.appendChild(button);
Expand Down Expand Up @@ -74,6 +77,8 @@ async function displayGoogleTabs() {
// SECTION - Tabs
// Function to switch tabs
async function switchTab(tabId) {
console.debug(tabId);

// Remove active class from all tab buttons
const allTabButtons = document.querySelectorAll('.tab-button');
allTabButtons.forEach(el => el.classList.remove('active'));
Expand Down Expand Up @@ -115,8 +120,8 @@ async function switchTab(tabId) {
// Fetch and display tasks for this Google Task List
var token = await getAuthToken();
var tasks = await fetchGoogleTasks(token, tabId);
console.log(tasks);

console.debug("Come back here to get the universal structure for tasks")
// Clear previous tasks
const taskListElement = document.getElementById(`${tabId}-content`);
if (taskListElement) {
Expand All @@ -129,7 +134,6 @@ async function switchTab(tabId) {
// Append new tasks
tasks.forEach(task => {


const li = document.createElement('li');

const container = document.createElement('div');
Expand Down Expand Up @@ -228,4 +232,8 @@ window.addEventListener('storage', async function(event) {
// Reload the todo list based on the new login status
await loadTodoList();
}
});
});

setInterval(() => {
switchTab(tabId);
}, 5000);

0 comments on commit fdd113c

Please sign in to comment.