Skip to content
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
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<!-- Markdown parsing and sanitization -->
<script src="https://cdn.jsdelivr.net/npm/markdown-it@14.0.0/dist/markdown-it.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.5/dist/purify.min.js"></script>
<script src="src/logger.js"></script>
<script src="src/utils.js"></script>
<script src="src/event-bus.js"></script>
<script src="src/notifications.js"></script>
Expand Down
32 changes: 6 additions & 26 deletions src/about-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,33 @@
// Get current repository context
function getCurrentRepoContext() {
let context = null;
let source = 'unknown';


// Try to get from RepoManager first (most reliable)
if (window.RepoManager?.repoState?.currentRepo) {
context = window.RepoManager.repoState.currentRepo;
source = 'RepoManager';
}
// Try to get from localStorage directly
else {
try {
const current = localStorage.getItem('dashban_current_repo');
if (current) {
context = JSON.parse(current);
source = 'localStorage';
}
} catch (error) {
console.warn('Failed to load current repo from localStorage:', error);
}
}

// Fallback to GitHub config
if (!context && window.GitHubAuth?.GITHUB_CONFIG) {
context = window.GitHubAuth.GITHUB_CONFIG;
source = 'GitHubAuth';
}

// Final fallback
if (!context) {
context = { owner: 'super3', repo: 'dashban' };
source = 'default';
}

console.log(`πŸ“¦ Repository context from ${source}:`, context);

return context;
}

Expand Down Expand Up @@ -112,7 +106,6 @@
const config = getCurrentRepoContext();
const storageKey = `aboutCardArchived_${config.owner}_${config.repo}`;
localStorage.setItem(storageKey, JSON.stringify(isArchived));
console.log(`πŸ“¦ Saved About card archived status for ${config.owner}/${config.repo}: ${isArchived}`);
} catch (error) {
console.warn('Failed to save About card archived status to localStorage:', error);
}
Expand All @@ -126,7 +119,6 @@
const storageKey = `aboutCardArchived_${config.owner}_${config.repo}`;
const saved = localStorage.getItem(storageKey);
const result = saved ? JSON.parse(saved) : false;
console.log(`πŸ“¦ Loaded About card archived status for ${config.owner}/${config.repo}: ${result}`);
return result;
} catch (error) {
console.warn('Failed to load About card archived status from localStorage:', error);
Expand All @@ -137,21 +129,16 @@
// Hide About card if it was archived
function hideAboutCardIfArchived() {
const isArchived = loadAboutCardArchivedStatus();
console.log('πŸ“¦ Checking if About card should be hidden. Archived status:', isArchived);


if (isArchived) {
const aboutCard = document.querySelector('[data-card-id="about-card"]');
if (aboutCard) {
aboutCard.remove();
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
console.log('πŸ“¦ About card hidden (was previously archived)');
} else {
console.log('πŸ“¦ About card was marked as archived but not found in DOM');
}
} else {
console.log('πŸ“¦ About card should be visible');
// If not archived and About card doesn't exist, ensure it exists
ensureAboutCardExists();
}
Expand All @@ -161,7 +148,6 @@
function ensureAboutCardExists() {
const aboutCard = document.querySelector('[data-card-id="about-card"]');
if (!aboutCard) {
console.log('πŸ“¦ About card missing but should be visible - creating it');
// Create About card and add it to todo column (it will be moved by applyCardOrder if needed)
const todoColumn = document.getElementById('todo');
if (todoColumn) {
Expand All @@ -170,7 +156,6 @@
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
console.log('πŸ“¦ About card recreated in Todo column');
}
}
}
Expand Down Expand Up @@ -242,7 +227,6 @@
// Check if About card already exists
const existingAboutCard = document.querySelector('[data-card-id="about-card"]');
if (existingAboutCard) {
console.log('πŸ“¦ About card is already visible');
return;
}

Expand All @@ -256,7 +240,6 @@
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
console.log('πŸ“¦ About card restored to Todo column');
}
}

Expand All @@ -266,13 +249,10 @@
return;
}

console.log('πŸ“¦ About Card module initializing...');

// Set up event delegation for archive button clicks (will be called from kanban.js)
// Note: The actual event handler setup remains in kanban.js to maintain event flow

state.initialized = true;
console.log('πŸ“¦ About Card module initialized');
}

// React to board card moves: add/remove the About card's archive button
Expand Down
2 changes: 0 additions & 2 deletions src/board-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
return;
}

console.log(`🏷️ GitHub issue #${issueNumber} moved from ${fromColumnId} to ${toColumnId}`);

const labelsOk = await window.safeInvoke('GitHub', 'updateGitHubIssueLabels', issueNumber, toColumnId);

let closeOk = true;
Expand Down
17 changes: 4 additions & 13 deletions src/card-persistence.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,33 @@
// Get current repository context
function getCurrentRepoContext() {
let context = null;
let source = 'unknown';


// Try to get from RepoManager first (most reliable)
if (window.RepoManager?.repoState?.currentRepo) {
context = window.RepoManager.repoState.currentRepo;
source = 'RepoManager';
}
// Try to get from localStorage directly
else {
try {
const current = localStorage.getItem('dashban_current_repo');
if (current) {
context = JSON.parse(current);
source = 'localStorage';
}
} catch (error) {
console.warn('Failed to load current repo from localStorage:', error);
}
}

// Fallback to GitHub config
if (!context && window.GitHubAuth?.GITHUB_CONFIG) {
context = window.GitHubAuth.GITHUB_CONFIG;
source = 'GitHubAuth';
}

// Final fallback
if (!context) {
context = { owner: 'super3', repo: 'dashban' };
source = 'default';
}

console.log(`πŸ“¦ Repository context from ${source}:`, context);

return context;
}

