Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
80ddb19
Initial plan
Copilot Oct 23, 2025
15316bd
Fix TypeScript build errors - update interfaces and add missing methods
Copilot Oct 23, 2025
2966d70
Fix additional TypeScript build errors - MouseEvent, missing methods,…
Copilot Oct 23, 2025
70fcbca
Fix Stats type error and additional TypeScript issues in ExampleStats…
Copilot Oct 23, 2025
61b4493
Fix remaining TypeScript errors - KeyboardEvent support and missing m…
Copilot Oct 23, 2025
eb4fa56
Update npm version requirement to 11.6.2 or higher
Copilot Oct 23, 2025
b6846d2
Fix navigate function type error in PageBreadcrumbs
Copilot Oct 23, 2025
47a27a4
Fix HelpModal missing props - add helpTopic and tutorialId
Copilot Oct 24, 2025
ffed389
Fix LoginModal onAuthSuccess call - remove extra octokit parameter
Copilot Oct 24, 2025
d12b904
Fix ContextualHelpMascot missing helpContent prop in PATSetupInstruct…
Copilot Oct 24, 2025
e24dfb7
Fix PersonaViewer type errors - cast usePage and add error type
Copilot Oct 24, 2025
d01140a
Fix PreviewBadge markdown components type annotations
Copilot Oct 24, 2025
cf0ceaf
Fix PreviewBadge BranchInfo interface to include name property
Copilot Oct 24, 2025
fca518d
Fix PreviewBadge error type handling - add any type and optional chai…
Copilot Oct 24, 2025
06863ad
Fix PreviewBadge handleClickOutside event type annotation
Copilot Oct 24, 2025
4c2f8b3
Fix PreviewBadge ref types - add proper HTMLDivElement and NodeJS.Tim…
Copilot Oct 24, 2025
617a033
Fix PreviewBadge fetchPRsForBranch parameter type annotation
Copilot Oct 24, 2025
3b34922
Add getPullRequestsForBranch method to githubService
Copilot Oct 24, 2025
1e7e071
Fix PreviewBadge fetchCommentsForPR parameter type annotations
Copilot Oct 24, 2025
f0be331
Add PR comment methods to githubService - getPullRequestComments, get…
Copilot Oct 24, 2025
99f570b
Force recompile of githubService - update method documentation
Copilot Oct 25, 2025
02dcee9
Fix Date arithmetic in PreviewBadge sort operations
Copilot Oct 25, 2025
46601aa
Fix Set iteration - use Array.from instead of spread operator
Copilot Oct 25, 2025
bbdda56
Fix allComments type inference - add explicit any types to map callbacks
Copilot Oct 25, 2025
ac4f8da
Fix allComments state type annotation - add explicit any[] type
Copilot Oct 25, 2025
1a5ea78
Fix formatTimelineEvent parameter type annotation
Copilot Oct 25, 2025
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
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"engines": {
"node": ">=20.0.0",
"npm": ">=10.0.0"
"npm": ">=11.6.2"
},
"browserslist": {
"production": [
Expand Down
89 changes: 43 additions & 46 deletions src/components/BugReportForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import bugReportService from '../services/bugReportService';
import bugReportService, { IssueTemplate, TemplateField } from '../services/bugReportService';
import githubService from '../services/githubService';
import ScreenshotEditor from './ScreenshotEditor';
import repositoryConfig from '../config/repositoryConfig';
Expand All @@ -9,12 +9,6 @@ interface BugReportFormProps {
contextData?: Record<string, any>;
}

interface TemplateType {
name: string;
type: string;
fields: FieldDefinition[];
}

interface FieldDefinition {
name: string;
label: string;
Expand All @@ -29,8 +23,8 @@ interface FormDataType {
}

const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {} }) => {
const [templates, setTemplates] = useState<TemplateType[]>([]);
const [selectedTemplate, setSelectedTemplate] = useState<TemplateType | null>(null);
const [templates, setTemplates] = useState<IssueTemplate[]>([]);
const [selectedTemplate, setSelectedTemplate] = useState<IssueTemplate | null>(null);
const [formData, setFormData] = useState<FormDataType>({});
const [includeConsole, setIncludeConsole] = useState<boolean>(false);
const [includeScreenshot, setIncludeScreenshot] = useState<boolean>(false);
Expand Down Expand Up @@ -86,14 +80,14 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
}
};

