feat: integrate quiz actions with chat composer#95
Conversation
- Update quiz actions in sidebar, create menu, and context menu to open chat panel - Fill composer input with 'Create a quiz about ' when quiz action is triggered - Focus composer input after setting text for better UX - Reorganize menus: create 'Learn' submenu with Flashcards and Quiz - Move YouTube and Deep Research to 'Other' submenu - Update icons to match SidebarQuickActions (LuBook for Learn, PiCardsThreeFill for Flashcards)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThree workspace canvas components now support quiz creation through consistent user actions. Each component imports a composer utility to open the chat, pre-fill a quiz prompt, focus the input field, and display a success notification when users trigger the new Quiz action. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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
Comment |
|
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 799fbec in 1 minute and 29 seconds. Click for details.
- Reviewed
173lines of code in3files - Skipped
0files when reviewing. - Skipped posting
3draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/components/workspace-canvas/SidebarQuickActions.tsx:94
- Draft comment:
The quiz creation logic (open chat, set composer text, focus input, toast) is duplicated here. Consider extracting it into a shared helper to improve consistency and reduce code repetition. Also, using optional chaining (e.g. api?.composer()) might help make the code more robust. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
2. src/components/workspace-canvas/WorkspaceHeader.tsx:675
- Draft comment:
The quiz action onClick handler repeats the same logic seen elsewhere (open chat, set composer text, focus input, toast). Extracting this functionality into a common function would improve maintainability. Also, ensure consistent use of optional chaining for api calls. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
3. src/components/workspace-canvas/WorkspaceSection.tsx:579
- Draft comment:
The quiz creation logic is duplicated here as well. Consider refactoring it into a shared helper to reduce redundancy and potential inconsistencies (e.g., ordering of chat expansion vs. toast). Consistent handling (including optional chaining for api) would improve readability and maintainability. - Reason this comment was not posted:
Confidence changes required:50%<= threshold50%None
Workflow ID: wflow_c8j1aLKDRoHNWtWh
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| import type React from "react"; | ||
| import { useState, useRef, useEffect, useCallback } from "react"; | ||
| import { Search, X, ChevronRight, ChevronDown, FolderOpen, ChevronLeft, Plus, Upload, Layers, FileText, Folder, Settings, Share2, Play, MoreHorizontal, Globe } from "lucide-react"; | ||
| import { Search, X, ChevronRight, ChevronDown, FolderOpen, ChevronLeft, Plus, Upload, Layers, FileText, Folder, Settings, Share2, Play, MoreHorizontal, Globe, Brain } from "lucide-react"; |
| } from "@/components/ui/context-menu"; | ||
|
|
||
| import { FileText, Layers, Folder, Upload, Play, Plus, MoreHorizontal, Globe } from "lucide-react"; | ||
| import { FileText, Layers, Folder, Upload, Play, Plus, MoreHorizontal, Globe, Brain } from "lucide-react"; |
Greptile SummaryIntegrated quiz creation functionality with the chat composer across three UI components (sidebar, header dropdown, and context menu). When users click the quiz action, it opens the chat panel and pre-fills the composer with "Create a quiz about " to streamline the workflow. Key changes:
The implementation is consistent across all three files and follows existing patterns for similar actions like Deep Research. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Menu as Menu/Sidebar/Context
participant Handler as Quiz Handler
participant Chat as Chat Panel
participant Composer as Composer API
participant Input as Composer Input
User->>Menu: Click Quiz Action
Menu->>Handler: handleQuizClick()
alt Chat is not expanded
Handler->>Chat: setIsChatExpanded(true)
Chat-->>Handler: Opens chat panel
end
Handler->>Composer: api.composer().setText("Create a quiz about ")
Composer-->>Input: Sets text in composer
Handler->>Input: focusComposerInput()
Note over Input: setTimeout 100ms
Input-->>Input: Focus composer textarea
Handler->>User: toast.success("Quiz creation started")
User-->>Input: Types quiz topic
|
There was a problem hiding this comment.
Additional Comments (1)
-
src/components/workspace-canvas/WorkspaceHeader.tsx, line 713 (link)logic: same issue as line 682 - optional chaining doesn't prevent error when calling
.setText()on undefined
3 files reviewed, 2 comments
| setIsChatExpanded(true); | ||
| } | ||
| // Fill composer with quiz creation prompt | ||
| api?.composer().setText("Create a quiz about "); |
There was a problem hiding this comment.
logic: optional chaining on api doesn't prevent the error - if api is undefined, api?.composer() returns undefined, then calling .setText() on undefined throws an error
| api?.composer().setText("Create a quiz about "); | |
| api.composer().setText("Create a quiz about "); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/components/workspace-canvas/WorkspaceHeader.tsx
Line: 682:682
Comment:
**logic:** optional chaining on `api` doesn't prevent the error - if `api` is undefined, `api?.composer()` returns undefined, then calling `.setText()` on undefined throws an error
```suggestion
api.composer().setText("Create a quiz about ");
```
How can I resolve this? If you propose a fix, please make it concise.


Important
Integrate quiz actions with chat composer, reorganize menus, and update icons in
SidebarQuickActions.tsx,WorkspaceHeader.tsx, andWorkspaceSection.tsx.SidebarQuickActions.tsx,WorkspaceHeader.tsx, andWorkspaceSection.tsxnow open the chat panel and fill the composer input with 'Create a quiz about '.LuBookfor Learn andPiCardsThreeFillfor Flashcards inWorkspaceHeader.tsxandWorkspaceSection.tsx.This description was created by
for 799fbec. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.