/* * Wire * Copyright (C) 2023 Wire Swiss GmbH * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * */ import React, {useState} from 'react'; import { useMatchMedia, QUERY, Button, Column, Columns, Container, ContainerXS, H2, Link, LinkVariant, Muted, Form, Input, Loading, Checkbox, } from '@wireapp/react-ui-kit'; import {Config} from 'src/script/Config'; import {t} from 'Util/LocalizerUtil'; import {parseValidationErrors, parseError} from '../util/errorUtil'; interface IsLoggedInColumnProps { selfName: string; handleSubmit: () => void; handleLogout: () => void; } interface GuestLoginColumnProps { enteredName: string; onNameChange: (e: React.ChangeEvent) => void; checkNameValidity: (event: React.FormEvent) => Promise; isValidName: boolean; isSubmitingName: boolean; nameInput: React.RefObject; conversationError: (Error & {label?: string | undefined}) | null; error: any; } const Separator = () => { const isMobile = useMatchMedia(QUERY.mobile); const Line = () => (
); return (
); }; const IsLoggedInColumn = ({handleLogout, handleSubmit, selfName}: IsLoggedInColumnProps) => { return ( <>

{t('conversationJoin.existentAccountJoinInBrowser')}

{t('conversationJoin.existentAccountUserName', {selfName})} {t('conversationJoin.joinWithOtherAccount')}
); }; const GuestLoginColumn = ({ enteredName, nameInput, onNameChange, isSubmitingName, isValidName, checkNameValidity, conversationError, error, }: GuestLoginColumnProps) => { const [isTermOfUseAccepted, setIsTermOfUseAccepted] = useState(false); return ( <>

{t('conversationJoin.noAccountHead')}

{t('conversationJoin.subhead')}
) => { setIsTermOfUseAccepted(event.target.checked); }} id="do-accept-terms" data-uie-name="do-accept-terms" wrapperCSS={{ margin: '1rem 0', }} > {t('conversationJoin.termsAcceptanceText')}{' '} {t('conversationJoin.termsLink', {brandName: Config.getConfig().BRAND_NAME})} . {error ? parseValidationErrors(error) : parseError(conversationError)} {isSubmitingName ? ( ) : ( )}
); }; export {IsLoggedInColumn, Separator, GuestLoginColumn};