Skip to content

Conversation

@MayankBansal12
Copy link
Member

@MayankBansal12 MayankBansal12 commented Sep 29, 2025

Date: 30-09-2025

Developer Name: @MayankBansal12


Issue Ticket Number

Description

  • Adds createdBy in edit todo modal
  • Removes column for created by from the table

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

working proof
Screencast.mp4

Description by Korbit AI

What change is being made?

Show the Created By value in the edit modal and remove the Created By column from the todo list table; wire Created By through the TodoUtil mapping so the field is available in the edit form.

Why are these changes being made?

To display who created each todo in the edit view without cluttering the list UI; Created By remains in the data layer for consistency and future use.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

@MayankBansal12 MayankBansal12 self-assigned this Sep 29, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • New Features
    • Added a read-only “Created By” field in the todo form when editing, showing the creator’s name if available.
    • Form now preserves creator info from existing data without requiring input.
  • Refactor
    • Removed the “Created By” column from todo and team task tables to streamline the layout.

Walkthrough

Adds optional createdBy to the todo form schema and displays it read-only in the Edit Todo modal. Removes the Created By column from table views. Updates utility to populate createdBy in default form data. No API signatures changed; only returned form data shape expanded.

Changes

Cohort / File(s) Summary
Form schema and modal field
src/components/todos/create-edit-todo-form.tsx
Added optional createdBy to todoFormSchema and TTodoFormData; initialized from initialData; rendered a read-only “Created By” field in edit mode using Controller; imported UserIcon.
Table column removal (Todos list)
src/components/todos/todo-list-table.tsx
Removed “Created By” column header and corresponding row cell.
Default form data util
src/lib/todo-util.ts
getDefaultTodoFormData now returns createdBy as { label, value } when available; function signature unchanged.
Table column removal (Teams tasks)
src/modules/teams/team-tasks.tsx
Removed creator TableCell displaying todo.createdBy?.name; table layout adjusted accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant TL as Todo List
  participant EM as Edit Modal (CreateEditTodoForm)
  participant TU as TodoUtil

  U->>TL: Click "Edit" on a task
  TL->>TU: getDefaultTodoFormData(todo)
  TU-->>TL: { ..., createdBy: {label, value} | undefined }
  TL->>EM: Open modal with initialData
  EM-->>U: Display form (Created By shown read-only if present)
  U->>EM: Save / Close
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • yesyash
  • iamitprakash
  • prakashchoudhary07

Poem

