Скорректировал счетчик посетителей

This commit is contained in:
Web-serfer 2026-05-01 23:12:00 +05:00
parent 95c7b64d4c
commit 18762aaaaf
10 changed files with 770 additions and 17 deletions

View file

@ -58,6 +58,7 @@ export default function ReviewForm(props: ReviewFormProps) {
const [text, setText] = createSignal("");
const [errors, setErrors] = createSignal<ValidationErrors>({});
const [touched, setTouched] = createSignal<{ [key: string]: boolean }>({});
const [consent, setConsent] = createSignal(false);
createEffect(() => {
if (props.user?.name) {
@ -203,7 +204,7 @@ export default function ReviewForm(props: ReviewFormProps) {
return !errors().name && !errors().surname && !errors().profession &&
!errors().rating && !errors().text &&
name().trim() && surname().trim() && profession().trim() &&
rating() > 0 && text().trim();
rating() > 0 && text().trim() && consent();
};
const getFieldClass = (field: keyof ValidationErrors) => {
@ -350,15 +351,23 @@ export default function ReviewForm(props: ReviewFormProps) {
{text().length}/{MAX_TEXT_LENGTH}
</p>
</div>
<div class="moderation-notice">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span>Все отзывы проходят модерацию перед публикацией</span>
</div>
</div>
</div>
<div class="consent-section">
<label class="consent-label">
<input
type="checkbox"
checked={consent()}
onChange={(e) => setConsent(e.currentTarget.checked)}
class="consent-checkbox"
/>
<span class="consent-text">
Я согласен на <a href="/privacy">обработку персональных данных</a> и принимаю <a href="/terms">условия использования</a>
</span>
</label>
</div>
<button
type="submit"
disabled={!isValid()}
@ -614,6 +623,41 @@ export default function ReviewForm(props: ReviewFormProps) {
cursor: not-allowed;
}
.consent-section {
padding: 0.75rem 0;
}
.consent-label {
display: flex;
align-items: flex-start;
gap: 0.75rem;
cursor: pointer;
}
.consent-checkbox {
width: 18px;
height: 18px;
margin-top: 2px;
accent-color: #d4af37;
cursor: pointer;
flex-shrink: 0;
}
.consent-text {
font-size: 0.8rem;
color: #64748b;
line-height: 1.4;
}
.consent-text a {
color: #2563eb;
text-decoration: underline;
}
.consent-text a:hover {
color: #1d4ed8;
}
.privacy-note {
font-size: 0.75rem;
color: #94a3b8;