✨ Login promote
This commit is contained in:
parent
f8f8c3c3b5
commit
9bc270c12f
@ -105,53 +105,62 @@ export default function PostItem(props: {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={!props.noControl}>
|
<Show when={!props.noControl}>
|
||||||
<div class="grid grid-cols-3 border-y border-base-200">
|
<div class="relative">
|
||||||
<div class="grid grid-cols-2">
|
<Show when={!userinfo?.isLoggedIn}>
|
||||||
<div class="tooltip" data-tip="Daisuki">
|
<div
|
||||||
<button type="button" class="btn btn-ghost btn-block" disabled={reacting()}
|
class="px-7 py-2.5 h-12 w-full opacity-0 transition-opacity hover:opacity-100 bg-base-100 border-t border-base-200 z-[1] absolute top-0 left-0">
|
||||||
onClick={() => reactPost(props.post, "like")}>
|
<b>Login!</b> To access entire platform.
|
||||||
<i class="fa-solid fa-thumbs-up"></i>
|
|
||||||
<code class="font-mono">{props.post.like_count}</code>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
<div class="tooltip" data-tip="Daikirai">
|
<div class="grid grid-cols-3 border-y border-base-200">
|
||||||
<button type="button" class="btn btn-ghost btn-block" disabled={reacting()}
|
<div class="grid grid-cols-2">
|
||||||
onClick={() => reactPost(props.post, "dislike")}>
|
<div class="tooltip" data-tip="Daisuki">
|
||||||
<i class="fa-solid fa-thumbs-down"></i>
|
<button type="button" class="btn btn-ghost btn-block" disabled={reacting()}
|
||||||
<code class="font-mono">{props.post.dislike_count}</code>
|
onClick={() => reactPost(props.post, "like")}>
|
||||||
</button>
|
<i class="fa-solid fa-thumbs-up"></i>
|
||||||
</div>
|
<code class="font-mono">{props.post.like_count}</code>
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
<div class="col-span-2 flex justify-end">
|
|
||||||
<div class="tooltip" data-tip="Reply">
|
<div class="tooltip" data-tip="Daikirai">
|
||||||
<button type="button" class="btn btn-ghost btn-block"
|
<button type="button" class="btn btn-ghost btn-block" disabled={reacting()}
|
||||||
onClick={() => props.onReply && props.onReply(props.post)}>
|
onClick={() => reactPost(props.post, "dislike")}>
|
||||||
<i class="fa-solid fa-reply"></i>
|
<i class="fa-solid fa-thumbs-down"></i>
|
||||||
</button>
|
<code class="font-mono">{props.post.dislike_count}</code>
|
||||||
</div>
|
</button>
|
||||||
|
</div>
|
||||||
<div class="tooltip" data-tip="Repost">
|
</div>
|
||||||
<button type="button" class="btn btn-ghost btn-block"
|
|
||||||
onClick={() => props.onRepost && props.onRepost(props.post)}>
|
<div class="col-span-2 flex justify-end">
|
||||||
<i class="fa-solid fa-retweet"></i>
|
<div class="tooltip" data-tip="Reply">
|
||||||
</button>
|
<button type="button" class="btn btn-ghost btn-block"
|
||||||
</div>
|
onClick={() => props.onReply && props.onReply(props.post)}>
|
||||||
|
<i class="fa-solid fa-reply"></i>
|
||||||
<div class="dropdown dropdown-end">
|
</button>
|
||||||
<div tabIndex="0" role="button" class="btn btn-ghost w-12">
|
</div>
|
||||||
<i class="fa-solid fa-ellipsis-vertical"></i>
|
|
||||||
|
<div class="tooltip" data-tip="Repost">
|
||||||
|
<button type="button" class="btn btn-ghost btn-block"
|
||||||
|
onClick={() => props.onRepost && props.onRepost(props.post)}>
|
||||||
|
<i class="fa-solid fa-retweet"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dropdown dropdown-end">
|
||||||
|
<div tabIndex="0" role="button" class="btn btn-ghost w-12">
|
||||||
|
<i class="fa-solid fa-ellipsis-vertical"></i>
|
||||||
|
</div>
|
||||||
|
<ul tabIndex="0" class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52">
|
||||||
|
<Show when={userinfo?.profiles?.id === props.post.author_id}>
|
||||||
|
<li><a onClick={() => props.onDelete && props.onDelete(props.post)}>Delete</a></li>
|
||||||
|
</Show>
|
||||||
|
<Show when={userinfo?.profiles?.id === props.post.author_id}>
|
||||||
|
<li><a onClick={() => props.onEdit && props.onEdit(props.post)}>Edit</a></li>
|
||||||
|
</Show>
|
||||||
|
<li><a>Report</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<ul tabIndex="0" class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-52">
|
|
||||||
<Show when={userinfo?.profiles?.id === props.post.author_id}>
|
|
||||||
<li><a onClick={() => props.onDelete && props.onDelete(props.post)}>Delete</a></li>
|
|
||||||
</Show>
|
|
||||||
<Show when={userinfo?.profiles?.id === props.post.author_id}>
|
|
||||||
<li><a onClick={() => props.onEdit && props.onEdit(props.post)}>Edit</a></li>
|
|
||||||
</Show>
|
|
||||||
<li><a>Report</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,6 +15,17 @@ export default function PostPublish(props: {
|
|||||||
}) {
|
}) {
|
||||||
const userinfo = useUserinfo();
|
const userinfo = useUserinfo();
|
||||||
|
|
||||||
|
if (!userinfo?.isLoggedIn) {
|
||||||
|
return (
|
||||||
|
<div class="py-9 flex justify-center items-center">
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="text-lg font-bold">Login!</h2>
|
||||||
|
<p>Or keep silent.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const [submitting, setSubmitting] = createSignal(false);
|
const [submitting, setSubmitting] = createSignal(false);
|
||||||
const [uploading, setUploading] = createSignal(false);
|
const [uploading, setUploading] = createSignal(false);
|
||||||
|
|
||||||
@ -61,8 +72,8 @@ export default function PostPublish(props: {
|
|||||||
props.onError(await res.text());
|
props.onError(await res.text());
|
||||||
} else {
|
} else {
|
||||||
form.reset();
|
form.reset();
|
||||||
props.onPost();
|
|
||||||
props.onError(null);
|
props.onError(null);
|
||||||
|
setTimeout(() => props.onPost(), 250);
|
||||||
}
|
}
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
}
|
}
|
||||||
@ -97,8 +108,8 @@ export default function PostPublish(props: {
|
|||||||
props.onError(await res.text());
|
props.onError(await res.text());
|
||||||
} else {
|
} else {
|
||||||
form.reset();
|
form.reset();
|
||||||
props.onPost();
|
|
||||||
props.onError(null);
|
props.onError(null);
|
||||||
|
setTimeout(() => props.onPost(), 250);
|
||||||
}
|
}
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
}
|
}
|
||||||
@ -135,7 +146,7 @@ export default function PostPublish(props: {
|
|||||||
|
|
||||||
setAttachments(attachments().concat([{
|
setAttachments(attachments().concat([{
|
||||||
...data,
|
...data,
|
||||||
author_id: userinfo?.profiles?.id,
|
author_id: userinfo?.profiles?.id
|
||||||
}]));
|
}]));
|
||||||
form.reset();
|
form.reset();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user