Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(blog): add blog comment notifications #45

Merged
merged 1 commit into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NEXT_PUBLIC_BACKEND_DOMAIN=https://api.xp-bot.net
# NEXT_PUBLIC_BACKEND_DOMAIN=http://localhost:3300
# NEXT_PUBLIC_BACKEND_DOMAIN=https://api.xp-bot.net
NEXT_PUBLIC_BACKEND_DOMAIN=http://localhost:3300
NEXT_PUBLIC_FLAGS_ENVIRONMENT_KEY=flags_pub_development_349193885386277458
25 changes: 25 additions & 0 deletions components/inbox-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,31 @@ const InboxItem: FC<IInboxItemProps> = ({ inboxItem }) => {
</p>
</div>
);
case InboxItemType.BlogPostComment:
return (
<div className="flex flex-row items-center gap-2">
{lookupUser && (
<span className="h-4 w-4 shrink-0 overflow-hidden rounded-full">
<FallBackImage
className="h-full w-full object-cover"
src={avatarToURL(lookupUser)}
/>
</span>
)}
<p
className={`text-sm opacity-75 ${
startsWith(
lookupUser?.username,
toLower(slice(lookupUser?.username, 0, 1)[0])
)
? "-mt-0.5"
: ""
} `}
>
{lookupUser?.username} commented:
</p>
</div>
);
default:
return (
<p
Expand Down
2 changes: 1 addition & 1 deletion components/wave-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface WavePageProps {
const WavePage: FC<WavePageProps> = ({ children }) => {
const router = useRouter();
return (
<div className="z-30 h-full">
<div className="z-30 pb-20 lg:pb-0 h-full">
<div className="h-full w-full pb-10 pt-7">
<div
className={`${
Expand Down
13 changes: 10 additions & 3 deletions context/blog-comments-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ import {
IBlogPostComment,
IBlogPostCommentContent,
} from "models/backend/blog-models";
import { createContext, useContext, useEffect, useRef, useState } from "react";
import {
createContext,
Fragment,
useContext,
useEffect,
useRef,
useState,
} from "react";

interface IBlogCommentsSectionValues {
deleteComment: (comment: IBlogPostComment) => void;
Expand Down Expand Up @@ -110,7 +117,7 @@ export function BlogCommentsSection({
{map(
orderBy(comments, (comment) => comment.updatedAt, "desc"),
(comment, idx) => (
<>
<Fragment key={comment.commentID}>
<motion.div
key={`comment_parent_${comment.commentID}`}
initial="hidden"
Expand Down Expand Up @@ -141,7 +148,7 @@ export function BlogCommentsSection({
{size(comments) > 0 && !isEqual(idx, size(comments) - 1) && (
<hr />
)}
</>
</Fragment>
)
)}
</AnimatePresence>
Expand Down