Skip to content
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
22 changes: 17 additions & 5 deletions apps/client/src/pages/remind/Remind.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ const Remind = () => {
containerRef,
} = useAnchoredMenu((anchor) => belowOf(anchor, 8));

const articlesToDisplay = data?.pages.flatMap((page) => page.articles) ?? [];
// const articlesToDisplay = data?.pages.flatMap((page) => page.articles) ?? [];

const articlesToDisplay =
data?.pages
.flatMap((page) => page.articles)
.filter((article) => {
const now = new Date().getTime();
const remindTime = new Date(article.remindAt).getTime();
const displayTimeLimit = 24 * 60 * 60 * 1000;

return remindTime > now && remindTime <= now + displayTimeLimit;
}) ?? [];

const getItemTitle = (id: number | null) =>
id == null ? '' : (REMIND_MOCK_DATA.find((d) => d.id === id)?.title ?? '');
Expand Down Expand Up @@ -97,22 +108,23 @@ const Remind = () => {
return <div>Loading...</div>;
}

const unreadArticleCount = data?.pages[0]?.unreadArticleCount || 0;
const readArticleCount = data?.pages[0]?.readArticleCount || 0;
// TODO: 임시
// const unreadArticleCount = data?.pages[0]?.unreadArticleCount || 0;
// const readArticleCount = data?.pages[0]?.readArticleCount || 0;

return (
<div className="flex flex-col py-[5.2rem] pl-[8rem] pr-[5rem]">
<p className="head3">리마인드</p>
<div className="mt-[3rem] flex gap-[2.4rem]">
<Badge
text="안 읽음"
countNum={unreadArticleCount}
// countNum={unreadArticleCount}
onClick={() => handleBadgeClick('notRead')}
isActive={activeBadge === 'notRead'}
/>
<Badge
text="읽음"
countNum={readArticleCount}
// countNum={readArticleCount}
onClick={() => handleBadgeClick('read')}
Comment on lines 120 to 128
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

서버 수정반영 후 까먹지말 TODO

isActive={activeBadge === 'read'}
/>
Expand Down
9 changes: 6 additions & 3 deletions packages/design-system/src/components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ const Badge = ({ text, countNum, isActive, onClick }: BadgeProps) => {
<span className={BadgeTxtStyleVariants({ active: isActive })}>
{text}
</span>
<span className={BadgeStyleVariants({ active: isActive })}>
{countNum}
</span>

{typeof countNum === 'number' && countNum >= 0 && (
<span className={BadgeStyleVariants({ active: isActive })}>
{countNum}
</span>
)}
</div>
);
};
Expand Down
3 changes: 2 additions & 1 deletion packages/design-system/src/components/card/RemindCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ const RemindCard = ({
const [displayTime, setDisplayTime] = useState('');

useEffect(() => {
const endTime = new Date(timeRemaining).getTime() + 24 * 60 * 60 * 1000;
// const endTime = new Date(timeRemaining).getTime() + 24 * 60 * 60 * 1000;
const endTime = new Date(timeRemaining).getTime();

const updateRemainingTime = () => {
const now = new Date().getTime();
Expand Down
Loading