Compare commits
4 commits
999d180b24
...
84defa703e
Author | SHA1 | Date | |
---|---|---|---|
|
84defa703e | ||
|
39801dfbda | ||
|
29f1ed952a | ||
|
b5b256f6e9 |
9 changed files with 70 additions and 36 deletions
17
client-solid/src/Components/Buttons/CommentsButton.tsx
Normal file
17
client-solid/src/Components/Buttons/CommentsButton.tsx
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { JSXElement } from "solid-js";
|
||||||
|
|
||||||
|
import { CommentsIcon } from "../../Util/Icons";
|
||||||
|
import { Post } from "../../Util/api";
|
||||||
|
|
||||||
|
export default function CommentsBUtton({ post }: { post: Post }): JSXElement {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div class="flex p-1">
|
||||||
|
<CommentsIcon />
|
||||||
|
<span class="text-1xl countdown text-center pt-1.5 px-1.5">
|
||||||
|
<p style={{ "--value": 11 }}>{post.comments}</p>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
import { JSXElement } from "solid-js";
|
|
||||||
|
|
||||||
import { ReplyIcon } from "../../Util/Icons";
|
|
||||||
import { Post } from "../../Util/api";
|
|
||||||
|
|
||||||
export default function ReplyButton({ post }: { post: Post }): JSXElement {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div class="flex p-1">
|
|
||||||
<button
|
|
||||||
class="btn btn-xs hover:border-primary rounded-base"
|
|
||||||
aria-label="Show sign of engagement"
|
|
||||||
>
|
|
||||||
<ReplyIcon />
|
|
||||||
</button>
|
|
||||||
<span class="text-1xl countdown text-center pt-1.5 px-1.5">
|
|
||||||
<p style={{ "--value": 11 }}>{post.comments}</p>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
20
client-solid/src/Components/Buttons/Reply.tsx
Normal file
20
client-solid/src/Components/Buttons/Reply.tsx
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import { JSXElement, Show, useContext } from "solid-js";
|
||||||
|
|
||||||
|
import { LoginContext } from "../../Context/GlobalState";
|
||||||
|
import { ReplyIcon, ReportIcon } from "../../Util/Icons";
|
||||||
|
|
||||||
|
export default function ReplyButton(): JSXElement {
|
||||||
|
const login_ctx = useContext(LoginContext)!;
|
||||||
|
return (
|
||||||
|
<Show when={login_ctx.loggedIn()}>
|
||||||
|
<div class="flex p-1">
|
||||||
|
<button
|
||||||
|
class="rounded-base btn btn-xs hover:border-primary"
|
||||||
|
aria-label="Report post or comment"
|
||||||
|
>
|
||||||
|
<ReplyIcon />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import { JSXElement } from "solid-js";
|
import { JSXElement } from "solid-js";
|
||||||
|
|
||||||
import { PublicComment } from "../Util/api";
|
import { PublicComment } from "../Util/api";
|
||||||
|
import ReplyButton from "./Buttons/Reply";
|
||||||
|
|
||||||
interface CommentProps {
|
interface CommentProps {
|
||||||
comment: PublicComment;
|
comment: PublicComment;
|
||||||
|
@ -15,14 +16,18 @@ interface CommentProps {
|
||||||
export function Comment({ comment }: CommentProps): JSXElement {
|
export function Comment({ comment }: CommentProps): JSXElement {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div class="chat chat-start">
|
<div class="chat chat-start py-5">
|
||||||
<time class="text-xs opacity-50">{comment.created_at}</time>
|
<time class="text-xs opacity-50">{comment.created_at}</time>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-bubble">{comment.content}</div>
|
<div class="chat-">{comment.content}</div>
|
||||||
|
<div class="divider"></div>
|
||||||
<div class="chat chat-end">
|
<div class="chat chat-end">
|
||||||
<time class="text-xs opacity-50">Reply created_at</time>
|
<div class="flex-col">
|
||||||
<div class="chat-bubble">Replies to parent comment if any</div>
|
<time class="text-xs opacity-50 time-end">Reply created_at</time>
|
||||||
|
<div class="chat-end">Replies to parent comment if any</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="divider divider-end"><ReplyButton/></div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ export function LoginButton(): JSXElement {
|
||||||
{showLogoutModal() && (
|
{showLogoutModal() && (
|
||||||
<div
|
<div
|
||||||
role="alert"
|
role="alert"
|
||||||
class="absolute top-10 z-10 flex rounded-md bg-base-200 border-2 border-warning"
|
class="absolute top-10 z-10 flex rounded-md bg-base-200 border-2 border-info"
|
||||||
>
|
>
|
||||||
<div class="relative p-5">
|
<div class="relative p-5">
|
||||||
<p>Do you wish to logout?</p>
|
<p>Do you wish to logout?</p>
|
||||||
|
|
|
@ -23,12 +23,8 @@ export function Menu(): JSXElement {
|
||||||
const login_ctx = useContext(LoginContext)!;
|
const login_ctx = useContext(LoginContext)!;
|
||||||
return (
|
return (
|
||||||
<Show when={login_ctx.loggedIn()}>
|
<Show when={login_ctx.loggedIn()}>
|
||||||
<ul class="menu space-y-2 rounded-box md:menu-horizontal md:space-x-2 md:space-y-0">
|
<ul class="menu menu-horizontal space-y-0 space-x-2 rounded-box md:space-x-5 md:space-y-0">
|
||||||
<MenuItem href="/">
|
|
||||||
<Home />
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem href="/new">
|
<MenuItem href="/new">
|
||||||
{/*Filter component for popular */}
|
|
||||||
<Plus />
|
<Plus />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { JSXElement, Show } from "solid-js";
|
||||||
|
|
||||||
import { Post } from "../Util/api";
|
import { Post } from "../Util/api";
|
||||||
import EngagementButton from "./Buttons/Engegament";
|
import EngagementButton from "./Buttons/Engegament";
|
||||||
import ReplyButton from "./Buttons/Replies";
|
import CommentsBUtton from "./Buttons/CommentsButton";
|
||||||
import ReportButton from "./Buttons/Report";
|
import ReportButton from "./Buttons/Report";
|
||||||
import ToPostButton from "./Buttons/ToPost";
|
import ToPostButton from "./Buttons/ToPost";
|
||||||
import RemovePostButton from "./Buttons/RemovePostButton";
|
import RemovePostButton from "./Buttons/RemovePostButton";
|
||||||
|
@ -42,7 +42,7 @@ export function PostSegment({ post }: { post: Post }): JSXElement {
|
||||||
<div class="card-actions justify-between">
|
<div class="card-actions justify-between">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<EngagementButton post={post} />
|
<EngagementButton post={post} />
|
||||||
<ReplyButton post={post} />
|
<CommentsBUtton post={post} />
|
||||||
</div>
|
</div>
|
||||||
<ToPostButton post={post} />
|
<ToPostButton post={post} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,7 @@ export function Navbar(): JSXElement {
|
||||||
return (
|
return (
|
||||||
<div class="max-w navbar max-w-3xl rounded-box text-neutral-content md:my-4">
|
<div class="max-w navbar max-w-3xl rounded-box text-neutral-content md:my-4">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<A href={"/"} class="btn btn-ghost text-xl normal-case">
|
<A href={"/"} class="btn btn-ghost text-sm normal-case sm:text-xl">
|
||||||
<Flake />
|
<Flake />
|
||||||
<h1>FrostByte</h1>
|
<h1>FrostByte</h1>
|
||||||
</A>
|
</A>
|
||||||
|
|
|
@ -172,7 +172,7 @@ export function CheckMark(): JSXElement {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ReplyIcon(): JSXElement {
|
export function CommentsIcon(): JSXElement {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
@ -252,3 +252,21 @@ export function RemovePostIcon(): JSXElement {
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function ReplyIcon(): JSXElement {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width={1.5}
|
||||||
|
stroke="currentColor"
|
||||||
|
class="h-6 w-6"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue