Skip to content

Commit ad35db6

Browse files
committed
Fix activity checking on startup and improve UI
1 parent 30db9ea commit ad35db6

7 files changed

Lines changed: 269 additions & 19 deletions

File tree

background.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@ const DEFAULT_INTERVAL = 15;
99
if (typeof chrome !== 'undefined' && chrome.runtime) {
1010
// Setup alarm when extension is installed
1111
chrome.runtime.onInstalled.addListener(() => {
12+
console.log('[DevWatch] Extension installed, setting up alarm and running initial check...');
1213
chrome.storage.sync.get(['checkInterval'], (result) => {
1314
const interval = result.checkInterval || DEFAULT_INTERVAL;
1415
setupAlarm(interval);
16+
// Run an immediate check on install
17+
checkGitHubActivity();
1518
});
1619
});
1720

1821
// Setup alarm on startup
1922
chrome.runtime.onStartup.addListener(() => {
23+
console.log('[DevWatch] Extension started, setting up alarm and running initial check...');
2024
chrome.storage.sync.get(['checkInterval'], (result) => {
2125
const interval = result.checkInterval || DEFAULT_INTERVAL;
2226
setupAlarm(interval);
27+
// Run an immediate check on startup
28+
checkGitHubActivity();
2329
});
2430
});
2531
}
@@ -59,6 +65,8 @@ if (typeof chrome !== 'undefined' && chrome.notifications) {
5965

6066
async function checkGitHubActivity() {
6167
try {
68+
console.log('[DevWatch] Starting GitHub activity check...');
69+
6270
// Get token from secure local storage
6371
const githubToken = await getToken();
6472

@@ -71,7 +79,16 @@ async function checkGitHubActivity() {
7179
'snoozedRepos'
7280
]);
7381

74-
if (!githubToken || !watchedRepos || watchedRepos.length === 0) {
82+
console.log('[DevWatch] Token present:', !!githubToken);
83+
console.log('[DevWatch] Watched repos:', watchedRepos?.length || 0);
84+
85+
if (!githubToken) {
86+
console.warn('[DevWatch] No GitHub token found. Please add a token in settings.');
87+
return;
88+
}
89+
90+
if (!watchedRepos || watchedRepos.length === 0) {
91+
console.warn('[DevWatch] No repositories being watched. Please add repos in settings.');
7592
return;
7693
}
7794

@@ -91,6 +108,7 @@ async function checkGitHubActivity() {
91108

92109
// Skip muted and snoozed repos
93110
if (excludedRepos.has(repoName)) {
111+
console.log(`[DevWatch] Skipping ${repoName} (muted or snoozed)`);
94112
continue;
95113
}
96114

@@ -104,19 +122,24 @@ async function checkGitHubActivity() {
104122
}
105123
}
106124

125+
console.log(`[DevWatch] Fetching activity for ${repoName} since ${checkDate.toISOString()}`);
107126
const activities = await fetchRepoActivity(repoName, githubToken, checkDate, enabledFilters);
127+
console.log(`[DevWatch] Found ${activities.length} new activities in ${repoName}`);
108128
newActivities.push(...activities);
109129
}
110130

131+
console.log(`[DevWatch] Total new activities: ${newActivities.length}`);
132+
111133
if (newActivities.length > 0) {
112134
await storeActivities(newActivities);
113135
await updateBadge();
114136
showNotifications(newActivities, notifications);
115137
}
116138

117139
await chrome.storage.sync.set({ lastCheck: new Date().toISOString() });
140+
console.log('[DevWatch] Check complete');
118141
} catch (error) {
119-
console.error('Error checking GitHub:', error);
142+
console.error('[DevWatch] Error checking GitHub:', error);
120143
}
121144
}
122145

options/options.css

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,14 @@ body.dark-mode .notification-toggle input:checked + .toggle-slider {
569569
margin-bottom: 12px;
570570
}
571571

