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

docs: add self-hosting license form #1911

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Conversation

jobenjada
Copy link
Member

  1. add self-hosting license form
  2. make verify email work with colored BGs (and testing cards look 😎 )
image

Copy link
Contributor

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

apps/web/app/s/[surveyId]/components/VerifyEmail.tsx

It's a good practice to separate the logic of validating the email into a utility function. This makes the code more readable and maintainable. It also allows for reusability of the validation logic in other parts of the application where email validation might be needed.
Create Issue
See the diff
Checkout the fix

    // utils/validateEmail.js
    export const validateEmail = (inputEmail) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(inputEmail);
    ```
    Then, you can import this function in your component:
    ```JavaScript
    import { validateEmail } from 'utils/validateEmail';
git fetch origin && git checkout -b ReviewBot/Impro-e3k4d8n origin/ReviewBot/Impro-e3k4d8n

It's a good practice to use React's useCallback hook for functions that are used in event handlers or effects. This ensures that the function is not recreated on every render, which can lead to unnecessary re-renders and performance issues. It also makes the code more readable and easier to understand.
Create Issue
See the diff
Checkout the fix

    const submitEmail = useCallback(async (email) => {
      setIsLoading(true);
      if (!validateEmail(email)) {
        toast.error("Please enter a valid email");
        setIsLoading(false);
        return;
      }
      const data = {
        surveyId: survey.id,
        email: email,
        surveyData: survey.verifyEmail,
      };
      try {
        await sendLinkSurveyEmailAction(data);
        setEmailSent(true);
      } catch (error) {
        toast.error(error.message);
      }
      setIsLoading(false);
    }, [survey, validateEmail, sendLinkSurveyEmailAction]);

    const handleKeyPress = useCallback((e) => {
      if (e.key === "Enter") {
        submitEmail(email);
      }
    }, [email, submitEmail]);
git fetch origin && git checkout -b ReviewBot/Impro-vy6oig8 origin/ReviewBot/Impro-vy6oig8

@jobenjada
Copy link
Member Author

ready to merge 🚀

@mattinannt mattinannt added this pull request to the merge queue Jan 17, 2024
Merged via the queue into main with commit 1901313 Jan 17, 2024
14 checks passed
@mattinannt mattinannt deleted the docs/self-hosting-license branch January 17, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants