-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Remove socket io, I can't make it work with server actions
- Loading branch information
1 parent
e8fb63a
commit e1228b6
Showing
9 changed files
with
125 additions
and
386 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
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,77 @@ | ||
import PageSection from "@/components/core/section"; | ||
import PageTitle from "@/components/layout/page-title"; | ||
import { getUserNotifications } from "../settings/actions"; | ||
|
||
function Dot({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
width="6" | ||
height="6" | ||
fill="currentColor" | ||
viewBox="0 0 6 6" | ||
xmlns="http://www.w3.org/2000/svg" | ||
className={className} | ||
aria-hidden="true" | ||
> | ||
<circle cx="3" cy="3" r="3" /> | ||
</svg> | ||
); | ||
} | ||
|
||
export default async function Notifications() { | ||
const notifications = await getUserNotifications(); | ||
|
||
return ( | ||
<> | ||
<PageTitle title="Notifications" /> | ||
|
||
<PageSection topInset> | ||
{!notifications.length ? ( | ||
<div className="text-center text-muted-foreground p-6 text-sm"> | ||
No notifications | ||
</div> | ||
) : null} | ||
|
||
{notifications.map((notification) => ( | ||
<div | ||
key={notification.id} | ||
className="rounded-md px-3 py-2 text-sm transition-colors hover:bg-accent" | ||
> | ||
<div className="relative flex items-start gap-3 pe-3"> | ||
{/* <img | ||
className="size-9 rounded-md" | ||
src={notification.image} | ||
width={32} | ||
height={32} | ||
alt={notification.user} | ||
/> */} | ||
<div className="flex-1 space-y-1"> | ||
<button | ||
type="button" | ||
className="text-left text-foreground/80 after:absolute after:inset-0" | ||
> | ||
<span className="font-medium text-foreground hover:underline"> | ||
{notification.user.firstName} | ||
</span>{" "} | ||
{notification.target}{" "} | ||
<span className="font-medium text-foreground hover:underline"> | ||
{notification.target} | ||
</span> | ||
. | ||
</button> | ||
<div className="text-xs text-muted-foreground"> | ||
{notification.createdAt.toLocaleDateString()} | ||
</div> | ||
</div> | ||
{!notification.read ? ( | ||
<div className="absolute end-0 self-center"> | ||
<Dot /> | ||
</div> | ||
) : null} | ||
</div> | ||
</div> | ||
))} | ||
</PageSection> | ||
</> | ||
); | ||
} |
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
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 was deleted.
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
Oops, something went wrong.