572+
.repo-search-controls {
573+
display: flex;
574+
gap: 12px;
575+
align-items: center;
576+
}
577+
572578
.search-input-wrapper {
579+
flex: 1;
573580
position: relative;
574581
display: flex;
575582
align-items: center;
@@ -604,8 +611,41 @@ body.dark-mode .notification-toggle input:checked + .toggle-slider {
604611
transform: scale(0.95);
605612
}
606613

607-
.repo-search-container input {
608-
width: 100%;
614+
.hide-pinned-btn {
615+
display: inline-flex;
616+
align-items: center;
617+
gap: 6px;
618+
padding: 8px 12px;
619+
background: var(--bg-tertiary);
620+
border: 1px solid var(--border-color-dark);
621+
border-radius: 6px;
622+
cursor: pointer;
623+
font-size: 13px;
624+
font-weight: 500;
625+
color: var(--text-secondary);
626+
transition: all 0.2s;
627+
white-space: nowrap;
628+
}
629+
630+
.hide-pinned-btn:hover {
631+
background: var(--bg-secondary);
632+
border-color: var(--link-color);
633+
color: var(--link-color);
634+
}
635+
636+
.hide-pinned-btn.active {
637+
background: var(--link-color);
638+
color: white;
639+
border-color: var(--link-color);
640+
}
641+
642+
.hide-pinned-btn.active:hover {
643+
opacity: 0.9;
644+
}
645+
646+
.hide-pinned-btn svg {
647+
width: 16px;
648+
height: 16px;
609649
}
610650

611651
.pagination-controls {
@@ -1063,6 +1103,36 @@ body.dark-mode .notification-toggle input:checked + .toggle-slider {
10631103
flex-shrink: 0;
10641104
}
10651105

1106+
.pin-btn {
1107+
background: none;
1108+
border: 1px solid var(--border-color-dark);
1109+
border-radius: 6px;
1110+
padding: 8px 10px;
1111+
cursor: pointer;
1112+
display: flex;
1113+
align-items: center;
1114+
justify-content: center;
1115+
color: var(--text-secondary);
1116+
transition: all 0.2s;
1117+
}
1118+
1119+
.pin-btn:hover {
1120+
background: var(--bg-tertiary);
1121+
border-color: var(--link-color);
1122+
color: var(--link-color);
1123+
}
1124+
1125+
.pin-btn.pinned {
1126+
color: #f59e0b;
1127+
border-color: #f59e0b;
1128+
background: rgba(245, 158, 11, 0.1);
1129+
}
1130+
1131+
.pin-btn.pinned:hover {
1132+
background: rgba(245, 158, 11, 0.2);
1133+
border-color: #f59e0b;
1134+
}
1135+
10661136
.mute-btn {
10671137
background: none;
10681138
border: 1px solid var(--border-color-dark);
@@ -1100,6 +1170,11 @@ body.dark-mode .notification-toggle input:checked + .toggle-slider {
11001170
opacity: 0.7;
11011171
}
11021172

1173+
.repo-item.pinned {
1174+
border-left: 3px solid #f59e0b;
1175+
background: rgba(245, 158, 11, 0.05);
1176+
}
1177+
11031178
/* Import/Export Buttons */
11041179
.import-export-buttons {
11051180
display: flex;

options/options.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,21 @@ <h2>Watched Repositories</h2>
9191
<div id="repoError" class="repo-error"></div>
9292

9393
<div class="repo-search-container" id="repoSearchContainer" style="display: none;">
94-
<div class="search-input-wrapper">
95-
<input type="text" id="repoSearch" placeholder="Search repositories...">
96-
<button class="search-clear-btn" id="repoSearchClear" style="display: none;" aria-label="Clear search">
94+
<div class="repo-search-controls">
95+
<div class="search-input-wrapper">
96+
<input type="text" id="repoSearch" placeholder="Search repositories...">
97+
<button class="search-clear-btn" id="repoSearchClear" style="display: none;" aria-label="Clear search">
98+
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
99+
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"/>
100+
</svg>
101+
</button>
102+
</div>
103+
<button id="hidePinnedBtn" class="hide-pinned-btn" title="Hide pinned repositories" aria-label="Hide pinned repositories">
97104
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
98-
<path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734L9.06 8l3.22 3.22a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215L8 9.06l-3.22 3.22a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06Z"/>
105+
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
106+
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
99107
</svg>
108+
<span>Hide pinned</span>
100109
</button>
101110
</div>
102111
</div>

0 commit comments

Comments
 (0)