Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
noti ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
whoisanku committed Jun 17, 2023
1 parent ce846b4 commit 297c95c
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 129 deletions.
18 changes: 4 additions & 14 deletions src/Page/Notification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ const Notification = () => {
if (notification.reason === "mention") {
postData = await agent.getPostThread({
uri: notification?.uri,
})
console.log("mention", postData)
});
console.log("mention", postData);
}

return {
Expand Down Expand Up @@ -86,15 +86,6 @@ const Notification = () => {
await refreshSession();
await agent.updateSeenNotifications();
}
// useEffect(() => {
// const uniqueArray = notifications.filter((notification, index, self) => {
// console.log("filter", self.findIndex((obj) => obj.reasonSubject === notification.reasonSubject));
// return (self.findIndex((obj) => obj.reasonSubject === notification.reasonSubject) === index) || notification.reasonSubject === undefined
// }
// );
// setNotifications(uniqueArray);
// console.log("unique array data", uniqueArray);
// }, [groupLikes, isLoading])

useEffect(() => {
markUnread();
Expand All @@ -114,9 +105,8 @@ const Notification = () => {
};
}, [isLoading, observer]);

// Look inside the set and use
// only top occuring notifications reason subject

// Look inside the set and use
// only top occuring notifications reason subject

return (
<div className="w-full h-full grid grid-cols-4 gap-5 relative">
Expand Down
18 changes: 13 additions & 5 deletions src/Page/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { agent, refreshSession, getUserDid } from "../../utils";
import { dataGotFromApi } from "../../components/@types/Feed/Feed";
import PostCard from "../../components/PageComponents/Feed/PostCard";
import { useParams } from "react-router-dom";
import { userImage } from "../../components/UI/DefaultUserImage";

type Props = {};

Expand Down Expand Up @@ -101,7 +102,7 @@ const index = (props: Props) => {
return {
reason: {
by: feed.reason?.by?.displayName,
did: feed.reason?.by?.did
did: feed.reason?.by?.did,
},
reply: {
text: feed.reply?.parent?.record?.text,
Expand Down Expand Up @@ -187,13 +188,18 @@ const index = (props: Props) => {
{/* profile */}
<div className="flex items-center">
<div className="flex w-24 bg-slate-200 aspect-square rounded-full absolute left-4 -bottom-12 shadow-lg">
<img src={avatar} alt="" className="rounded-full" />
<img
src={avatar === undefined ? userImage : avatar}
alt=""
className="rounded-full"
/>
</div>
{getUserDid() !== params.did && (
<button
onClick={isFollowing ? unfollow : follow}
className={`px-5 py-1 select-none ${isFollowing ? `bg-slate-700` : ` bg-blue-600`
} cursor-pointer absolute rounded-lg right-10 top-3 mt-[8rem] text-white`}
className={`px-5 py-1 select-none ${
isFollowing ? `bg-slate-700` : ` bg-blue-600`
} cursor-pointer absolute rounded-lg right-10 top-3 mt-[8rem] text-white`}
>
{isFollowing ? "Following" : "+ Follow"}
</button>
Expand All @@ -204,7 +210,9 @@ const index = (props: Props) => {
{/* profile details */}
<div className="flex flex-col gap-3 mt-[64px]">
<div className="flex flex-col">
<div className="text-2xl font-bold ml-2">{displayName}</div>
<div className="text-2xl font-bold ml-2">
{displayName === undefined ? handle : displayName}
</div>
<div className="flex ml-2 gap-2">
{followsYou ? (
<button className="bg-slate-200 text-[10px] rounded-md p-1">
Expand Down
14 changes: 12 additions & 2 deletions src/components/HOC/Navigation/BottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ const BottomBar = ({
return link.linkName !== "Notifications" ? (
<div
key={index}
onClick={() => { setActivePage(link.linkName); if (link.linkName === "Profile") { window.location.reload() } }}
onClick={() => {
setActivePage(link.linkName);
if (link.linkName === "Profile") {
window.location.reload();
}
}}
className="w-10 h-10 relative"
>
<HoverButtonIconOnly
Expand All @@ -42,7 +47,12 @@ const BottomBar = ({
) : (
<div
key={index}
onClick={() => { setActivePage(link.linkName); if (link.linkName === "Profile") { window.location.reload() } }}
onClick={() => {
setActivePage(link.linkName);
if (link.linkName === "Profile") {
window.location.reload();
}
}}
className="w-10 h-10 relative"
>
{notiCount.valueOf() > 0 && activePage !== "Notifications" ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,83 +1,105 @@
import { useEffect } from 'react';
import { AiOutlineHeart } from 'react-icons/ai';
import { BiRepost } from 'react-icons/bi';
import { FiMessageCircle } from 'react-icons/fi';
import { formatDateAgo } from '../../../../../utils';
import { useNavigate } from 'react-router-dom';
import { useContext } from 'react';
import { appContext } from '../../../../../context/appContext';
import { useEffect } from "react";
import { AiOutlineHeart } from "react-icons/ai";
import { BiRepost } from "react-icons/bi";
import { FiMessageCircle } from "react-icons/fi";
import { formatDateAgo } from "../../../../../utils";
import { useNavigate } from "react-router-dom";
import { useContext } from "react";
import { appContext } from "../../../../../context/appContext";
type Props = {
reply: string;
post: any;
}
reply: string;
post: any;
};

const QuotePost = ({ reply, post }: Props) => {
const navigate = useNavigate();
const { setActivePage } = useContext(appContext);
console.log(post);
return (
<div className="w-full py-2 ml-2 px-2 shadow-custom rounded-lg mt-2">
<div className="flex w-full gap-2">
<div className="w-full">
<div className="break-words w-full mb-2 -mt-6 opacity-90 rounded-md">
<div className="ml-7">{reply}</div>
</div>
{/* Section for the card */}
<div className='w-6/7 bg-slate-100 mx-auto p-2 rounded-md shadow-md ml-7'>
<div className='flex gap-2 justify-start items-center cursor-pointer hover:underline'
onClick={() => {
console.log(post?.author?.did);
navigate(`/profile/${post?.author?.did}`);
setActivePage("Profile");
}}
>
{/* Author details section */}
<div className='w-6 h-6'>
<img src={post.author.avatar} className='rounded-full' alt="avatar" />
</div>
<p>{post.author.displayName}</p>
<p className='text-slate-500 line-clamp-3'>@{post.author.handle}</p>
<p className='pl-1 text-slate-500'>&nbsp; · &nbsp; {formatDateAgo(post.indexedAt)}</p>
</div>
<div className='w-5/6 mx-auto ml-7 pt-1'>
<p> {post.record.text} </p>
<div>
{post.embed?.images! && post.embed.images[0]?.thumb && <img src={post.embed.images[0].thumb} alt="embed-image" className='rounded-sm' />}
</div>
</div>
<div>
<img src="" alt="" />
</div>
</div>
const navigate = useNavigate();
const { setActivePage } = useContext(appContext);
console.log(post);
return (
<div className="w-full py-2 ml-2 px-2 shadow-custom rounded-lg mt-2">
<div className="flex w-full gap-2">
<div className="w-full">
<div className="break-words w-full mb-2 -mt-6 opacity-90 rounded-md">
<div className="ml-7">{reply}</div>
</div>
{/* Section for the card */}
<div className="w-6/7 bg-slate-100 mx-auto p-2 rounded-md shadow-md ml-7">
<div
className="flex gap-2 justify-start items-center cursor-pointer "
onClick={() => {
console.log(post?.author?.did);
navigate(`/profile/${post?.author?.did}`);
setActivePage("Profile");
}}
>
{/* Author details section */}
<div className="w-6 h-6">
<img
src={post.author.avatar}
className="rounded-full"
alt="avatar"
/>
</div>
<div className="hover:underline flex gap-2">
<p className="break-all line-clamp-1 ">
{post.author.displayName}
</p>
<p className="text-slate-500 line-clamp-1 break-all">
@{post.author.handle}
</p>
</div>
<p className="pl-1 text-slate-500">
&nbsp; · &nbsp; {formatDateAgo(post.indexedAt)}
</p>
</div>
<div className="w-5/6 mx-auto ml-7 pt-1">
<p> {post.record.text} </p>
<div>
{post.embed?.images! && post.embed.images[0]?.thumb && (
<img
src={post.embed.images[0].thumb}
alt="embed-image"
className="rounded-sm"
/>
)}
</div>
</div>
<div>
<img src="" alt="" />
</div>
</div>

{/* Section for the buttons */}
<div className="flex justify-between px-6 pt-4">
<div>
<div className="flex flex-col items-center">
<div className="text-lg flex items-center">
<FiMessageCircle />&nbsp;<p className='text-sm'>{post.replyCount}</p>
</div>
</div>
</div>
<div>
<div className="flex flex-col items-center">
<div className="text-xl flex items-center">
<BiRepost />&nbsp; <p className='text-sm'>{post.repostCount}</p>
</div>
</div>
</div>
<div>
<div className="flex flex-col items-center">
<div className="text-lg flex items-center">
<AiOutlineHeart />&nbsp; <p className='text-sm'>{post.likeCount}</p>
</div>
</div>
</div>
</div>
{/* Section for the buttons */}
<div className="flex justify-between px-6 pt-4">
<div>
<div className="flex flex-col items-center">
<div className="text-lg flex items-center">
<FiMessageCircle />
&nbsp;<p className="text-sm">{post.replyCount}</p>
</div>
</div>
</div>
<div>
<div className="flex flex-col items-center">
<div className="text-xl flex items-center">
<BiRepost />
&nbsp; <p className="text-sm">{post.repostCount}</p>
</div>
</div>
</div>
<div>
<div className="flex flex-col items-center">
<div className="text-lg flex items-center">
<AiOutlineHeart />
&nbsp; <p className="text-sm">{post.likeCount}</p>
</div>
</div>
</div>
</div>
</div>
)
}
</div>
</div>
);
};

export default QuotePost
export default QuotePost;
Loading

0 comments on commit 297c95c

Please sign in to comment.