File size: 1,639 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { Button, Gridicon } from '@automattic/components';
import { useTranslate } from 'i18n-calypso';
import { FunctionComponent } from 'react';
import { settingsPath } from 'calypso/lib/jetpack/paths';
import { useDispatch } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions/record';

interface Props {
	siteSlug: string | null;
	enterCredentialsEventName: string;
	goBackEventName: string;
	goBackUrl: string;
}

const MissingCredentials: FunctionComponent< Props > = ( {
	siteSlug,
	enterCredentialsEventName,
	goBackEventName,
	goBackUrl,
} ) => {
	const dispatch = useDispatch();
	const translate = useTranslate();

	return (
		<>
			<div className="rewind-flow__header">
				<Gridicon icon="history" size={ 48 } />
			</div>
			<h3 className="rewind-flow__title">{ translate( 'Missing server credentials' ) }</h3>
			<p className="rewind-flow__info">
				{ translate(
					'Enter your server credentials to enable one-click restores from your backups.'
				) }
			</p>
			<div className="rewind-flow__btn-group rewind-flow__btn-group--centered">
				<Button
					href={ goBackUrl }
					className="rewind-flow__back-button"
					onClick={ () => {
						dispatch( recordTracksEvent( goBackEventName ) );
					} }
				>
					{ translate( 'Go back' ) }
				</Button>
				<Button
					primary
					href={ settingsPath( siteSlug ) }
					className="rewind-flow__primary-button"
					onClick={ () => {
						dispatch( recordTracksEvent( enterCredentialsEventName ) );
					} }
				>
					{ translate( 'Enter credentials' ) }
				</Button>
			</div>
		</>
	);
};

export default MissingCredentials;