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

🐛 fix: user feedback for empty/long group names in create/edit group modals #5077

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

Conversation

ramu-narasinga
Copy link

💻 变更类型 | Change Type

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

🔀 变更说明 | Description of Change

To show an alert when the user submits an empty or long group name in Create Group and Rename Group Modals.

📝 补充信息 | Additional Information

  1. Removed the below if block in CreateModal
 onOk={async (e: MouseEvent<HTMLButtonElement>) => {
            if (!input) return;

To allow the input length check that shows an alert if the title does not meet the criteria.

  1. Removed the below if block in RenameGroupModal
 onOk={async (e: MouseEvent<HTMLButtonElement>) => {
            if (!input) return;

To allow the input length check that shows an alert if the title does not meet the criteria.

2.1 And this forced to ensure types are valid for input state variable, as a result input state is initialized to '' (empty string - following the same convention in CreateGroupModal)

const [input, setInput] = useState<string>('');

2.2 Added fallback to empty string in the onCancel, in case the group.name is empty.

onCancel={(e) => {
        setInput(group?.name ?? '');
        onCancel?.(e);
      }}

Copy link

vercel bot commented Dec 18, 2024

@ramn11 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 Dec 18, 2024
@lobehubbot
Copy link
Member

👍 @ramn11

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 the 🐛 Bug Something isn't working | 缺陷 label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷 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