Новые правки

This commit is contained in:
Web-serfer 2026-05-07 17:59:35 +05:00
parent f6c8a49fbf
commit 4900f81dcf
2 changed files with 22 additions and 9 deletions

View file

@ -1,7 +1,8 @@
import { createSignal, onMount } from "solid-js";
import { createSignal, onMount, Show } from "solid-js";
export default function CommentLock() {
const [currentPath, setCurrentPath] = createSignal("/auth/sign-in");
const [signupPath, setSignupPath] = createSignal("/auth/sign-up");
const commentsSvg = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>`;
@ -10,6 +11,7 @@ export default function CommentLock() {
const hash = window.location.hash;
const redirectTo = hash ? `${path}${hash}` : path;
setCurrentPath(`/auth/sign-in?redirect=${encodeURIComponent(redirectTo)}`);
setSignupPath(`/auth/sign-up?redirect=${encodeURIComponent(redirectTo)}`);
});
return (
@ -51,13 +53,9 @@ export default function CommentLock() {
</a>
<p class="mt-3 text-sm text-gray-600">
Нет аккаунта?{" "}
<a
href={`/auth/sign-up?redirect=${encodeURIComponent(window.location.pathname)}`}
class="font-medium hover:underline"
style="color: #2563eb;"
>
Зарегистрироваться
</a>
<Show when={false} fallback={<a href="/auth/sign-up" class="font-medium hover:underline" style="color: #2563eb;">Зарегистрироваться</a>}>
<a href={signupPath()} class="font-medium hover:underline" style="color: #2563eb;">Зарегистрироваться</a>
</Show>
</p>
</div>
</div>