meta tags – Good SEO practices for a root page that detects the language and redirects

I have a multilingual static website; the pages of each language live in specific sub-folders such as / en, / es, / fr, etc.

In my idnex root page, I dynamically detect the user's language (via Javascript) then I redirect to the appropriate language specific folder.

What should I think about in terms of SEO for this index page?

  • Should I add hreflang attributes pointing to the index page in the language-specific subfolders?
  • What should I add as x-default? One of the language-specific index pages, or the "language detection" page itself (which has no actual content ..)
  • Should I add a robots meta tag?