2021-01-14 18:07:05 +00:00
|
|
|
// Copyright 2020-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-04-16 19:20:52 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { LocalizerType } from '../types/Util';
|
2021-10-12 23:59:08 +00:00
|
|
|
import type { WidthBreakpoint } from './_util';
|
2020-04-16 19:20:52 +00:00
|
|
|
|
2021-09-17 22:20:49 +00:00
|
|
|
import { LeftPaneDialog } from './LeftPaneDialog';
|
|
|
|
|
2021-01-14 18:07:05 +00:00
|
|
|
export type PropsType = {
|
2021-10-12 23:59:08 +00:00
|
|
|
containerWidthBreakpoint: WidthBreakpoint;
|
2020-04-16 19:20:52 +00:00
|
|
|
i18n: LocalizerType;
|
|
|
|
isRegistrationDone: boolean;
|
|
|
|
relinkDevice: () => void;
|
2021-01-14 18:07:05 +00:00
|
|
|
};
|
2020-04-16 19:20:52 +00:00
|
|
|
|
2021-08-24 20:59:44 +00:00
|
|
|
export const DialogRelink = ({
|
2021-10-12 23:59:08 +00:00
|
|
|
containerWidthBreakpoint,
|
2020-04-16 19:20:52 +00:00
|
|
|
i18n,
|
|
|
|
isRegistrationDone,
|
|
|
|
relinkDevice,
|
|
|
|
}: PropsType): JSX.Element | null => {
|
2020-04-27 22:36:49 +00:00
|
|
|
if (isRegistrationDone) {
|
2020-04-16 19:20:52 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-09-17 22:20:49 +00:00
|
|
|
<LeftPaneDialog
|
2021-10-12 23:59:08 +00:00
|
|
|
containerWidthBreakpoint={containerWidthBreakpoint}
|
2021-09-17 22:20:49 +00:00
|
|
|
type="warning"
|
|
|
|
icon="relink"
|
|
|
|
clickLabel={i18n('unlinkedWarning')}
|
|
|
|
onClick={relinkDevice}
|
|
|
|
title={i18n('unlinked')}
|
|
|
|
hasAction
|
|
|
|
/>
|
2020-04-16 19:20:52 +00:00
|
|
|
);
|
|
|
|
};
|