PHP 8.2.31
Preview: Rating.jsx Size: 1.85 KB
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Agent/components/Rating.jsx

import { rateAnswer } from '@agent/api';
import { thumbDown, thumbUp } from '@agent/icons';
import { useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { Icon } from '@wordpress/icons';
import classnames from 'classnames';

export const Rating = ({ answerId }) => {
	const [rating, setRating] = useState(undefined);

	useEffect(() => {
		if (!answerId) return;
		if (rating === undefined) return;
		rateAnswer({ answerId, rating });
	}, [rating, answerId]);

	return (
		<div className="flex items-center justify-end">
			<div className="flex items-center gap-px rounded-xl border border-gray-400 bg-gray-50 px-2 text-right">
				<button
					type="button"
					aria-pressed={rating === 1}
					aria-live="polite"
					onClick={() => setRating((current) => (current === 1 ? 0 : 1))}
					aria-label={
						rating === 1
							? __('Remove rating', 'extendify-local')
							: __('Rate that this answer was helpful', 'extendify-local')
					}
					className={classnames(
						'm-0 h-6 border-0 bg-transparent p-0 hover:text-design-main',
						{
							'text-design-main': rating === 1,
							'text-gray-600': rating !== 1,
						},
					)}
				>
					<Icon className="fill-current" icon={thumbUp} />
				</button>

				<button
					type="button"
					aria-pressed={rating === -1}
					aria-live="polite"
					onClick={() => setRating((current) => (current === -1 ? 0 : -1))}
					aria-label={
						rating === -1
							? __('Remove rating', 'extendify-local')
							: __('Rate that this answer was not helpful', 'extendify-local')
					}
					className={classnames(
						'm-0 h-6 border-0 bg-transparent p-0 hover:text-design-main',
						{
							'text-design-main': rating === -1,
							'text-gray-600': rating !== -1,
						},
					)}
				>
					<Icon className="fill-current" icon={thumbDown} />
				</button>
			</div>
		</div>
	);
};

Directory Contents

Dirs: 5 × Files: 13

Name Size Perms Modified Actions
buttons DIR
- drwxr-xr-x 2026-04-28 02:40:01
Edit Download
layouts DIR
- drwxr-xr-x 2026-04-28 02:40:01
Edit Download
messages DIR
- drwxr-xr-x 2026-04-28 02:40:01
Edit Download
redirects DIR
- drwxr-xr-x 2026-04-28 02:40:01
Edit Download
__tests__ DIR
- drwxr-xr-x 2026-04-28 02:40:01
Edit Download
6.98 KB lrw-r--r-- 2026-03-19 23:35:18
Edit Download
6.07 KB lrw-r--r-- 2026-03-05 22:57:38
Edit Download
2.94 KB lrw-r--r-- 2026-03-19 23:35:18
Edit Download
1.28 KB lrw-r--r-- 2026-03-05 22:57:38
Edit Download
8.77 KB lrw-r--r-- 2026-03-19 23:35:18
Edit Download
872 B lrw-r--r-- 2026-02-19 03:27:14
Edit Download
14.88 KB lrw-r--r-- 2026-02-19 03:27:14
Edit Download
6.03 KB lrw-r--r-- 2026-04-09 23:45:00
Edit Download
5.36 KB lrw-r--r-- 2026-03-19 23:35:18
Edit Download
1.04 KB lrw-r--r-- 2026-03-05 22:57:38
Edit Download
1.85 KB lrw-r--r-- 2026-02-19 03:27:14
Edit Download
1.10 KB lrw-r--r-- 2026-02-19 03:27:14
Edit Download
876 B lrw-r--r-- 2026-02-19 03:27:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).