refactor: use custom toast from @ciphera-net/ui

This commit is contained in:
Usman Baig
2026-01-27 21:52:11 +01:00
parent d9c3294eeb
commit 1114b0d27a
9 changed files with 10 additions and 28 deletions

View File

@@ -1,6 +1,5 @@
import { ThemeProviders } from '@ciphera-net/ui'
import { ThemeProviders, Toaster } from '@ciphera-net/ui'
import { AuthProvider } from '@/lib/auth/context'
import { Toaster } from 'sonner'
import type { Metadata, Viewport } from 'next'
import { Plus_Jakarta_Sans } from 'next/font/google'
import LayoutContent from './layout-content'
@@ -49,24 +48,7 @@ export default function RootLayout({
<ThemeProviders>
<AuthProvider>
<LayoutContent>{children}</LayoutContent>
<Toaster
position="top-center"
closeButton
theme="system"
className="toaster group"
toastOptions={{
classNames: {
toast: 'group toast group-[.toaster]:bg-white group-[.toaster]:dark:bg-neutral-900 group-[.toaster]:text-neutral-950 group-[.toaster]:dark:text-neutral-50 group-[.toaster]:border-neutral-200 group-[.toaster]:dark:border-neutral-800 group-[.toaster]:shadow-lg group-[.toaster]:rounded-xl font-medium',
description: 'group-[.toast]:text-neutral-500 group-[.toast]:dark:text-neutral-400',
actionButton: 'group-[.toast]:bg-neutral-900 group-[.toast]:dark:bg-neutral-50 group-[.toast]:text-neutral-50 group-[.toast]:dark:text-neutral-900',
cancelButton: 'group-[.toast]:bg-neutral-100 group-[.toast]:dark:bg-neutral-800 group-[.toast]:text-neutral-500 group-[.toast]:dark:text-neutral-400',
success: 'group-[.toast]:!text-green-600 group-[.toast]:dark:!text-green-400',
error: 'group-[.toast]:!text-red-600 group-[.toast]:dark:!text-red-400',
warning: 'group-[.toast]:!text-amber-600 group-[.toast]:dark:!text-amber-400',
info: 'group-[.toast]:!text-brand-orange group-[.toast]:dark:!text-brand-orange',
},
}}
/>
<Toaster />
</AuthProvider>
</ThemeProviders>
</body>

View File

@@ -9,7 +9,7 @@ import { LoadingOverlay } from '@ciphera-net/ui'
import SiteList from '@/components/sites/SiteList'
import { Button } from '@ciphera-net/ui'
import { BarChartIcon, LockIcon, ZapIcon } from '@ciphera-net/ui'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
export default function HomePage() {
const { user, loading: authLoading } = useAuth()

View File

@@ -3,7 +3,7 @@
import { useEffect, useState } from 'react'
import { useParams, useSearchParams, useRouter } from 'next/navigation'
import { getPublicDashboard, getPublicStats, getPublicDailyStats, getPublicRealtime, getPublicPerformanceByPage, type DashboardData, type Stats, type DailyStat, type PerformanceByPageStat } from '@/lib/api/stats'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { LoadingOverlay } from '@ciphera-net/ui'
import Chart from '@/components/dashboard/Chart'
import TopPages from '@/components/dashboard/ContentStats'

View File

@@ -6,7 +6,7 @@ import { useParams, useRouter } from 'next/navigation'
import { getSite, type Site } from '@/lib/api/sites'
import { getStats, getRealtime, getDailyStats, getTopPages, getTopReferrers, getCountries, getCities, getRegions, getBrowsers, getOS, getDevices, getScreenResolutions, getEntryPages, getExitPages, getDashboard, getPerformanceByPage, type Stats, type DailyStat, type PerformanceByPageStat } from '@/lib/api/stats'
import { formatNumber, formatDuration, getDateRange } from '@/lib/utils/format'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { LoadingOverlay } from '@ciphera-net/ui'
import { Select, DatePicker } from '@ciphera-net/ui'
import ContentStats from '@/components/dashboard/ContentStats'

View File

@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { getSite, type Site } from '@/lib/api/sites'
import { getRealtimeVisitors, getSessionDetails, type Visitor, type SessionEvent } from '@/lib/api/realtime'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { LoadingOverlay } from '@ciphera-net/ui'
function formatTimeAgo(dateString: string) {

View File

@@ -3,7 +3,7 @@
import { useEffect, useState } from 'react'
import { useParams, useRouter } from 'next/navigation'
import { getSite, updateSite, resetSiteData, deleteSite, type Site, type GeoDataLevel } from '@/lib/api/sites'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { LoadingOverlay } from '@ciphera-net/ui'
import VerificationModal from '@/components/sites/VerificationModal'
import { PasswordInput } from '@ciphera-net/ui'

View File

@@ -3,7 +3,7 @@
import { useState } from 'react'
import { useRouter } from 'next/navigation'
import { createSite } from '@/lib/api/sites'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { Button, Input } from '@ciphera-net/ui'
export default function NewSitePage() {

View File

@@ -16,7 +16,7 @@ import {
OrganizationInvitation,
Organization
} from '@/lib/api/organization'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
import { motion, AnimatePresence } from 'framer-motion'
import {
AlertTriangleIcon,

View File

@@ -11,7 +11,7 @@ import {
} from '@ciphera-net/ui'
import { Site } from '@/lib/api/sites'
import { getRealtime } from '@/lib/api/stats'
import { toast } from 'sonner'
import { toast } from '@ciphera-net/ui'
interface VerificationModalProps {
isOpen: boolean