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
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
name: Bug Report
about: Report a bug to help us improve ChainLearn
title: "[Bug] "
labels: bug
assignees: ""
---

## Describe the Bug

A clear and concise description of what the bug is.

## Steps to Reproduce

1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error

## Expected Behavior

A clear and concise description of what you expected to happen.

## Actual Behavior

A clear and concise description of what actually happened.

## Screenshots

If applicable, add screenshots to help explain your problem.

## Environment

- **OS**: [e.g. Windows 11, macOS 14, Ubuntu 22.04]
- **Browser**: [e.g. Chrome 120, Firefox 121, Safari 17]
- **Node.js version**: [e.g. 20.x]
- **Wallet**: [e.g. Freighter, Albedo, or N/A]

## Additional Context

Add any other context about the problem here.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature Request
about: Suggest a new feature or improvement for ChainLearn
title: "[Feature] "
labels: enhancement
assignees: ""
---

## Problem Description

A clear and concise description of what problem this feature would solve. Ex. "I'm always frustrated when [...]"

## Proposed Solution

A clear and concise description of what you want to happen.

## Alternatives Considered

A description of any alternative solutions or features you've considered.

## Additional Context

Add any other context, mockups, or screenshots about the feature request here.
30 changes: 30 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Summary

<!-- REQUIRED. 2-4 sentences describing what this PR does and why. -->

## Type of Change

<!-- Check all that apply. -->

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Refactoring (no functional or behavioral changes)
- [ ] Documentation update
- [ ] Other: <!-- describe -->

## Related Issues

<!-- Link related issues using closing keywords: Fixes #123, Closes #456 -->

## Testing Checklist

- [ ] `npm run lint` passes
- [ ] `npm run typecheck` passes (if available)
- [ ] `npm test` passes (if available)
- [ ] `npm run build` succeeds
- [ ] Tested manually in the browser (if UI change)

## Screenshots (if applicable)

<!-- Add before/after screenshots for UI changes. -->
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# testing
/coverage
test_output.log

# next.js
/.next/
Expand Down
65 changes: 65 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Contributing to ChainLearn

Thank you for your interest in contributing to ChainLearn! This guide will help you get started.

## Getting Started

1. Fork the repository
2. Clone your fork:
```bash
git clone https://github.com/<your-username>/chainlearn-frontend.git
cd chainlearn-frontend
```
3. Install dependencies:
```bash
npm install
```
4. Start the development server:
```bash
npm run dev
```

## Branch Naming

Use descriptive branch names prefixed with the type of change:

- `fix/<short-description>` — bug fixes
- `feat/<short-description>` — new features
- `docs/<short-description>` — documentation changes
- `refactor/<short-description>` — code refactoring

## Commit Conventions

Write clear, concise commit messages:

- Use the imperative mood ("Add feature" not "Added feature")
- Keep the subject line under 72 characters
- Reference related issues in the commit body when applicable

## Testing Requirements

Before submitting a PR, ensure the following pass:

```bash
npm run lint
npm run build
```

If your change affects logic, add or update tests where applicable.

## Pull Request Process

1. Create a feature branch from `main`
2. Make your changes with clear, incremental commits
3. Ensure lint and build pass locally
4. Push to your fork
5. Open a PR against `main` with a clear description
6. Link any related issues using closing keywords (e.g. `Fixes #123`)
7. Respond to review feedback promptly

## Code Style

