-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: date item in entry column (#199)
* feat: date item in entry column * chore: styles and mutation transaction wrapper Signed-off-by: Innei <i@innei.in> --------- Signed-off-by: Innei <i@innei.in> Co-authored-by: Innei <i@innei.in>
- Loading branch information
Showing
14 changed files
with
380 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { FeedViewType } from "@renderer/lib/enum" | ||
import { cn } from "@renderer/lib/utils" | ||
|
||
import { MarkAllButton } from "./mark-all-button" | ||
import { SocialMediaDateItem } from "./social-media-item" | ||
|
||
export const DateItem = ({ | ||
date, | ||
view, | ||
isFirst, | ||
}: { | ||
date: string | ||
view: FeedViewType | ||
isFirst: boolean | ||
}) => { | ||
const dateObj = new Date(date) | ||
const dateString = dateObj.toLocaleDateString("en-US", { weekday: "long", month: "short", day: "numeric" }) | ||
const startOfDay = new Date(dateObj.setHours(0, 0, 0, 0)).getTime() | ||
const endOfDay = new Date(dateObj.setHours(23, 59, 59, 999)).getTime() | ||
|
||
const className = cn(isFirst ? "pt-2" : "pt-8", "flex items-center gap-1 pl-2 text-sm font-bold text-zinc-800 dark:text-neutral-400") | ||
|
||
if (view === FeedViewType.SocialMedia) { | ||
return <SocialMediaDateItem date={date} className={className} /> | ||
} | ||
|
||
return ( | ||
<div className={className}> | ||
<MarkAllButton | ||
className="size-7 text-base" | ||
filter={{ | ||
startTime: startOfDay, | ||
endTime: endOfDay, | ||
}} | ||
/> | ||
{dateString} | ||
</div> | ||
) | ||
} |
Oops, something went wrong.