mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-11-03 15:45:51 +00:00 
			
		
		
		
	* wip * feat: make forms functional * feat: finalize pages * chore: remove unused translations * feat: app context * feat: user context * feat: finalize username login * fix: use correct tab order in login form * feat: add oauth logic * chore: update readme and assets * chore: rename docs back to assets * feat: favicons * feat: custom background image config option * chore: add acknowledgements for background image * feat: sanitize redirect URL * feat: sanitize redirect URL on check * chore: fix dependabot config * refactor: bot suggestions * fix: correctly redirect to app and check for untrusted redirects * fix: run oauth auto redirect only when there is a redirect URI * refactor: change select color * fix: fix dockerfiles * fix: fix hook rendering * chore: remove translations cdn * chore: formatting * feat: validate api response against zod schema * fix: use axios error instead of generic error in login page
		
			
				
	
	
		
			36 lines
		
	
	
		
			973 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			973 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { languages, SupportedLanguage } from "@/lib/i18n/locales";
 | 
						|
import {
 | 
						|
  Select,
 | 
						|
  SelectContent,
 | 
						|
  SelectItem,
 | 
						|
  SelectTrigger,
 | 
						|
  SelectValue,
 | 
						|
} from "../ui/select";
 | 
						|
import { useState } from "react";
 | 
						|
import i18n from "@/lib/i18n/i18n";
 | 
						|
 | 
						|
export const LanguageSelector = () => {
 | 
						|
  const [language, setLanguage] = useState<SupportedLanguage>(
 | 
						|
    i18n.language as SupportedLanguage,
 | 
						|
  );
 | 
						|
 | 
						|
  const handleSelect = (option: string) => {
 | 
						|
    setLanguage(option as SupportedLanguage);
 | 
						|
    i18n.changeLanguage(option as SupportedLanguage);
 | 
						|
  };
 | 
						|
  return (
 | 
						|
    <Select onValueChange={handleSelect} value={language}>
 | 
						|
      <SelectTrigger className="absolute top-5 right-5">
 | 
						|
        <SelectValue placeholder="Select language" />
 | 
						|
      </SelectTrigger>
 | 
						|
      <SelectContent>
 | 
						|
        {Object.entries(languages).map(([key, value]) => (
 | 
						|
          <SelectItem key={key} value={key}>
 | 
						|
            {value}
 | 
						|
          </SelectItem>
 | 
						|
        ))}
 | 
						|
      </SelectContent>
 | 
						|
    </Select>
 | 
						|
  );
 | 
						|
};
 |