fix: proper Google/Bunny logos and BunnyCDN status grid in unified integrations
This commit is contained in:
@@ -2,13 +2,39 @@
|
|||||||
|
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { Button, toast, Spinner } from '@ciphera-net/ui'
|
import { Button, toast, Spinner } from '@ciphera-net/ui'
|
||||||
import { GoogleLogo, ArrowSquareOut, Plugs, Trash, ShieldCheck, CaretDown } from '@phosphor-icons/react'
|
import { Plugs, Trash, ShieldCheck, CaretDown } from '@phosphor-icons/react'
|
||||||
import { useGSCStatus, useBunnyStatus } from '@/lib/swr/dashboard'
|
import { useGSCStatus, useBunnyStatus } from '@/lib/swr/dashboard'
|
||||||
import { disconnectGSC, getGSCAuthURL } from '@/lib/api/gsc'
|
import { disconnectGSC, getGSCAuthURL } from '@/lib/api/gsc'
|
||||||
import { disconnectBunny, getBunnyPullZones, connectBunny, type BunnyPullZone } from '@/lib/api/bunny'
|
import { disconnectBunny, getBunnyPullZones, connectBunny, type BunnyPullZone } from '@/lib/api/bunny'
|
||||||
import { getAuthErrorMessage } from '@ciphera-net/ui'
|
import { getAuthErrorMessage } from '@ciphera-net/ui'
|
||||||
import { formatDateTime } from '@/lib/utils/formatDate'
|
import { formatDateTime } from '@/lib/utils/formatDate'
|
||||||
|
|
||||||
|
function GoogleIcon() {
|
||||||
|
return (
|
||||||
|
<svg className="w-5 h-5" viewBox="0 0 24 24">
|
||||||
|
<path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4" />
|
||||||
|
<path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853" />
|
||||||
|
<path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05" />
|
||||||
|
<path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function BunnyIcon() {
|
||||||
|
return (
|
||||||
|
<svg className="w-5 h-5" viewBox="0 0 24 24">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="bunny-grad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||||
|
<stop offset="0%" stopColor="#FF6B00" />
|
||||||
|
<stop offset="100%" stopColor="#FF9E00" />
|
||||||
|
</linearGradient>
|
||||||
|
</defs>
|
||||||
|
<circle cx="12" cy="12" r="11" fill="url(#bunny-grad)" />
|
||||||
|
<path d="M8.5 7c-.8-2-2.5-3-2.5-3s.5 2.5 1 3.5C5.5 8.5 5 10.5 5 12c0 3.9 3.1 7 7 7s7-3.1 7-7c0-1.5-.5-3.5-2-4.5.5-1 1-3.5 1-3.5s-1.7 1-2.5 3C14.5 6.5 13.3 6 12 6s-2.5.5-3.5 1z" fill="white" fillOpacity="0.9" />
|
||||||
|
</svg>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function IntegrationCard({
|
function IntegrationCard({
|
||||||
icon,
|
icon,
|
||||||
name,
|
name,
|
||||||
@@ -281,7 +307,7 @@ export default function SiteIntegrationsTab({ siteId }: { siteId: string }) {
|
|||||||
|
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<IntegrationCard
|
<IntegrationCard
|
||||||
icon={<GoogleLogo weight="bold" className="w-5 h-5 text-white" />}
|
icon={<GoogleIcon />}
|
||||||
name="Google Search Console"
|
name="Google Search Console"
|
||||||
description="View search queries, clicks, impressions, and ranking data."
|
description="View search queries, clicks, impressions, and ranking data."
|
||||||
connected={gscStatus?.connected ?? false}
|
connected={gscStatus?.connected ?? false}
|
||||||
@@ -295,7 +321,7 @@ export default function SiteIntegrationsTab({ siteId }: { siteId: string }) {
|
|||||||
</IntegrationCard>
|
</IntegrationCard>
|
||||||
|
|
||||||
<IntegrationCard
|
<IntegrationCard
|
||||||
icon={<img src="https://ciphera.net/bunny-icon.svg" alt="BunnyCDN" className="w-5 h-5" onError={e => { (e.target as HTMLImageElement).style.display = 'none' }} />}
|
icon={<BunnyIcon />}
|
||||||
name="BunnyCDN"
|
name="BunnyCDN"
|
||||||
description="Monitor bandwidth, cache hit rates, and CDN performance."
|
description="Monitor bandwidth, cache hit rates, and CDN performance."
|
||||||
connected={bunnyConnected}
|
connected={bunnyConnected}
|
||||||
@@ -303,6 +329,33 @@ export default function SiteIntegrationsTab({ siteId }: { siteId: string }) {
|
|||||||
onConnect={handleConnectBunny}
|
onConnect={handleConnectBunny}
|
||||||
onDisconnect={handleDisconnectBunny}
|
onDisconnect={handleDisconnectBunny}
|
||||||
>
|
>
|
||||||
|
{bunnyConnected && (
|
||||||
|
<div className="px-4 pb-4 space-y-3">
|
||||||
|
<div className="grid grid-cols-2 gap-x-6 gap-y-2 px-4 py-3 rounded-lg bg-neutral-800/40 border border-neutral-700/50">
|
||||||
|
<div className="flex flex-col gap-0.5">
|
||||||
|
<span className="text-xs text-neutral-500">Pull Zone</span>
|
||||||
|
<span className="text-sm text-white">{bunnyStatus?.pull_zone_name || 'Unknown'}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col gap-0.5">
|
||||||
|
<span className="text-xs text-neutral-500">Last Synced</span>
|
||||||
|
<span className="text-sm text-white">{bunnyStatus?.last_synced_at ? formatDateTime(new Date(bunnyStatus.last_synced_at)) : 'Never'}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col gap-0.5">
|
||||||
|
<span className="text-xs text-neutral-500">Connected Since</span>
|
||||||
|
<span className="text-sm text-white">{bunnyStatus?.created_at ? formatDateTime(new Date(bunnyStatus.created_at)) : 'Unknown'}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col gap-0.5">
|
||||||
|
<span className="text-xs text-neutral-500">Status</span>
|
||||||
|
<StatusDot status={bunnyStatus?.status} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{bunnyStatus?.error_message && (
|
||||||
|
<div className="px-4 py-3 rounded-lg bg-red-900/20 border border-red-900/50">
|
||||||
|
<p className="text-xs text-red-400">{bunnyStatus.error_message}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{!bunnyConnected && showBunnySetup && (
|
{!bunnyConnected && showBunnySetup && (
|
||||||
<BunnySetupForm
|
<BunnySetupForm
|
||||||
siteId={siteId}
|
siteId={siteId}
|
||||||
|
|||||||
Reference in New Issue
Block a user