Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "feat(dashboard): badge and tags component alignment" #7446

Merged
merged 1 commit into from
Jan 7, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function ActivityJobItem({ job, isFirst, isLast }: ActivityJobItemProps)
<CardContent className="rounded-lg bg-neutral-50 p-2">
<div className="flex items-center justify-between">
<span className="text-foreground-400 max-w-[300px] truncate pr-2 text-xs">{getStatusMessage(job)}</span>
<Badge variant="lighter" color="gray" size="sm">
<Badge variant="soft" className="bg-foreground-50 shrink-0 px-2 py-0.5 text-[11px] leading-3">
<TimeDisplayHoverCard date={new Date(job.updatedAt)}>
{format(new Date(job.updatedAt), 'MMM d yyyy, HH:mm:ss')}
</TimeDisplayHoverCard>
Expand Down
22 changes: 11 additions & 11 deletions apps/dashboard/src/components/activity/activity-table.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ActivityFilters } from '@/api/activity';
import { Skeleton } from '@/components/primitives/skeleton';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/primitives/table';
import { TimeDisplayHoverCard } from '@/components/time-display-hover-card';
import { format } from 'date-fns';
import { cn } from '@/utils/ui';
import { ISubscriber } from '@novu/shared';
import { format } from 'date-fns';
import { TimeDisplayHoverCard } from '@/components/time-display-hover-card';
import { createSearchParams, useLocation, useSearchParams, useNavigate } from 'react-router-dom';
import { StatusBadge } from './components/status-badge';
import { StepIndicators } from './components/step-indicators';
import { ActivityEmptyState } from './activity-empty-state';
import { AnimatePresence, motion } from 'motion/react';
import { ArrowPagination } from './components/arrow-pagination';
import { useEffect } from 'react';
import { createSearchParams, useLocation, useNavigate, useSearchParams } from 'react-router-dom';
import { toast } from 'sonner';
import { ActivityFilters } from '@/api/activity';
import { useFetchActivities } from '../../hooks/use-fetch-activities';
import { ActivityEmptyState } from './activity-empty-state';
import { ArrowPagination } from './components/arrow-pagination';
import { ActivityStatusBadge } from './components/status-badge';
import { StepIndicators } from './components/step-indicators';
import { toast } from 'sonner';
import { Skeleton } from '@/components/primitives/skeleton';

