Skip to content

๐Ÿ’„ style(ModelSelect): add responsive layout for mobile devices #7960

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kingsword09
Copy link
Contributor

๐Ÿ’ป ๅ˜ๆ›ด็ฑปๅž‹ | Change Type

  • โœจ feat
  • ๐Ÿ› fix
  • โ™ป๏ธ refactor
  • ๐Ÿ’„ style
  • ๐Ÿ‘ท build
  • โšก๏ธ perf
  • ๐Ÿ“ docs
  • ๐Ÿ”จ chore

๐Ÿ”€ ๅ˜ๆ›ด่ฏดๆ˜Ž | Description of Change

If the model name is too long for mobile, you can scroll horizontally.
image

closes: #7513

๐Ÿ“ ่กฅๅ……ไฟกๆฏ | Additional Information

Copy link

vercel bot commented May 25, 2025

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

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 25, 2025
@lobehubbot
Copy link
Member

๐Ÿ‘ @kingsword09

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.
้žๅธธๆ„Ÿ่ฐขๆ‚จๆๅ‡บๆ‹‰ๅ–่ฏทๆฑ‚ๅนถไธบๆˆ‘ไปฌ็š„็คพๅŒบๅšๅ‡บ่ดก็Œฎ๏ผŒ่ฏท็กฎไฟๆ‚จๅทฒ็ป้ตๅพชไบ†ๆˆ‘ไปฌ็š„่ดก็ŒฎๆŒ‡ๅ—๏ผŒๆˆ‘ไปฌไผšๅฐฝๅฟซๅฎกๆŸฅๅฎƒใ€‚
ๅฆ‚ๆžœๆ‚จ้‡ๅˆฐไปปไฝ•้—ฎ้ข˜๏ผŒ่ฏท้šๆ—ถไธŽๆˆ‘ไปฌ่”็ณปใ€‚

@dosubot dosubot bot added ๐Ÿ’„ Design Design an style | ๆ ทๅผ้—ฎ้ข˜ ๐Ÿ“ฑ Mobile Device Issue in mobile view | ็งปๅŠจ่ฎพๅค‡ labels May 25, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR improves the mobile UI by adding horizontal scrolling for long model names in the ModelSelect component, preventing truncation on smaller screens.

  • Added useResponsive hook in src/components/ModelSelect/index.tsx to detect mobile devices
  • Set fixed width of 80vw for mobile view containers
  • Implemented horizontal scrolling with overflowX: 'auto' and whiteSpace: 'nowrap' for model names
  • Added overflow: 'hidden' to parent container for proper scroll containment

๐Ÿ’ก (5/5) You can turn off certain types of comments like style here!

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

return (
<Flexbox
align={'center'}
gap={32}
horizontal
justify={'space-between'}
style={{ overflow: 'hidden', position: 'relative' }}
style={{ overflow: 'hidden', position: 'relative', width: mobile ? '80vw' : 'auto' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using a fixed 80vw width could cause layout issues on very small or large mobile screens. Consider using min/max width constraints.

>
<Flexbox align={'center'} gap={8} horizontal style={{ overflow: 'hidden' }}>
<ModelIcon model={model.id} size={20} />
<Typography.Text ellipsis>{model.displayName || model.id}</Typography.Text>
<Typography.Text style={mobile ? { overflowX: 'auto', whiteSpace: 'nowrap' } : {}}>
Copy link
Contributor

Choose a reason for hiding this comment

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

style: overflowX: 'auto' may cause unintended scrollbars. Consider using 'overflow: hidden; text-overflow: ellipsis' with a max-width instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason for displaying horizontal scrollbars is to make it easier for users to know that they can scroll horizontally.

Copy link

codecov bot commented May 25, 2025

Codecov Report

All modified and coverable lines are covered by tests โœ…

Project coverage is 88.47%. Comparing base (fca25e1) to head (ca2961d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7960   +/-   ##
=======================================
  Coverage   88.47%   88.47%           
=======================================
  Files         821      821           
  Lines       60274    60274           
  Branches     3806     3806           
=======================================
  Hits        53325    53325           
  Misses       6949     6949           
Flag Coverage ฮ”
app 88.47% <รธ> (รธ)
server 95.67% <รธ> (รธ)

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.

๐Ÿš€ New features to boost your workflow:
  • โ„๏ธ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • ๐Ÿ“ฆ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿ’„ Design Design an style | ๆ ทๅผ้—ฎ้ข˜ ๐Ÿ“ฑ Mobile Device Issue in mobile view | ็งปๅŠจ่ฎพๅค‡ size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

็งปๅŠจ็ซฏ่ฟ‡้•ฟๆจกๅž‹ๅ็งฐๆ˜พ็คบไธๅฎŒๆ•ด
2 participants