-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🎨 Enable to update submission status from drop down in task list by grades and detailed workbook page (#1858) #1859
base: staging
Are you sure you want to change the base?
Conversation
…rades and detailed workbook page (#1858)
WalkthroughThis pull request introduces a new Svelte component, Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant TS as SubmissionStatusInTableBodyCell
participant UD as UpdatingDropdown
participant P as Parent Component
U->>TS: Click on submission status cell
TS->>UD: Toggle dropdown visibility
U->>UD: Select new status option
UD->>P: Emit onupdate event with updated task result
P->>P: Update task result state internally
P->>TS: Re-render with updated submission status
Assessment against linked issues
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (2)
src/lib/components/SubmissionStatus/SubmissionStatusInTableBodyCell.svelte (1)
1-30
: New component looks good, but consider UX implicationsThe new component nicely encapsulates the submission status display and update functionality within a table cell.
Two aspects to consider:
- The entire TableBodyCell is clickable to toggle the dropdown (line 22). Users might expect only an icon or button to be clickable - this could be confusing if they click anywhere in the cell. Consider making the click target more explicit.
- The UpdatingDropdown (line 29) is placed outside TableBodyCell unlike other implementations. Unlike in TaskTableBodyCell.svelte, no
dropdownClass
is specified here for positioning. Consider adding consistent positioning to ensure the dropdown appears correctly.src/lib/components/SubmissionStatus/UpdatingDropdown.svelte (1)
181-181
: Consider translating comment to English.For better maintainability and international collaboration, consider translating the Japanese comment to English. While the comment provides helpful context about the workaround for dropdown handling, maintaining all code comments in a single language improves codebase consistency.
- <!-- HACK: classの設定は、テーブルの上部・下部をクリックしたときに、いずれもドロップダウンを操作できるようにするための苦肉の策 --> + <!-- HACK: This class setting is a workaround to allow dropdown operation when clicking on the top or bottom of the table -->
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/lib/components/SubmissionStatus/SubmissionStatusInTableBodyCell.svelte
(1 hunks)src/lib/components/SubmissionStatus/UpdatingDropdown.svelte
(6 hunks)src/lib/components/TaskList.svelte
(3 hunks)src/lib/components/TaskTables/TaskTableBodyCell.svelte
(1 hunks)src/routes/workbooks/[slug]/+page.svelte
(3 hunks)
🔇 Additional comments (14)
src/lib/components/TaskTables/TaskTableBodyCell.svelte (1)
68-74
: Proper positioning for the updating dropdownThe addition of
dropdownClass="left-auto right-0 mt-8"
provides proper styling for dropdown positioning, ensuring it appears correctly relative to the button.src/lib/components/TaskList.svelte (2)
35-47
: Good implementation of direct task result updatesThe
updateTaskResult
function correctly updates the specific task in the array when changes occur. This is a cleaner approach than using modal-based updates.
94-100
: Check potential padding duplicationThe integration with the new component looks good, but note that you're wrapping SubmissionStatusTableBodyCell in a div with padding classes "px-1 sm:px-3", while the component itself already has padding defined in its implementation (line 21 in SubmissionStatusInTableBodyCell.svelte).
Verify that this doesn't create excessive padding or inconsistent spacing across the UI.
src/routes/workbooks/[slug]/+page.svelte (1)
46-55
: Good map-based implementation for task result updatesThe
updateTaskResult
function correctly updates the task result in the map when changes occur. The approach with creating a new Map instance is appropriate for maintaining reactivity.src/lib/components/SubmissionStatus/UpdatingDropdown.svelte (10)
12-12
: Good addition of optional property for styling customization.The addition of an optional
dropdownClass
property to the Props interface allows for more flexible styling when this component is used in different contexts, such as in the task list table.
15-15
: Good implementation of destructuring with default value.The destructuring has been properly updated to include the new
dropdownClass
parameter with a default empty string value, which is a good practice for optional properties.
48-48
: Consistent interface definition.The Props interface is consistently updated here to match the usage section, which is good for maintaining coherence throughout the component.
51-51
: Consistent props destructuring.The destructuring correctly mirrors what's defined in the interface Props, with appropriate default value for the optional parameter.
72-72
: Improved type safety for handleClick function.Replacing the inline type definition with a reference to the SubmissionStatus type enhances type safety and maintainability.
93-93
: Proper type extension for new feature.Adding the imagePath property to the SubmissionStatus type is necessary to support the feature of displaying and updating status images.
160-160
: Correctly updates image path during status change.The submission_status_image_path is now properly set from the submissionStatus object, ensuring visual consistency when status is updated.
162-163
: Logic update for accepted submission status.The condition for setting
is_ac
now includes bothac
andac_with_editorial
statuses. Consider documenting this change clearly if this represents a change in business logic, as it affects which submissions are considered as accepted.Are there other components that rely on the
is_ac
property that might need to be updated to handle both statuses?
174-174
: Consistent inclusion of imagePath in submission options.The imagePath is now correctly included when mapping submission status options, ensuring the data structure consistency throughout the component.
186-186
: Effective dropdown styling with dynamic class.The class attribute now correctly incorporates the
dropdownClass
variable, allowing for context-specific styling. This is key to the PR objective of enhancing the dropdown's flexibility across different UI contexts.
<!-- 回答状況 --> | ||
<div class=""> | ||
<SubmissionStatusTableBodyCell | ||
taskResult={getTaskResult(workBookTask.taskId)} | ||
{isLoggedIn} | ||
onupdate={(updatedTask: TaskResult) => updateTaskResult(updatedTask)} | ||
/> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TableBodyCell consistency issue
Unlike other cells in this table row, the SubmissionStatusTableBodyCell is wrapped in a regular div instead of a TableBodyCell component. This inconsistency could cause layout issues.
Apply this change to maintain consistent table structure:
- <!-- 回答状況 -->
- <div class="">
- <SubmissionStatusTableBodyCell
- taskResult={getTaskResult(workBookTask.taskId)}
- {isLoggedIn}
- onupdate={(updatedTask: TaskResult) => updateTaskResult(updatedTask)}
- />
- </div>
+ <!-- 回答状況 -->
+ <TableBodyCell class="">
+ <SubmissionStatusTableBodyCell
+ taskResult={getTaskResult(workBookTask.taskId)}
+ {isLoggedIn}
+ onupdate={(updatedTask: TaskResult) => updateTaskResult(updatedTask)}
+ />
+ </TableBodyCell>
📝 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.
<!-- 回答状況 --> | |
<div class=""> | |
<SubmissionStatusTableBodyCell | |
taskResult={getTaskResult(workBookTask.taskId)} | |
{isLoggedIn} | |
onupdate={(updatedTask: TaskResult) => updateTaskResult(updatedTask)} | |
/> | |
</div> | |
<!-- 回答状況 --> | |
<TableBodyCell class=""> | |
<SubmissionStatusTableBodyCell | |
taskResult={getTaskResult(workBookTask.taskId)} | |
{isLoggedIn} | |
onupdate={(updatedTask: TaskResult) => updateTaskResult(updatedTask)} | |
/> | |
</TableBodyCell> |
close #1858
Summary by CodeRabbit
New Features
Refactor
Style