- Follow the existing code conventions in the codebase
- Use TypeScript for all new code
- Prefer named exports over default exports
- Keep components small and focused
3 changes: 1 addition & 2 deletions src/app/(auth)/onboarding/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ export default function OnboardingPage() {
language,
});
router.push("/dashboard");
} catch (err) {
console.error("Failed to save profile:", err);
} catch {
addToast("Failed to save profile. Please try again.", "error");
} finally {
setSaving(false);
Expand Down
3 changes: 1 addition & 2 deletions src/app/courses/[courseId]/modules/[moduleId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ export default function ModulePage({
try {
await complete();
addToast("Module marked as complete!", "success");
} catch (err) {
console.error("Failed to mark complete:", err);
} catch {
addToast("Failed to mark module as complete.", "error");
} finally {
setCompleting(false);
Expand Down
3 changes: 1 addition & 2 deletions src/app/courses/[courseId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export default function CourseDetailPage({
addToast("Successfully enrolled in the course!", "success");
// Allow the success animation to play before transitioning to progress view
setTimeout(() => setJustEnrolled(false), 1500);
} catch (err) {
console.error("Enrollment failed:", err);
} catch {
addToast("Enrollment failed. Please try again.", "error");
} finally {
setEnrolling(false);
Expand Down
2 changes: 1 addition & 1 deletion src/app/courses/[courseId]/quiz/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function QuizPage({
addToast("Quiz generated successfully! Reloading...", "success");
window.location.reload();
} catch (err) {
console.error(err);

addToast("Failed to generate quiz. Please try again.", "error");
} finally {
setGenerating(false);
Expand Down
4 changes: 2 additions & 2 deletions src/app/credentials/[credentialId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function CredentialDetailPage({
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (error) {
console.error("Failed to copy address:", error);

try {
const textArea = document.createElement("textarea");
textArea.value = address;
Expand All @@ -60,7 +60,7 @@ export default function CredentialDetailPage({
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (fallbackError) {
console.error("Fallback copy failed:", fallbackError);

}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export default function RootLayout({
<ErrorBoundary
showErrorDetails={process.env.NODE_ENV === "development"}
onError={(error, errorInfo) => {
console.error("Application error:", error);
console.error("Component stack:", errorInfo.componentStack);


}}
>
<WalletProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/components/course/quiz-interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function QuizInterface({ quiz, courseId, onSubmit, onRetry, className }:
if (timeExpired && !submittedRef.current && !attempt) {
submittedRef.current = true;
// Auto-submit with whatever answers we have
onSubmit(answers).then(setAttempt).catch(console.error);
onSubmit(answers).then(setAttempt).catch(() => {});
}
}, [timeExpired, answers, onSubmit, attempt]);

Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/avatar-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function AvatarUpload({ currentAvatarUrl, name, onUpload }: AvatarUploadP
setImageSrc(null);
}
} catch (e) {
console.error(e);

addToast('Failed to crop and upload image', 'error');
} finally {
setIsUploading(false);
Expand Down
13 changes: 5 additions & 8 deletions src/components/shared/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ const createDefaultErrorReporter = (): ErrorReportService => {

// Log to console in development
if (context.isDevelopment) {
console.error("[Error Reporter]", payload);

}

// Send to external service (placeholder)
try {
// await fetch('/api/errors', { method: 'POST', body: JSON.stringify(payload) });
} catch (err) {
console.error("Failed to report error:", err);

}
},
};
Expand Down Expand Up @@ -103,9 +103,6 @@ class ErrorBoundaryInner extends React.Component<
if (this.props.onError) {
this.props.onError(error, errorInfo);
}

// Log to console
console.error("ErrorBoundary caught:", error, errorInfo);
}

private reportError = async (error: Error, errorInfo: React.ErrorInfo) => {
Expand All @@ -117,7 +114,7 @@ class ErrorBoundaryInner extends React.Component<
url: typeof window !== "undefined" ? window.location.href : "",
});
} catch (err) {
console.error("Error reporting failed:", err);

}
};

Expand Down Expand Up @@ -145,7 +142,7 @@ class ErrorBoundaryInner extends React.Component<
isRetrying: false,
});
} catch (err) {
console.error("Retry failed:", err);

this.setState({ isRetrying: false });
}
};
Expand Down Expand Up @@ -283,7 +280,7 @@ function ApiErrorDisplay() {
clearError();
setRetryCount(0);
} catch (err) {
console.error("Retry failed:", err);

setRetryCount((prev) => prev + 1);
} finally {
setIsRetrying(false);
Expand Down
4 changes: 1 addition & 3 deletions src/components/shared/route-error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ interface RouteErrorProps {
}

export function RouteError({ error, reset }: RouteErrorProps) {
useEffect(() => {
console.error("Route error:", error);
}, [error]);
useEffect(() => {}, [error]);

return (
<div
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared/share-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function ShareButton({
return;
} catch (err) {
if ((err as Error).name !== 'AbortError') {
console.error('Error sharing', err);

setOpen(true);
}
}
Expand All @@ -64,7 +64,7 @@ export function ShareButton({
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (err) {
console.error('Failed to copy', err);

}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet/balance-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function BalanceDisplay({ className, compact = false }: BalanceDisplayPro
setTimeout(() => setCopied(false), 2000);
} catch (err) {
// Don't report success when nothing was copied (#437).
console.error("Failed to copy contract address", err);

}
},
[contractAddress]
Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet/connect-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function ConnectButton() {
} catch (err) {
// Clipboard can be unavailable (insecure context) or denied; don't
// report success when nothing was copied (#437).
console.error("Failed to copy address", err);

}
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/wallet/wallet-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function WalletProvider({ children }: WalletProviderProps) {
disconnect();
}
} catch (err) {
console.error("Wallet connection check failed:", err);

disconnect();
}
}
Expand Down
Loading
Loading