1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-22 22:54:22 +00:00
festa/components/Intro.tsx

50 lines
No EOL
1.3 KiB
TypeScript

import { Trans, useTranslation } from "next-i18next"
import { LoginContext } from "../contexts/login"
import { useDefinedContext } from "../utils/definedContext"
import { InputSlug } from "./InputEventSlug"
import { LoginButton } from "./LoginButton"
import { LogoutLink } from "./LogoutLink"
import { TelegramUser } from "./TelegramUser"
export function Intro() {
const {t} = useTranslation("common")
const [login, _] = useDefinedContext(LoginContext)
const loginMessage = login ? <>
<Trans i18nKey="introTelegramLoggedIn">
introTelegramLoggedIn(1: <TelegramUser u={login}/>)
</Trans>
<br/>
<LogoutLink/>
</> : <>
{t("introTelegramLogin")}
</>
const input = login ? <>
<p>
{t("introCreateEvent")}
</p>
<form>
{window.location.protocol}//
{window.location.host}/events/
<InputSlug
placeholder={t("introCreateEventSlugPlaceholder")}
/>
<button aria-label="Continue" className="input-square input-positive">
</button>
</form>
</> : <>
<LoginButton
botName="festaappbot"
/>
</>
return <>
<p>
{loginMessage}
</p>
{input}
</>
}