Expand Down Expand Up @@ -333,10 +327,7 @@
return;
}

console.log('πŸ’Ύ Card Persistence module initializing...');

state.initialized = true;
console.log('πŸ’Ύ Card Persistence module initialized');
}

function cleanupClosedIssuesFromStorage() {
Expand All @@ -356,7 +347,7 @@
// Remove closed GitHub issues from all columns in localStorage
Object.keys(cardOrder).forEach(columnId => {
if (columnId !== 'done') {
const originalLength = cardOrder[columnId].length;

Check warning on line 350 in src/card-persistence.js

View workflow job for this annotation

GitHub Actions / test

'originalLength' is assigned a value but never used
cardOrder[columnId] = cardOrder[columnId].filter(cardId => {
// Find the card element to check if it's a closed GitHub issue
const cardElement = document.querySelector(`[data-issue-number="${cardId}"]`);
Expand Down
20 changes: 1 addition & 19 deletions src/github-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// Archive GitHub issue by adding "archive" label
async function archiveGitHubIssue(issueNumber, taskElement) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot archive issue');
// Remove from UI anyway
taskElement.remove();
window.updateColumnCounts();
Expand Down Expand Up @@ -66,7 +65,6 @@
// Update GitHub issue labels when moved between columns
async function updateGitHubIssueLabels(issueNumber, newColumn) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot update issue labels');
return;
}

Expand Down Expand Up @@ -132,7 +130,6 @@
// Update GitHub issue title
async function updateGitHubIssueTitle(issueNumber, newTitle) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot update issue title');
return false;
}

Expand All @@ -153,8 +150,7 @@
throw new Error(`GitHub API error: ${response.status} - ${errorData.message || 'Unknown error'}`);
}

const issue = await response.json();

Check warning on line 153 in src/github-api.js

View workflow job for this annotation

GitHub Actions / test

'issue' is assigned a value but never used
console.log(`βœ… Successfully updated GitHub issue #${issueNumber} title to: "${newTitle}"`);
return true;

} catch (error) {
Expand All @@ -169,7 +165,6 @@
// Update GitHub issue description
async function updateGitHubIssueDescription(issueNumber, newDescription) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot update issue description');
return false;
}

Expand All @@ -190,9 +185,8 @@
throw new Error(`GitHub API error: ${response.status} - ${errorData.message || 'Unknown error'}`);
}

const issue = await response.json();

Check warning on line 188 in src/github-api.js

View workflow job for this annotation

GitHub Actions / test

'issue' is assigned a value but never used
console.log(`βœ… Successfully updated GitHub issue #${issueNumber} description`);


// Update the stored raw description in the task element for future edits
const taskElement = document.querySelector(`[data-issue-number="${issueNumber}"]`);
if (taskElement) {
Expand All @@ -213,7 +207,6 @@
// Close GitHub issue when moved to Done column
async function closeGitHubIssue(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot close issue');
return;
}

Expand Down Expand Up @@ -250,7 +243,6 @@
// Reopen GitHub issue
async function reopenGitHubIssue(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot reopen issue');
return;
}

Expand All @@ -271,8 +263,6 @@
throw new Error(`GitHub API error: ${response.status} - ${errorData.message || 'Unknown error'}`);
}

console.log(`βœ… Successfully reopened GitHub issue #${issueNumber}`);

} catch (error) {
console.error('❌ Failed to reopen GitHub issue:', error);

Expand All @@ -284,7 +274,6 @@
// Update GitHub issue priority or category label
async function updateGitHubIssueMetadata(issueNumber, type, newValue) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot update issue metadata');
return false;
}

Expand Down Expand Up @@ -339,7 +328,6 @@
throw new Error(`GitHub API error: ${updateResponse.status} - ${errorData.message || 'Unknown error'}`);
}

console.log(`βœ… Successfully updated GitHub issue #${issueNumber} ${type} to: "${newValue}"`);
return true;

} catch (error) {
Expand All @@ -354,7 +342,6 @@
// Create GitHub issue via API
async function createGitHubIssue(title, description, labels = []) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot create issue');
return null;
}

Expand Down Expand Up @@ -522,7 +509,6 @@

// Handle rate limiting gracefully
if (error.message.includes('Rate limit') || error.message.includes('rate limit')) {
console.log('πŸ“Š GitHub API rate limited - banner should be visible');
// Don't show additional alert - rate limit banner handles this
return;
}
Expand Down Expand Up @@ -569,7 +555,6 @@
// Get GitHub issue comments
async function getGitHubIssueComments(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot fetch comments');
return [];
}

Expand All @@ -584,7 +569,6 @@
}

const comments = await response.json();
console.log(`βœ… Successfully fetched ${comments.length} comments for issue #${issueNumber}`);
return comments;

} catch (error) {
Expand All @@ -599,7 +583,6 @@
// Create GitHub issue comment
async function createGitHubIssueComment(issueNumber, commentBody) {
if (!window.GitHubAuth.isGitHubAuthed()) {
console.log('❌ Not authenticated with GitHub - cannot create comment');
return null;
}

Expand All @@ -620,7 +603,6 @@
}

const comment = await response.json();
console.log(`βœ… Successfully created comment on issue #${issueNumber}`);
return comment;

} catch (error) {
Expand Down
Loading
Loading