A nibble of schema, a hop to the form,
I tuck “created by” where modals are warm.
Tables slim down, less clutter to see—
The maker now whispers in edit, quietly.
Thump-thump! goes approval in my bunny heart,
Tasks feel tidy; that’s good UI art. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "fix(#200): show createdBy on edit modal and remove from table" accurately describes the two main changes in the changeset: adding the createdBy field to the edit modal (via the form schema and UI in create-edit-todo-form.tsx) and removing the createdBy column from the table views (in todo-list-table.tsx and team-tasks.tsx). The title is concise, clear, and directly reflects the primary changes made across all modified files, making it easy for teammates to understand the purpose of this change when scanning the project history.
Linked Issues Check ✅ Passed The code changes fully address both objectives from issue #200. The PR removes the dedicated createdBy column from the table (changes in todo-list-table.tsx and team-tasks.tsx remove the TableCell displaying todo.createdBy?.name), and it displays the Created By information in the Edit Todo modal (create-edit-todo-form.tsx adds a read-only Controller-based field showing the createdBy value in edit mode). The todo-util.ts changes ensure the createdBy data is properly mapped and available to the form, completing the implementation of both requirements.
Out of Scope Changes Check ✅ Passed All changes in this PR are directly related to the linked issue #200's objectives. The modifications to create-edit-todo-form.tsx (adding createdBy field to form), todo-list-table.tsx (removing createdBy column), team-tasks.tsx (removing createdBy cell), and todo-util.ts (mapping createdBy data) all work together to accomplish the stated goal of moving the creator information from the table to the modal. There are no additions of unrelated features, refactorings, or changes that fall outside the scope of displaying createdBy in the modal and removing it from the table.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed The pull request description clearly relates to the changeset. It explicitly states that the PR "Adds createdBy in edit todo modal" and "Removes column for created by from the table," which directly corresponds to the code changes across all four modified files. The description references issue #200, provides the developer name and date, includes a video demonstration, and contains structured metadata about documentation, feature flags, database changes, and testing status. The AI-generated description further clarifies that the change shows "Created By value in the edit modal and remove the Created By column from the todo list table," which aligns perfectly with the actual modifications to the form schema, table components, and utility functions.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/created-by

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.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@MayankBansal12 MayankBansal12 changed the title feat: show createdBy on edit modal and remove from table fix(#200): show createdBy on edit modal and remove from table Sep 29, 2025
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Unnecessary read-only data in form state ▹ view
Readability Complex Inline Tailwind Classes ▹ view
Files scanned
File Path Reviewed
src/lib/todo-util.ts
src/modules/teams/team-tasks.tsx
src/components/todos/todo-list-table.tsx
src/components/todos/create-edit-todo-form.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8df4d65 and 0790c1c.

📒 Files selected for processing (4)
  • src/components/todos/create-edit-todo-form.tsx (4 hunks)
  • src/components/todos/todo-list-table.tsx (0 hunks)
  • src/lib/todo-util.ts (1 hunks)
  • src/modules/teams/team-tasks.tsx (0 hunks)
💤 Files with no reviewable changes (2)
  • src/components/todos/todo-list-table.tsx
  • src/modules/teams/team-tasks.tsx
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-11T20:28:23.137Z
Learnt from: shobhan-sundar-goutam
PR: Real-Dev-Squad/todo-frontend#204
File: src/lib/todo-util.ts:65-70
Timestamp: 2025-09-11T20:28:23.137Z
Learning: In todo-frontend repository, TTaskCreatedBy.id is already a string type, so no type conversion is needed when mapping it to form schema fields that expect strings.

Applied to files:

  • src/components/todos/create-edit-todo-form.tsx
🔇 Additional comments (4)
src/lib/todo-util.ts (1)

65-70: LGTM! Clean implementation of createdBy field mapping.

The mapping logic correctly transforms todo.createdBy into the expected form data shape with label and value fields, and properly handles the case when createdBy is absent by returning undefined. This aligns perfectly with the optional schema definition in the form component.

src/components/todos/create-edit-todo-form.tsx (3)

19-19: LGTM! Proper icon import.

The UserIcon import follows best practices for lucide-react with named imports for tree-shaking. Based on learnings.


43-48: LGTM! Schema correctly defines createdBy as optional.

The schema structure matches the data shape returned by getDefaultTodoFormData in todo-util.ts, with label and value fields. Marking it optional is appropriate since not all contexts may provide creator information.


143-143: LGTM! Proper initialization of createdBy field.

The default value initialization correctly uses the optional chaining and fallback pattern consistent with other form fields.

Comment on lines +338 to +358
{mode === 'edit' && (
<Controller
control={control}
name="createdBy"
render={({ field }) => (
<FormInput
label="Created By"
htmlFor="createdBy"
icon={UserIcon}
errorMessage={errors.createdBy?.message}
>
<Input
{...field}
value={field.value?.label ?? '--'}
readOnly
className="cursor-default border-0 text-gray-700 shadow-none focus:ring-0 focus:outline-none focus-visible:ring-0"
/>
</FormInput>
)}
/>
)}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Simplify field props for read-only input.

The {...field} spread on line 350 passes unnecessary handlers (onChange, onBlur, etc.) to a read-only Input. For a read-only field, only name and ref are needed.

Apply this diff to pass only the necessary props:

                <FormInput
                  label="Created By"
                  htmlFor="createdBy"
                  icon={UserIcon}
                  errorMessage={errors.createdBy?.message}
                >
                  <Input
-                    {...field}
+                    name={field.name}
+                    ref={field.ref}
                    value={field.value?.label ?? '--'}
                    readOnly
                    className="cursor-default border-0 text-gray-700 shadow-none focus:ring-0 focus:outline-none focus-visible:ring-0"
                  />
                </FormInput>

Alternatively, if you want to keep accessibility attributes, you can also add aria-readonly="true" for better screen reader support:

                  <Input
-                    {...field}
+                    name={field.name}
+                    ref={field.ref}
                    value={field.value?.label ?? '--'}
                    readOnly
+                    aria-readonly="true"
                    className="cursor-default border-0 text-gray-700 shadow-none focus:ring-0 focus:outline-none focus-visible:ring-0"
                  />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{mode === 'edit' && (
<Controller
control={control}
name="createdBy"
render={({ field }) => (
<FormInput
label="Created By"
htmlFor="createdBy"
icon={UserIcon}
errorMessage={errors.createdBy?.message}
>
<Input
{...field}
value={field.value?.label ?? '--'}
readOnly
className="cursor-default border-0 text-gray-700 shadow-none focus:ring-0 focus:outline-none focus-visible:ring-0"
/>
</FormInput>
)}
/>
)}
{mode === 'edit' && (
<Controller
control={control}
name="createdBy"
render={({ field }) => (
<FormInput
label="Created By"
htmlFor="createdBy"
icon={UserIcon}
errorMessage={errors.createdBy?.message}
>
<Input
name={field.name}
ref={field.ref}
value={field.value?.label ?? '--'}
readOnly
className="cursor-default border-0 text-gray-700 shadow-none focus:ring-0 focus:outline-none focus-visible:ring-0"
/>
</FormInput>
)}
/>
)}
🤖 Prompt for AI Agents
In src/components/todos/create-edit-todo-form.tsx around lines 338 to 358, the
Controller currently spreads {...field} into a read-only Input which passes
unnecessary event handlers; replace the spread with only the minimal props
required for a read-only field (e.g., name, ref and value) and set readOnly plus
aria-readonly="true" on the Input to preserve accessibility while avoiding
onChange/onBlur handlers being passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show created by in the modal, not on table

2 participants