-
Notifications
You must be signed in to change notification settings - Fork 66
feat: add pattern copy and paste #64
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
Conversation
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.
2 issues found across 7 files
Prompt for AI agents (all 2 issues)
Understand the root cause of the following 2 issues and fix them.
<file name="frontend/src/components/ContributionCalendar.tsx">
<violation number="1" location="frontend/src/components/ContributionCalendar.tsx:814">
Copy shortcut handling only checks Ctrl+C, so the advertised Cmd+C path on macOS never fires and users cannot copy via the keyboard.</violation>
<violation number="2" location="frontend/src/components/ContributionCalendar.tsx:828">
Paste shortcut handling ignores Cmd+V (metaKey), so macOS users cannot paste via the keyboard despite the feature description promising that shortcut.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
add Cmd+C Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
add Cmd+V Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
|
hi兄弟非常感谢你的贡献!我周末再看看 |
zmrlft
left a comment
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.
https://github.com/user-attachments/assets/fcbf04ef-f00b-425b-98d0-50f236dfc066
hi兄弟,感谢你的贡献,发现了两个问题,看看能不能解决:
- 粘贴的时候会覆盖掉之前复制的内容
- 和预设字符功能产生了冲突,当我选择一个预设字符的时候,我再也无法右键取消字符预览,左键应用字符了
|
hi,很抱歉之前我没有测验清楚就匆忙pr了,我这边已经根据你提到的两个问题做了修复。 |
| const coord = getDateCoord(dateStr); | ||
| const current = | ||
| userContributions.get(dateStr) ?? | ||
| filteredContributions.find((x) => x.date === dateStr)?.count ?? |
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.
被你这么一写,我发现之前设计的这个filteredContributions数据结构有点不合理,因为纵观整页代码,出现了很多次filteredContributions.find()的操作,数组find的时间复杂度是O(n)你这里外层还有一个for(const dateStr of set)那么时间复杂度会来到O(n * m)虽然对现代计算机来说,不会使复制操作卡顿,但是这里确实是可以优化一下~比如把filteredContributions转化成map。这样用map来查询时间复杂度会降为O(1)总的会来到O(n + m)
你的代码我先合并了,这个问题我是看到你这么写突然想到的,你不用改,感谢你的贡献!
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.
欸也不对,这里还是得保留filteredContributions这个数组结构,因为组件里很多地方(渲染、统计)都需要 filteredContributions,所以原数组仍要保留,不能直接替换。在此基础上再派生一个 Map就差不多。
Summary / 概要
This PR adds canvas region copy & paste support for GreenWall, as requested in Issue #48.
本 PR 为 GreenWall 的贡献画布增加了区域复制 / 粘贴功能,对应需求见 Issue #48。
What I changed / 具体改动
Selection & copy
Paste
UI & state
How to use / 使用方式
If there is any feedback on interaction details or shortcuts, I'm happy to adjust this implementation. 🙌
如果在交互细节或快捷键上有任何建议,我也可以根据反馈继续调整实现。🙌
Summary by cubic
Adds region copy and paste to the contribution calendar so you can reuse patterns quickly. Implements the workflow requested in Issue #48.
New Features
Bug Fixes
Written for commit b3a962d. Summary will update automatically on new commits.