Skip to content
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

💄 style: 移动端菜单按钮常显 & 长按直接显示菜单 #2330

Open
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

sxjeru
Copy link
Contributor

@sxjeru sxjeru commented May 1, 2024

💻 变更类型 | Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • ⚡️ perf
  • 📝 docs

🔀 变更说明 | Description of Change

From #2329

  • 助手列表默认显示所有“菜单”按钮。目前需点击才显示,但点击后会直接跳转进入对话,导致无法点按菜单项。
  • 话题列表默认显示所有话题的“菜单”按钮。目前需长按或点击显示。
助手、话题列表项长按(桌面端为右键)直接显示出菜单。#1920
  • 助手实现(拿不到正确的触发区域,部分移动端浏览器无法触发)
    经测试移动端 chrome、雨见浏览器支持,而 Via 不支持触发。
  • 话题实现(触发区域挡住收藏按钮)
    zIndex 可解决,或者更改元素排列顺序,并设置排列方向从右到左。
  • 持久显示话题菜单(目前鼠标移出话题自动关闭菜单)
  • fix:助手列表会显示双菜单
  • 正常显示菜单关闭动画(可能无法实现
  • 移动端助手列表会话时间改进(考虑移动端直接不显示菜单按钮,这样也不会遮盖时间了

助手列表默认显示菜单按钮的话,会话时间会被隐藏。目前倾向于显示在菜单按钮的左边或者上方。
具体列表项样式可能需要在 lobe-ui 修改。

已知 IOS Safari 不支持长按触发 oncontextmenu 事件,待议。

📝 补充信息 | Additional Information

close #2329
close #1749
replace #1863
相关 #1920 (该 issue 希望所有菜单都能右键,个人反觉不妥,可以只支持上面两处。)

Copy link

vercel bot commented May 1, 2024

@sxjeru is attempting to deploy a commit to the LobeHub Team on Vercel.

A member of the Team first needs to authorize it.

@lobehubbot
Copy link
Member

👍 @sxjeru

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

Copy link

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.04%. Comparing base (2a937bc) to head (058b3dd).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2330      +/-   ##
==========================================
- Coverage   92.08%   92.04%   -0.04%     
==========================================
  Files         460      460              
  Lines       31551    31573      +22     
  Branches     2152     2151       -1     
==========================================
+ Hits        29053    29062       +9     
- Misses       2498     2511      +13     
Flag Coverage Δ
app 92.04% <ø> (-0.04%) ⬇️
server 97.36% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

position: 'absolute',
}}/>
</Dropdown>
</Item>
Copy link
Contributor Author

@sxjeru sxjeru May 2, 2024

Choose a reason for hiding this comment

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

考虑把触发区域放在 SessionList Item 子元素,发现两个问题需要协助:

  1. 触发区域 div 渲染在最后,导致先渲染的其他 item 子元素被覆盖。zIndex 不太合适。
    一种解决方案是能否让 div 先渲染,然后再是 item 内置的其他子元素。
  2. Dropdown 的 menu 不在此文件,如何从原 Actions 里复制或暴露相同内容。
    如果能给一个类似的例子,想必这边能照猫画虎解决。

均已解决。

Copy link
Contributor

@arvinxx arvinxx May 3, 2024

Choose a reason for hiding this comment

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

你看下这个分支: https://github.com/lobehub/lobe-chat/tree/feat/group-backup 这是最早尝试的支持右键的方案,其实在方案完整性上已经差不多了,就是 iOS 的支持有问题。看下这个有没有参考价值

Copy link
Contributor

@arvinxx arvinxx May 3, 2024

Choose a reason for hiding this comment

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

另外其实我更倾向于 在 mobile 上不直接使用 desktop 的 session item,而是使用 mobile 特有的交互,比如这种: https://mobile.ant.design/zh/components/swipe-action 。这样体验会更好

Copy link
Contributor Author

@sxjeru sxjeru May 3, 2024

Choose a reason for hiding this comment

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

类似于左滑显示菜单按钮吗?不知 antd mobile 组件能否直接用于 antd 的 List,还是要新建对象。

这边写不了复杂代码,估计会在原本目标实现后再看看,很可能不会实现。

Copy link
Contributor

Choose a reason for hiding this comment

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

类似于左滑显示菜单按钮吗?

不知 antd mobile 组件能否直接用于 antd 的 List,还是要新建对象。

如果要用 antd mobile,整个 list 是需要使用 mobile 这一套重新实现的。所以我现在也没这么去做

@sxjeru sxjeru mentioned this pull request May 3, 2024
8 tasks
@sxjeru sxjeru marked this pull request as ready for review May 4, 2024 02:34
@sxjeru
Copy link
Contributor Author

sxjeru commented May 4, 2024

本次提交有较大改动,涉及简单重构,烦请耐心审阅。 922abf2

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This submission has major changes and involves simple refactoring. Please review it patiently. 922abf2

@arvinxx
Copy link
Contributor

arvinxx commented May 4, 2024

我看涉及到了 chat 路由相关的变动,然后我们最近在做 chat layout 的重构 #2339 ,可能 review 要等这个PR合并完毕之后才会开始

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I see that changes related to chat routing are involved, and we are currently refactoring the chat layout #2339. Maybe the review will not start until this PR is merged.

@sxjeru
Copy link
Contributor Author

sxjeru commented May 4, 2024

不急,主线为重。届时等相关pr合并后再修。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Don't be in a hurry, focus on the main line. It will be revised after the relevant PRs are merged.

@canisminor1990
Copy link
Member

这个问题后面改成右键菜单 context menu 就可以解了吧?右键菜单到移动端自然就变成长按唤起了

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


This problem can be solved later by changing it to the right-click menu context menu, right? The right-click menu on the mobile terminal will naturally become a long press to call it up.

@sxjeru
Copy link
Contributor Author

sxjeru commented May 8, 2024

通过略微延迟菜单按钮的消失,使菜单关闭动画能完整显示,希望可以接受。 8b4d9ac

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


By slightly delaying the disappearance of the menu button, the menu closing animation can be fully displayed, which I hope is acceptable. 8b4d9ac

Copy link

vercel bot commented May 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lobe-chat-community ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 27, 2024 2:34am

@sxjeru
Copy link
Contributor Author

sxjeru commented May 27, 2024

或许可以把这个pr拆了,先让“移动端菜单按钮常显”实现再说,不然移动端目前根本无法展开助手菜单。
(这样的话会话时间会被遮盖)

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Perhaps this PR can be dismantled and the "mobile menu button always displayed" can be implemented first, otherwise the mobile terminal cannot currently expand the assistant menu.

@arvinxx
Copy link
Contributor

arvinxx commented Jul 29, 2024

@sxjeru 这个 PR 重新 rebase 下,时间线理一下

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@sxjeru Rebase this PR and sort out the timeline

@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] 移动端长按显示菜单 [Bug] more button not show on mobile
4 participants