export interface ActivityTableProps {
selectedActivityId: string | null;
Expand Down Expand Up @@ -120,7 +120,7 @@ export function ActivityTable({
</div>
</TableCell>
<TableCell className="px-3">
<ActivityStatusBadge jobs={activity.jobs} />
<StatusBadge jobs={activity.jobs} />
</TableCell>
<TableCell className="px-3">
<StepIndicators jobs={activity.jobs} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { useState, useRef, useEffect } from 'react';
import { Badge, BadgeVariant } from '@/components/primitives/badge';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/primitives/popover';
import { IActivityJob, JobStatusEnum } from '@novu/shared';
import { useEffect, useRef, useState } from 'react';
import { StatusBadge as StatusBadgeComponent, StatusBadgeIcon } from '../../primitives/status-badge';
import { JOB_STATUS_CONFIG } from '../constants';
import { StatusPreviewCard } from './status-preview-card';
import { JOB_STATUS_CONFIG } from '../constants';

export interface StatusBadgeProps {
jobs: IActivityJob[];
}

export function ActivityStatusBadge({ jobs }: StatusBadgeProps) {
export function StatusBadge({ jobs }: StatusBadgeProps) {
const [isOpen, setIsOpen] = useState(false);
const errorCount = jobs.filter((job) => job.status === JobStatusEnum.FAILED).length;
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
Expand Down Expand Up @@ -48,9 +49,10 @@ export function ActivityStatusBadge({ jobs }: StatusBadgeProps) {
return (
<Popover open={isOpen}>
<PopoverTrigger onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
<StatusBadgeComponent variant="light" status={variant}>
<StatusBadgeIcon as={Icon} /> {displayLabel}
</StatusBadgeComponent>
<Badge variant={variant as BadgeVariant} className="cursor-pointer gap-1 px-1 py-0 leading-6">
<Icon className="h-3.5 w-3.5" />
{displayLabel}
</Badge>
</PopoverTrigger>
<PopoverContent
className="w-64"
Expand Down
25 changes: 13 additions & 12 deletions apps/dashboard/src/components/activity/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { JobStatusEnum } from '@novu/shared';
import { RiCheckboxCircleFill, RiErrorWarningFill, RiForbidFill } from 'react-icons/ri';
import { BadgeVariant } from '../primitives/badge';
import { RiLoader3Line, RiLoader4Fill } from 'react-icons/ri';
import { IconType } from 'react-icons/lib';
import { RiCheckboxCircleFill, RiErrorWarningFill, RiForbidFill, RiLoader3Line, RiLoader4Fill } from 'react-icons/ri';
import { StatusBadgeProps } from '../primitives/status-badge';

export const STATUS_STYLES = {
completed: 'border-[#99e3bb] bg-[#e9faf0] text-[#99e3bb]',
Expand All @@ -13,64 +14,64 @@ export const STATUS_STYLES = {
export const JOB_STATUS_CONFIG: Record<
JobStatusEnum,
{
variant: StatusBadgeProps['status'];
variant: BadgeVariant;
color: string;
icon: IconType;
label: string;
animationClass?: string;
}
> = {
[JobStatusEnum.COMPLETED]: {
variant: 'completed' as const,
variant: 'success' as const,
color: 'success',
icon: RiCheckboxCircleFill,
label: 'SUCCESS',
},
[JobStatusEnum.FAILED]: {
variant: 'failed' as const,
variant: 'destructive' as const,
color: 'destructive',
icon: RiErrorWarningFill,
label: `ERROR`,
},
[JobStatusEnum.MERGED]: {
variant: 'disabled' as const,
variant: 'success' as const,
color: 'success',
icon: RiForbidFill,
label: 'MERGED',
},
[JobStatusEnum.PENDING]: {
variant: 'pending' as const,
variant: 'warning' as const,
icon: RiLoader3Line,
color: 'neutral-300',
label: 'PENDING',
},
[JobStatusEnum.CANCELED]: {
variant: 'disabled' as const,
variant: 'warning' as const,
icon: RiLoader3Line,
color: 'neutral-300',
label: 'CANCELED',
},
[JobStatusEnum.SKIPPED]: {
variant: 'disabled' as const,
variant: 'warning' as const,
icon: RiLoader3Line,
color: 'neutral-300',
label: 'SKIPPED',
},
[JobStatusEnum.RUNNING]: {
variant: 'pending' as const,
variant: 'warning' as const,
icon: RiLoader3Line,
color: 'warning',
label: 'RUNNING',
},
[JobStatusEnum.DELAYED]: {
variant: 'pending' as const,
variant: 'warning' as const,
icon: RiLoader4Fill,
label: 'DELAYED',
color: 'warning',
animationClass: 'animate-spin-slow',
},
[JobStatusEnum.QUEUED]: {
variant: 'pending' as const,
variant: 'warning' as const,
icon: RiLoader3Line,
color: 'warning',
label: 'QUEUED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function ActivePlanBanner({ selectedBillingInterval }: ActivePlanBannerPr
<h3 className="text-lg font-semibold capitalize">{subscription.apiServiceLevel?.toLowerCase()}</h3>
)}
{subscription?.trial.isActive && (
<Badge variant="light" color="gray" size="sm">
<Badge variant="outline" className="font-medium">
Trial
</Badge>
)}
Expand Down
7 changes: 1 addition & 6 deletions apps/dashboard/src/components/billing/highlights-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ function PlanHighlights({ planHighlights }: { planHighlights: Highlight[] }) {
{planHighlights.map((item, index) => (
<li key={index} className="flex items-center gap-2">
<div className="bg-primary h-1.5 w-1.5 rounded-full" />
{item.text}{' '}
{item.badgeLabel && (
<Badge variant="stroke" color="gray">
{item.badgeLabel}
</Badge>
)}
{item.text} {item.badgeLabel && <Badge variant="outline">{item.badgeLabel}</Badge>}
</li>
))}
</ul>
Expand Down
18 changes: 3 additions & 15 deletions apps/dashboard/src/components/billing/plans-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ export function PlansRow({ selectedBillingInterval, currentPlan, trial }: PlansR
<div className="space-y-4">
<div className="flex items-center justify-between">
<h3 className="text-xl font-semibold">Free</h3>
{effectiveCurrentPlan === 'free' && (
<Badge variant="light" color="gray" size="sm">
Current Plan
</Badge>
)}
{effectiveCurrentPlan === 'free' && <Badge variant="soft">Current Plan</Badge>}
</div>
<PlanDisplay price="$0" subtitle="free forever" events="30,000 events per month" />
<ul className="space-y-2">
Expand Down Expand Up @@ -77,11 +73,7 @@ export function PlansRow({ selectedBillingInterval, currentPlan, trial }: PlansR
<div className="space-y-4">
<div className="flex items-center justify-between">
<h3 className="text-xl font-semibold">Business</h3>
{effectiveCurrentPlan === 'business' && (
<Badge variant="light" color="gray" size="sm">
Current Plan
</Badge>
)}
{effectiveCurrentPlan === 'business' && <Badge variant="soft">Current Plan</Badge>}
</div>
<PlanDisplay
price={businessPlanPrice}
Expand Down Expand Up @@ -119,11 +111,7 @@ export function PlansRow({ selectedBillingInterval, currentPlan, trial }: PlansR
<div className="space-y-4">
<div className="flex items-center justify-between">
<h3 className="text-xl font-semibold">Enterprise</h3>
{effectiveCurrentPlan === 'enterprise' && (
<Badge variant="light" color="gray" size="sm">
Current Plan
</Badge>
)}
{effectiveCurrentPlan === 'enterprise' && <Badge variant="soft">Current Plan</Badge>}
</div>
<div className="space-y-1">
<div className="flex items-baseline gap-1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ import { Button } from '@/components/primitives/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/primitives/tooltip';
import { ROUTES } from '@/utils/routes';
import { ChannelTypeEnum, type IEnvironment, type IIntegration, type IProviderConfig } from '@novu/shared';
import {
RiCheckboxCircleFill,
RiCloseCircleFill,
RiGitBranchFill,
RiSettings4Line,
RiStarSmileLine,
} from 'react-icons/ri';
import { RiCheckboxCircleFill, RiGitBranchFill, RiSettings4Line, RiStarSmileLine } from 'react-icons/ri';
import { useNavigate } from 'react-router-dom';
import { cn } from '../../../utils/ui';
import { StatusBadge, StatusBadgeIcon } from '../../primitives/status-badge';
import { TableIntegration } from '../types';
import { ProviderIcon } from './provider-icon';
import { isDemoIntegration } from './utils/helpers';
Expand Down Expand Up @@ -81,7 +74,7 @@ export function IntegrationCard({ integration, provider, environment, onClick }:
<Tooltip>
<TooltipTrigger className="flex h-[16px] items-center gap-1">
<span className="flex h-[16px] items-center gap-1">
<Badge variant="lighter" color="yellow" size="sm">
<Badge variant="warning" className="text-2xs h-[16px] rounded-sm text-[#F6B51E]">
DEMO
</Badge>
</span>
Expand Down Expand Up @@ -109,17 +102,17 @@ export function IntegrationCard({ integration, provider, environment, onClick }:
Connect
</Button>
) : (
<StatusBadge variant="light" status={integration.active ? 'completed' : 'disabled'}>
<StatusBadgeIcon as={integration.active ? RiCheckboxCircleFill : RiCloseCircleFill} />
<Badge variant={integration.active ? 'success' : 'neutral'} className="capitalize">
<RiCheckboxCircleFill className="text-success h-4 w-4" />
{integration.active ? 'Active' : 'Inactive'}
</StatusBadge>
</Badge>
)}
<StatusBadge variant="stroke" status="pending" className="gap-1 shadow-none">
<Badge variant="outline" className="shadow-none">
<RiGitBranchFill
className={cn('h-4 w-4', environment.name.toLowerCase() === 'production' ? 'text-feature' : 'text-warning')}
/>
{environment.name}
</StatusBadge>
</Badge>
</div>
</div>
);
Expand Down
Loading
Loading