mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Working on notification system.
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import {Card} from "@/components/ui/card";
|
||||
import {NotificationChannel} from "@/db/schema/09_notification-channel";
|
||||
import {Mail, MessageSquare, Pencil, Trash2, Webhook} from "lucide-react";
|
||||
import {NotificationChannel, NotificationChannelWith} from "@/db/schema/09_notification-channel";
|
||||
import {Badge} from "@/components/ui/badge";
|
||||
import {Switch} from "@/components/ui/switch";
|
||||
import {
|
||||
DeleteNotifierButton
|
||||
} from "@/components/wrappers/dashboard/common/notifier/notifier-card/button-delete-notifier";
|
||||
import {EditNotifierButton} from "@/components/wrappers/dashboard/common/notifier/notifier-card/button-edit-notifier";
|
||||
import {Organization, OrganizationWithMembers} from "@/db/schema/03_organization";
|
||||
import {OrganizationWithMembers} from "@/db/schema/03_organization";
|
||||
import {getNotificationChannelIcon} from "@/components/wrappers/dashboard/admin/notifications/helpers";
|
||||
|
||||
export type NotifierCardProps = {
|
||||
data: NotificationChannel;
|
||||
data: NotificationChannelWith;
|
||||
organization?: OrganizationWithMembers;
|
||||
organizations?: OrganizationWithMembers[];
|
||||
adminView?: boolean;
|
||||
};
|
||||
|
||||
export const NotifierCard = (props: NotifierCardProps) => {
|
||||
@@ -25,7 +26,7 @@ export const NotifierCard = (props: NotifierCardProps) => {
|
||||
<div className="flex items-center gap-3">
|
||||
<div
|
||||
className="flex h-10 w-10 items-center justify-center rounded-md bg-secondary border border-border">
|
||||
{getIcon(data.provider)}
|
||||
{getNotificationChannelIcon(data.provider)}
|
||||
</div>
|
||||
<div className={`h-2 w-2 rounded-full ${data.enabled ? "bg-green-600" : "bg-muted"}`}/>
|
||||
</div>
|
||||
@@ -41,6 +42,8 @@ export const NotifierCard = (props: NotifierCardProps) => {
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<EditNotifierButton
|
||||
organizations={props.organizations}
|
||||
adminView={props.adminView}
|
||||
organization={organization}
|
||||
notificationChannel={data}/>
|
||||
<DeleteNotifierButton
|
||||
@@ -54,14 +57,3 @@ export const NotifierCard = (props: NotifierCardProps) => {
|
||||
};
|
||||
|
||||
|
||||
const getIcon = (type: string) => {
|
||||
const Icon = notificationTypes.find((t) => t.value === type)?.icon
|
||||
return Icon ? <Icon className="h-4 w-4"/> : null
|
||||
}
|
||||
|
||||
|
||||
const notificationTypes = [
|
||||
{value: "smtp", label: "Email", icon: Mail},
|
||||
{value: "slack", label: "Slack", icon: MessageSquare},
|
||||
{value: "webhook", label: "Webhook", icon: Webhook},
|
||||
]
|
||||
Reference in New Issue
Block a user