import { observer } from "mobx-react"; import Image from "next/image"; import { useTheme } from "next-themes"; import { KeyRound, Mails } from "lucide-react"; // types import { TInstanceAuthenticationMethodKeys, TInstanceAuthenticationModes } from "@plane/types"; // components import { AuthenticationMethodCard, EmailCodesConfiguration, GithubConfiguration, GitlabConfiguration, GoogleConfiguration, PasswordLoginConfiguration, } from "@/components/authentication"; // helpers import { resolveGeneralTheme } from "@/helpers/common.helper"; // images import githubLightModeImage from "@/public/logos/github-black.png"; import githubDarkModeImage from "@/public/logos/github-white.png"; import GitlabLogo from "@/public/logos/gitlab-logo.svg"; import GoogleLogo from "@/public/logos/google-logo.svg"; export type TAuthenticationModeProps = { disabled: boolean; updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void; }; export type TGetAuthenticationModeProps = { disabled: boolean; updateConfig: (key: TInstanceAuthenticationMethodKeys, value: string) => void; resolvedTheme: string | undefined; }; // Authentication methods export const getAuthenticationModes: (props: TGetAuthenticationModeProps) => TInstanceAuthenticationModes[] = ({ disabled, updateConfig, resolvedTheme, }) => [ { key: "email-codes", name: "Email codes", description: "Login or sign up using codes sent via emails. You need to have email setup here and enabled.", icon: , config: , }, { key: "password-login", name: "Password based login", description: "Allow members to create accounts with passwords for emails to sign in.", icon: , config: , }, { key: "google", name: "Google", description: "Allow members to login or sign up to plane with their Google accounts.", icon: Google Logo, config: , }, { key: "github", name: "Github", description: "Allow members to login or sign up to plane with their Github accounts.", icon: ( GitHub Logo ), config: , }, { key: "gitlab", name: "GitLab", description: "Allow members to login or sign up to plane with their GitLab accounts.", icon: GitLab Logo, config: , }, ]; export const AuthenticationModes: React.FC = observer((props) => { const { disabled, updateConfig } = props; // next-themes const { resolvedTheme } = useTheme(); return ( <> {getAuthenticationModes({ disabled, updateConfig, resolvedTheme }).map((method) => ( ))} ); });