HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/delta/wp-content/plugins/wp-smushit/_src/react/views/webp/steps-bar.jsx
/**
 * External dependencies
 */
import React from 'react';

/**
 * WordPress dependencies
 */
const { __ } = wp.i18n;

export default ({ currentStep, smushData }) => {
	const getStepClass = (step) => {
		const stepClass = 'smush-wizard-bar-step';

		if (!smushData.isPro) {
			return stepClass + ' disabled';
		}

		if (step > currentStep) {
			return stepClass;
		}

		return (
			stepClass +
			(step === currentStep ? ' current' : ' sui-tooltip done')
		);
	};

	const getStepNumber = (step) => {
		return currentStep > step ? (
			<span className="sui-icon-check" aria-hidden="true"></span>
		) : (
			step
		);
	};

	const steps = [
		{ number: 1, title: __('Server Type', 'wp-smushit') },
		{ number: 2, title: __('Add Rules', 'wp-smushit') },
		{ number: 3, title: __('Finish Setup', 'wp-smushit') },
	];

	return (
		<div className="sui-sidenav">
			<span className="smush-wizard-bar-subtitle">
				{__('Setup', 'wp-smushit')}
			</span>
			<div className="smush-sidenav-title">
				<h4>{__('Local WebP', 'wp-smushit')}</h4>
				{!smushData.isPro && (
					<span className="sui-tag sui-tag-pro">
						{__('Pro', 'wp-smushit')}
					</span>
				)}
			</div>

			<div className="smush-wizard-steps-container">
				<svg
					className="smush-svg-mobile"
					focusable="false"
					aria-hidden="true"
				>
					<line
						x1="0"
						x2="50%"
						stroke={1 !== currentStep ? '#1ABC9C' : '#E6E6E6'}
					/>
					<line
						x1="50%"
						x2="100%"
						stroke={3 === currentStep ? '#1ABC9C' : '#E6E6E6'}
					/>
				</svg>
				<ul>
					{steps.map((step) => (
						<React.Fragment key={step.number}>
							<li
								className={getStepClass(step.number)}
								data-tooltip={__(
									'This stage is already completed.',
									'wp-smushit'
								)}
							>
								<div className="smush-wizard-bar-step-number">
									{getStepNumber(step.number)}
								</div>
								{step.title}
							</li>
							{3 !== step.number && (
								<svg
									data={step.number}
									data2={currentStep}
									className="smush-svg-desktop"
									focusable="false"
									aria-hidden="true"
								>
									<line
										y1="0"
										y2="40px"
										stroke={
											step.number < currentStep
												? '#1ABC9C'
												: '#E6E6E6'
										}
									/>
								</svg>
							)}
						</React.Fragment>
					))}
				</ul>
			</div>
		</div>
	);
};