Conversation
📝 WalkthroughWalkthroughThis PR introduces a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~35 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
shared-module/packages/common/src/components/DataLoadError.tsx (1)
9-37: Make this shared component either configurable or explicitly non-customizable.
DataLoadErroris typed withPropsWithChildren, but it never renderschildren, and the message is fixed. That leaves a misleading public API and is already pushing some callers in this PR back to inline banner+retry markup. Either dropPropsWithChildren, or add amessage/childrenslot so those sites can reuse this component cleanly.♻️ Possible cleanup
export interface DataLoadErrorProps { onRetry: () => void | Promise<void> buttonVariant?: React.ComponentProps<typeof Button>["variant"] buttonSize?: React.ComponentProps<typeof Button>["size"] + message?: React.ReactNode } /** * Renders a generic data load error with a retry button. */ -const DataLoadError: React.FC<React.PropsWithChildren<DataLoadErrorProps>> = ({ +const DataLoadError: React.FC<DataLoadErrorProps> = ({ onRetry, buttonVariant = "primary", buttonSize = "medium", + message, }) => { const { t } = useTranslation() return ( <div> - <ErrorBanner variant={"readOnly"} error={t("label-error-loading")} /> + <ErrorBanner variant={"readOnly"} error={message ?? t("label-error-loading")} /> <Button variant={buttonVariant} size={buttonSize}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shared-module/packages/common/src/components/DataLoadError.tsx` around lines 9 - 37, The component DataLoadError currently declares React.PropsWithChildren in its signature but never renders children and has a fixed message; update the public API to be honest: either remove PropsWithChildren and the ability to pass children by changing the component type to React.FC<DataLoadErrorProps> (keep DataLoadErrorProps as-is) or add a configurable message/slot by extending DataLoadErrorProps with a message?: React.ReactNode (or exposing children) and render that value in place of the hard-coded t("label-error-loading") so callers can provide custom text while retaining onRetry, buttonVariant, and buttonSize behavior.services/main-frontend/src/app/manage/courses/[id]/exercises/ExerciseRepositories.tsx (1)
59-61: UseSpinnercomponent for loading state instead of text.This loading state uses a plain
<div>with translated text, which is inconsistent with the other files in this PR and violates the coding guideline that states loading states should use theSpinnercomponent from the shared module.Suggested fix
if (exerciseRepositories.isLoading) { - return <div>{t("loading-text")}</div> + return <Spinner variant="medium" /> }Note: You'll need to add the import if not already present:
import Spinner from "@/shared-module/common/components/Spinner"As per coding guidelines: "For loading and error states, use the Spinner and ErrorBanner components from the shared module."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@services/main-frontend/src/app/manage/courses/`[id]/exercises/ExerciseRepositories.tsx around lines 59 - 61, Replace the plain <div> loading text in the ExerciseRepositories component's loading branch (the block checking exerciseRepositories.isLoading) with the shared Spinner component; add the import "import Spinner from '@/shared-module/common/components/Spinner'" if missing and render <Spinner /> (or Spinner with any existing layout wrappers used elsewhere) instead of returning the translated loading-text div so the component follows the project's loading-state convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@shared-module/packages/common/src/locales/en/shared-module.json`:
- Line 14: The new i18n key "button-text-try-again" added for DataLoadError.tsx
exists only in en/shared-module.json; add the same key to every other locale's
shared-module.json (or their equivalent locale JSONs) so all locales have this
key (use proper translations or English as a placeholder), ensuring consistency
of keys across locales and running any i18n validation/linting to catch missing
keys.
---
Nitpick comments:
In
`@services/main-frontend/src/app/manage/courses/`[id]/exercises/ExerciseRepositories.tsx:
- Around line 59-61: Replace the plain <div> loading text in the
ExerciseRepositories component's loading branch (the block checking
exerciseRepositories.isLoading) with the shared Spinner component; add the
import "import Spinner from '@/shared-module/common/components/Spinner'" if
missing and render <Spinner /> (or Spinner with any existing layout wrappers
used elsewhere) instead of returning the translated loading-text div so the
component follows the project's loading-state convention.
In `@shared-module/packages/common/src/components/DataLoadError.tsx`:
- Around line 9-37: The component DataLoadError currently declares
React.PropsWithChildren in its signature but never renders children and has a
fixed message; update the public API to be honest: either remove
PropsWithChildren and the ability to pass children by changing the component
type to React.FC<DataLoadErrorProps> (keep DataLoadErrorProps as-is) or add a
configurable message/slot by extending DataLoadErrorProps with a message?:
React.ReactNode (or exposing children) and render that value in place of the
hard-coded t("label-error-loading") so callers can provide custom text while
retaining onRetry, buttonVariant, and buttonSize behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cfc45870-9ffe-4bd6-b08b-ff5ddc78c4c2
📒 Files selected for processing (22)
services/main-frontend/src/app/manage/course-instances/[id]/course-status-summary-for-user/[user_id]/page.tsxservices/main-frontend/src/app/manage/courses/[id]/change-requests/EditProposalList.tsxservices/main-frontend/src/app/manage/courses/[id]/change-requests/EditProposalPage.tsxservices/main-frontend/src/app/manage/courses/[id]/exercises/ExerciseRepositories.tsxservices/main-frontend/src/app/manage/courses/[id]/feedback/FeedbackList.tsxservices/main-frontend/src/app/manage/courses/[id]/feedback/FeedbackPage.tsxservices/main-frontend/src/app/manage/courses/[id]/pages/CourseModules.tsxservices/main-frontend/src/app/manage/courses/[id]/stats/visualizations/overview/CourseUsersCountsByExercise.tsxservices/main-frontend/src/app/manage/courses/[id]/stats/visualizations/user-activity/CourseSubmissionsByWeekdayAndHour.tsxservices/main-frontend/src/app/manage/courses/[id]/user-status-summary/[user_id]/page.tsxservices/main-frontend/src/app/manage/pages/[id]/history/HistoryPage.tsxservices/main-frontend/src/app/manage/regradings/[id]/page.tsxservices/main-frontend/src/app/manage/regradings/page.tsxservices/main-frontend/src/app/manage/users/[id]/CourseEnrollmentsList.tsxservices/main-frontend/src/app/manage/users/[id]/page.tsxservices/main-frontend/src/components/course-material/ContentRenderer/moocfi/ExerciseBlock/PeerOrSelfReviewView/PeerOrSelfReviewsReceivedComponent/index.tsxservices/main-frontend/src/components/course-material/ContentRenderer/moocfi/ExerciseBlock/index.tsxservices/main-frontend/src/components/course-material/ContentRenderer/moocfi/Glossary/Glossary.tsxservices/main-frontend/src/components/course-material/ContentRenderer/moocfi/NavigationContainer/NextPage.tsxservices/main-frontend/src/components/course-material/notifications/UserOnWrongCourseNotification.tsxshared-module/packages/common/src/components/DataLoadError.tsxshared-module/packages/common/src/locales/en/shared-module.json
Summary by CodeRabbit
Release Notes
New Features
Localization