/* * Wire * Copyright (C) 2022 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 from 'react'; import {CallingCell} from 'Components/calling/CallingCell'; import * as Icon from 'Components/Icon'; import {PrimaryModal} from 'Components/Modals/PrimaryModal'; import {PROPERTIES_TYPE} from 'src/script/properties/PropertiesType'; import {useKoSubscribableChildren} from 'Util/ComponentUtil'; import {t} from 'Util/LocalizerUtil'; import {Config} from '../../../Config'; import {User} from '../../../entity/User'; import {CallingViewModel} from '../../../view_model/CallingViewModel'; import {ListViewModel} from '../../../view_model/ListViewModel'; type TemporaryGuestConversations = { callingViewModel: CallingViewModel; listViewModel: ListViewModel; selfUser: User; }; const TemporaryGuestConversations: React.FC = ({ selfUser, listViewModel, callingViewModel, }) => { const {expirationIsUrgent, expirationRemainingText} = useKoSubscribableChildren(selfUser, [ 'expirationIsUrgent', 'expirationRemainingText', ]); const {activeCalls} = useKoSubscribableChildren(callingViewModel, ['activeCalls']); const isAccountCreationEnabled = Config.getConfig().FEATURE.ENABLE_ACCOUNT_REGISTRATION; const openPreferences = () => { listViewModel.openPreferencesAccount(); }; const createAccount = (): void => { PrimaryModal.show(PrimaryModal.type.CONFIRM, { preventClose: true, primaryAction: { action: () => window.location.replace(`/auth/${location.search}`), text: t('modalAccountCreateAction'), }, text: { message: t('modalAccountCreateMessage'), title: t('modalAccountCreateHeadline'), }, }); }; return (
{activeCalls.map(call => { const {conversation} = call; return ( ); })}
{t('temporaryGuestDescription')}
{isAccountCreationEnabled && ( )}
{expirationRemainingText} {t('temporaryGuestTimeRemaining')}
); }; export {TemporaryGuestConversations};