const handleTemplateChange = (template) => {
setSelectedTemplate(template);
const handleTemplateChange = (template: IssueTemplate | undefined) => {
setSelectedTemplate(template || null);
setFormData({}); // Reset form data when template changes
setIncludeConsole(template.type === 'bug'); // Auto-enable console for bug reports
setIncludeScreenshot(template.type === 'bug'); // Auto-enable screenshot for bug reports
setIncludeConsole(template?.type === 'bug'); // Auto-enable console for bug reports
setIncludeScreenshot(template?.type === 'bug'); // Auto-enable screenshot for bug reports
};

const handleFormChange = (fieldId, value) => {
const handleFormChange = (fieldId: string, value: any) => {
setFormData(prev => ({
...prev,
[fieldId]: value
Expand All @@ -118,7 +112,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
}
} catch (err) {
console.error('Failed to take screenshot:', err);
setError('Failed to capture screenshot: ' + err.message);
setError('Failed to capture screenshot: ' + (err instanceof Error ? err.message : String(err)));
} finally {
setTakingScreenshot(false);
}
Expand All @@ -128,7 +122,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
setShowScreenshotEditor(true);
};

const handleScreenshotEditorSave = (editedBlob) => {
const handleScreenshotEditorSave = (editedBlob: Blob) => {
// Update the screenshot with the edited version
setScreenshotBlob(editedBlob);

Expand Down Expand Up @@ -165,7 +159,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
};
}, [screenshotPreview]);

const handleSubmit = async (e) => {
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();

if (!selectedTemplate) {
Expand All @@ -184,7 +178,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
const currentScreenshot = includeScreenshot ? screenshotBlob : null;

// Check if user is authenticated and can submit via API
if (githubService.isAuthenticated) {
if (githubService.isAuth()) {
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call 'isAuth()' appears incorrect. Based on the context and common patterns, this should likely be 'isAuthenticated' (a property) or 'isAuthenticated()' (a method). Verify the correct API for githubService authentication checking.

Suggested change
if (githubService.isAuth()) {
if (githubService.isAuthenticated()) {

Copilot uses AI. Check for mistakes.
const result = await bugReportService.submitIssue(
repositoryConfig.getOwner(),
repositoryConfig.getName(),
Expand Down Expand Up @@ -243,7 +237,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
}
} catch (err) {
console.error('Failed to submit bug report:', err);
setError(err.message);
setError(err instanceof Error ? err.message : String(err));
} finally {
setSubmitting(false);
}
Expand All @@ -266,7 +260,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
);
};

const renderFormField = (field) => {
const renderFormField = (field: TemplateField) => {
const { id, type, attributes = {}, validations = {} } = field;
const { label, description, placeholder, options } = attributes;
const { required } = validations;
Expand All @@ -276,7 +270,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
<div key={id || Math.random()} className="form-field markdown-field">
<div
className="markdown-content"
dangerouslySetInnerHTML={{ __html: attributes.value }}
dangerouslySetInnerHTML={{ __html: attributes.value || '' }}
/>
</div>
);
Expand Down Expand Up @@ -342,8 +336,8 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
>
<option value="">Select an option...</option>
{options?.map((option, index) => (
<option key={index} value={option.value || option}>
{option.label || option}
<option key={index} value={typeof option === 'string' ? option : option.value}>
{typeof option === 'string' ? option : option.label}
</option>
))}
</select>
Expand All @@ -359,24 +353,27 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
{required && <span className="required">*</span>}
</legend>
{description && <p className="field-description">{description}</p>}
{options?.map((option, index) => (
<label key={index} className="checkbox-label">
<input
type="checkbox"
className="checkbox-input"
checked={formData[fieldId]?.includes(option.value || option) || false}
onChange={(e) => {
const value = option.value || option;
const currentValues = formData[fieldId] || [];
const newValues = e.target.checked
? [...currentValues, value]
: currentValues.filter(v => v !== value);
handleFormChange(fieldId, newValues);
}}
/>
{option.label || option}
</label>
))}
{options?.map((option, index) => {
const optionValue = typeof option === 'string' ? option : option.value;
const optionLabel = typeof option === 'string' ? option : option.label;
return (
<label key={index} className="checkbox-label">
<input
type="checkbox"
className="checkbox-input"
checked={formData[fieldId]?.includes(optionValue) || false}
onChange={(e) => {
const currentValues = formData[fieldId] || [];
const newValues = e.target.checked
? [...currentValues, optionValue]
: currentValues.filter((v: any) => v !== optionValue);
handleFormChange(fieldId, newValues);
}}
/>
{optionLabel}
</label>
);
})}
</fieldset>
</div>
);
Expand Down Expand Up @@ -592,7 +589,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
) : (
<div className="screenshot-preview">
<img
src={screenshotPreview}
src={screenshotPreview || undefined}
alt="Screenshot preview"
className="screenshot-image"
/>
Expand Down Expand Up @@ -649,7 +646,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
<ul>
<li><strong>Current Page:</strong> {contextData.pageId || 'Unknown'}</li>
<li><strong>URL:</strong> {window.location.href}</li>
<li><strong>Authentication:</strong> {githubService.isAuthenticated ? 'Authenticated' : 'Demo Mode'}</li>
<li><strong>Authentication:</strong> {githubService.isAuth() ? 'Authenticated' : 'Demo Mode'}</li>
</ul>
</div>

Expand Down Expand Up @@ -691,7 +688,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
</div>

{/* Template Fields */}
{selectedTemplate && (
{selectedTemplate && Array.isArray(selectedTemplate.body) && (
<div className="template-fields">
{selectedTemplate.body.map(field => renderFormField(field))}
</div>
Expand All @@ -705,7 +702,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}
disabled={submitting || !selectedTemplate}
>
{submitting ? 'Opening...' :
githubService.isAuthenticated ? 'Submit Issue' : 'Open in GitHub'}
githubService.isAuth() ? 'Submit Issue' : 'Open in GitHub'}
</button>

<button
Expand All @@ -730,7 +727,7 @@ const BugReportForm: React.FC<BugReportFormProps> = ({ onClose, contextData = {}

{/* Authentication Status */}
<div className="auth-status">
{githubService.isAuthenticated ? (
{githubService.isAuth() ? (
<p className="auth-info authenticated">
✅ Authenticated - Issues will be submitted directly to GitHub
</p>
Expand Down
6 changes: 3 additions & 3 deletions src/components/CollaborationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CollaborationModal: React.FC<CollaborationModalProps> = ({ onClose }) => {

// Handle Escape key
useEffect(() => {
const handleEscape = (e) => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
onClose();
}
Expand Down Expand Up @@ -143,11 +143,11 @@ const CollaborationModal: React.FC<CollaborationModalProps> = ({ onClose }) => {
setCurrentSlide((prev) => (prev - 1 + slides.length) % slides.length);
};

const goToSlide = (index) => {
const goToSlide = (index: number) => {
setCurrentSlide(index);
};

const handleOverlayClick = (e) => {
const handleOverlayClick = (e: React.MouseEvent<HTMLDivElement>) => {
if (e.target === e.currentTarget) {
onClose();
}
Expand Down
10 changes: 8 additions & 2 deletions src/components/ComponentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ const HealthInterventionsEditor: React.FC = () => {
<div className="editor-content">
<WHODigitalLibrary
onReferencesChange={handleReferencesChange}
selectedReferences={selectedReferences}
/>
</div>

<ContextualHelpMascot
pageId="health-interventions-editor"
helpContent={null}
contextData={{
profile: profile || { login: user || 'unknown' },
repository: repository || { name: repo || 'unknown' },
Expand Down Expand Up @@ -174,12 +174,12 @@ const ComponentEditorContent: React.FC = () => {
<div className="editor-content">
<WHODigitalLibrary
onReferencesChange={handleReferencesChange}
selectedReferences={selectedReferences}
/>
</div>

<ContextualHelpMascot
pageId="component-editor"
helpContent={null}
contextData={{ component: currentComponent }}
/>
</div>
Expand All @@ -190,6 +190,12 @@ const ComponentEditorContent: React.FC = () => {
}
}

// Safety check for currentComponent
if (!currentComponent) {
navigate('/');
return <div>Redirecting...</div>;
}

return (
<div className="component-editor">
<div className="editor-content">
Expand Down
13 changes: 7 additions & 6 deletions src/components/CoreDataDictionaryViewer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { PageLayout, usePage } from './framework';
import { useDakComponent } from '../services/ComponentObjectProvider.tsx';
import { useDakComponent } from '../services/ComponentObjectProvider';
import './CoreDataDictionaryViewer.css';

/**
Expand All @@ -22,7 +22,8 @@ const CoreDataDictionaryViewer = () => {

const CoreDataDictionaryViewerContent = () => {
const navigate = useNavigate();
const { profile, repository, branch } = usePage();
const pageContext = usePage() as any;
const { profile, repository, branch } = pageContext;

// Component Object for core data elements
const dataElementsComponent = useDakComponent('dataElements');
Expand All @@ -41,7 +42,7 @@ const CoreDataDictionaryViewerContent = () => {

// Handle Escape key for modal
useEffect(() => {
const handleEscape = (e) => {
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape' && showModal) {
closeModal();
}
Expand All @@ -53,7 +54,7 @@ const CoreDataDictionaryViewerContent = () => {
}, [showModal]);

// Generate base URL for IG Publisher artifacts
const getBaseUrl = useCallback((branchName) => {
const getBaseUrl = useCallback((branchName: string) => {
const owner = user || repository?.owner?.login || repository?.full_name?.split('/')[0];
const repoName = repo || repository?.name;

Expand Down Expand Up @@ -99,7 +100,7 @@ const CoreDataDictionaryViewerContent = () => {
setDataElements(elements || []);
} catch (err) {
console.error('Error loading data elements:', err);
setError(err.message || 'Failed to load core data elements');
setError(err instanceof Error ? err.message : 'Failed to load core data elements');
} finally {
setLoading(false);
}
Expand Down Expand Up @@ -136,7 +137,7 @@ const CoreDataDictionaryViewerContent = () => {
};

// Modal handlers
const openModal = (element) => {
const openModal = (element: any) => {
setSelectedElement(element);
setShowModal(true);
};
Expand Down
3 changes: 1 addition & 2 deletions src/components/DAKStatusBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,8 @@ const DAKStatusBox: React.FC<DAKStatusBoxProps> = ({ repository, selectedBranch,
<div className="status-section">
<h4>🔄 Recent Commits</h4>
<CommitsSlider
commits={repositoryStats.recentCommits}
repository={repository}
branch={branch}
selectedBranch={branch}
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'commits' prop was removed from CommitsSlider component. This appears to be incorrect as the component likely needs the commit data from repositoryStats.recentCommits to function properly. The prop should be added back: commits={repositoryStats.recentCommits}

Suggested change
selectedBranch={branch}
selectedBranch={branch}
commits={repositoryStats.recentCommits}

Copilot uses AI. Check for mistakes.
/>
</div>

Expand Down
Loading
Loading