chore: upgrade @ciphera-net/ui to v0.0.22 in package-lock.json

This commit is contained in:
Usman Baig
2026-01-27 18:06:53 +01:00
parent 41974dae53
commit 5dd785d2be
5 changed files with 486 additions and 0 deletions

34
components/Footer.tsx Normal file
View File

@@ -0,0 +1,34 @@
import Link from 'next/link'
import React from 'react'
interface FooterProps {
LinkComponent?: any
appName?: string
}
export function Footer({ LinkComponent = Link, appName = 'Pulse' }: FooterProps) {
const Component = LinkComponent
return (
<footer className="border-t border-neutral-200 dark:border-neutral-800 mt-auto bg-white dark:bg-neutral-950">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div className="flex flex-col md:flex-row justify-between items-center gap-4">
<div className="text-sm text-neutral-500 dark:text-neutral-400">
© {new Date().getFullYear()} Ciphera. All rights reserved.
</div>
<div className="flex gap-6 text-sm font-medium text-neutral-600 dark:text-neutral-300">
<Component href="/about" className="hover:text-brand-orange transition-colors">
Why {appName}
</Component>
<Component href="/security" className="hover:text-brand-orange transition-colors">
Security
</Component>
<Component href="/faq" className="hover:text-brand-orange transition-colors">
FAQ
</Component>
</div>
</div>
</div>
</footer>
)
}

View File

@@ -0,0 +1,42 @@
'use client'
import React, { useEffect, useState } from 'react'
import { createPortal } from 'react-dom'
interface LoadingOverlayProps {
logoSrc?: string
title?: string
}
export default function LoadingOverlay({
logoSrc = "/ciphera_icon_no_margins.png",
title = "Pulse"
}: LoadingOverlayProps) {
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
return () => setMounted(false)
}, [])
if (!mounted) return null
return createPortal(
<div className="fixed inset-0 z-[100] flex items-center justify-center bg-white dark:bg-neutral-950 animate-in fade-in duration-200">
<div className="flex flex-col items-center gap-6">
<div className="flex items-center gap-3">
<img
src={logoSrc}
alt={typeof title === 'string' ? title : "Pulse"}
className="h-12 w-auto object-contain"
/>
<span className="text-3xl tracking-tight text-neutral-900 dark:text-white">
<span className="font-bold">Ciphera</span><span className="font-light">Pulse</span>
</span>
</div>
<div className="h-8 w-8 animate-spin rounded-full border-4 border-neutral-200 border-t-brand-orange dark:border-neutral-800 dark:border-t-brand-orange" />
</div>
</div>,
document.body
)
}

View File

@@ -0,0 +1,109 @@
'use client'
import { useState } from 'react'
interface PasswordInputProps {
value: string
onChange: (value: string) => void
label?: string
placeholder?: string
error?: string | null
disabled?: boolean
required?: boolean
className?: string
id?: string
autoComplete?: string
minLength?: number
onFocus?: () => void
onBlur?: () => void
}
export default function PasswordInput({
value,
onChange,
label = 'Password',
placeholder = 'Enter password',
error,
disabled = false,
required = false,
className = '',
id,
autoComplete,
minLength,
onFocus,
onBlur
}: PasswordInputProps) {
const [showPassword, setShowPassword] = useState(false)
const inputId = id || 'password-input'
const errorId = `${inputId}-error`
return (
<div className={`space-y-1.5 ${className}`}>
{label && (
<label
htmlFor={inputId}
className="block text-sm font-medium text-neutral-700 dark:text-neutral-300"
>
{label}
{required && <span className="text-brand-orange text-xs ml-1">(Required)</span>}
</label>
)}
<div className="relative group">
<input
id={inputId}
type={showPassword ? 'text' : 'password'}
value={value}
onChange={(e) => onChange(e.target.value)}
placeholder={placeholder}
disabled={disabled}
autoComplete={autoComplete}
minLength={minLength}
onFocus={onFocus}
onBlur={onBlur}
aria-invalid={!!error}
aria-describedby={error ? errorId : undefined}
className={`w-full pl-11 pr-12 py-3 border rounded-xl bg-neutral-50/50 dark:bg-neutral-900/50 focus:bg-white dark:focus:bg-neutral-900
transition-all duration-200 outline-none disabled:opacity-50 disabled:cursor-not-allowed dark:text-white
${error
? 'border-red-300 dark:border-red-800 focus:border-red-500 focus:ring-4 focus:ring-red-500/10'
: 'border-neutral-200 dark:border-neutral-800 hover:border-brand-orange/50 focus:border-brand-orange focus:ring-4 focus:ring-brand-orange/10'
}`}
/>
{/* Lock Icon (Left) */}
<div className={`absolute left-3.5 top-1/2 -translate-y-1/2 pointer-events-none transition-colors duration-200
${error ? 'text-red-400' : 'text-neutral-400 dark:text-neutral-500 group-focus-within:text-brand-orange'}`}>
<svg aria-hidden="true" className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</div>
{/* Toggle Visibility Button (Right) */}
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
disabled={disabled}
aria-label={showPassword ? "Hide password" : "Show password"}
className="absolute right-3 top-1/2 -translate-y-1/2 p-1.5 rounded-lg text-neutral-400 dark:text-neutral-500
hover:text-neutral-600 dark:hover:text-neutral-300 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition-all duration-200 focus:outline-none"
>
{showPassword ? (
<svg aria-hidden="true" className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
</svg>
) : (
<svg aria-hidden="true" className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
</svg>
)}
</button>
</div>
{error && (
<p id={errorId} role="alert" className="text-xs text-red-500 font-medium ml-1">
{error}
</p>
)}
</div>
)
}

View File

@@ -0,0 +1,192 @@
'use client'
import { useEffect, useState } from 'react'
import {
PlayIcon,
PauseIcon,
EnterFullScreenIcon,
ExitFullScreenIcon,
} from '@radix-ui/react-icons'
/** Formats milliseconds as mm:ss. */
function formatTime(ms: number): string {
if (!Number.isFinite(ms) || ms < 0) return '0:00'
const s = Math.floor(ms / 1000)
const m = Math.floor(s / 60)
return `${m}:${String(s % 60).padStart(2, '0')}`
}
const SPEED_OPTIONS = [1, 2, 4, 8] as const
export type ReplayPlayerControlsProps = {
isPlaying: boolean
onPlayPause: () => void
currentTimeMs: number
totalTimeMs: number
onSeek: (fraction: number) => void
speed: number
onSpeedChange: (speed: number) => void
skipInactive: boolean
onSkipInactiveChange: () => void
onFullscreenRequest: () => void
}
/**
* Custom session replay player controls with Ciphera branding.
* Matches design: brand orange #FD5E0F, Plus Jakarta Sans, rounded-xl, neutral greys.
*/
export default function ReplayPlayerControls({
isPlaying,
onPlayPause,
currentTimeMs,
totalTimeMs,
onSeek,
speed,
onSpeedChange,
skipInactive,
onSkipInactiveChange,
onFullscreenRequest,
}: ReplayPlayerControlsProps) {
const [isFullscreen, setIsFullscreen] = useState(false)
const [isSeeking, setIsSeeking] = useState(false)
const [seekValue, setSeekValue] = useState(0)
const totalSec = totalTimeMs / 1000
const currentSec = currentTimeMs / 1000
const fraction = totalSec > 0 ? Math.min(1, Math.max(0, currentSec / totalSec)) : 0
const displayFraction = isSeeking ? seekValue : fraction
useEffect(() => {
const onFullscreenChange = () => {
setIsFullscreen(!!document.fullscreenElement)
}
document.addEventListener('fullscreenchange', onFullscreenChange)
return () => document.removeEventListener('fullscreenchange', onFullscreenChange)
}, [])
const handleSeekChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const v = parseFloat(e.target.value)
const p = Number.isFinite(v) ? Math.max(0, Math.min(1, v)) : 0
setSeekValue(p)
onSeek(p)
}
const handleSeekPointerDown = () => {
setSeekValue(fraction)
setIsSeeking(true)
}
const handleSeekPointerUp = () => setIsSeeking(false)
return (
<div
className="flex flex-col gap-3 px-4 py-3 bg-neutral-800/95 border-t border-neutral-700/80"
style={{ fontFamily: 'var(--font-plus-jakarta-sans), system-ui, sans-serif' }}
>
{/* * Progress bar / timeline */}
<div className="flex items-center gap-3">
<span className="text-neutral-400 text-xs tabular-nums w-10 text-right shrink-0">
{formatTime(currentTimeMs)}
</span>
<div className="flex-1 relative h-2 bg-neutral-600/80 rounded-full overflow-hidden group">
<div
className="absolute left-0 top-0 bottom-0 rounded-full bg-brand-orange transition-all duration-150 flex items-center justify-end"
style={{ width: `${displayFraction * 100}%` }}
>
{displayFraction > 0 && displayFraction < 1 && (
<div className="w-3 h-3 rounded-full bg-white shadow-md border border-neutral-800 -mr-1.5 flex-shrink-0" />
)}
</div>
<input
type="range"
min={0}
max={1}
step={0.001}
value={isSeeking ? seekValue : fraction}
onChange={handleSeekChange}
onMouseDown={handleSeekPointerDown}
onMouseUp={handleSeekPointerUp}
onTouchStart={handleSeekPointerDown}
onTouchEnd={handleSeekPointerUp}
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
aria-label="Seek"
/>
</div>
<span className="text-neutral-400 text-xs tabular-nums w-10 shrink-0">
{formatTime(totalTimeMs)}
</span>
</div>
{/* * Buttons row */}
<div className="flex items-center justify-between gap-4">
<div className="flex items-center gap-1">
{/* * Play / Pause */}
<button
type="button"
onClick={onPlayPause}
className="w-9 h-9 rounded-lg bg-brand-orange text-white flex items-center justify-center hover:bg-brand-orange/90 active:scale-95 transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-brand-orange focus:ring-offset-2 focus:ring-offset-neutral-800"
aria-label={isPlaying ? 'Pause' : 'Play'}
>
{isPlaying ? (
<PauseIcon className="w-4 h-4" />
) : (
<PlayIcon className="w-4 h-4 ml-0.5" />
)}
</button>
{/* * Speed pills */}
<div className="flex items-center rounded-lg overflow-hidden border border-neutral-600/80">
{SPEED_OPTIONS.map((s) => (
<button
key={s}
type="button"
onClick={() => onSpeedChange(s)}
className={`px-2.5 py-1.5 text-xs font-medium transition-colors duration-200 focus:outline-none focus:ring-1 focus:ring-brand-orange focus:ring-inset ${
speed === s
? 'bg-brand-orange text-white'
: 'text-neutral-400 hover:text-neutral-200 hover:bg-neutral-600/60'
}`}
>
{s}x
</button>
))}
</div>
{/* * Skip inactive toggle */}
<button
type="button"
role="switch"
aria-checked={skipInactive}
onClick={onSkipInactiveChange}
className="flex items-center gap-2 ml-2 bg-transparent border-0 cursor-pointer select-none p-0 focus:outline-none focus:ring-2 focus:ring-brand-orange focus:ring-offset-2 focus:ring-offset-neutral-800 rounded"
>
<span className="text-neutral-400 text-xs">Skip inactive</span>
<span
className={`relative inline-block w-9 h-5 rounded-full transition-colors duration-200 ${
skipInactive ? 'bg-brand-orange' : 'bg-neutral-600'
}`}
>
<span
className={`absolute top-1 w-3 h-3 rounded-full bg-white shadow transition-all duration-200 ${
skipInactive ? 'left-5' : 'left-1'
}`}
/>
</span>
</button>
</div>
{/* * Fullscreen */}
<button
type="button"
onClick={onFullscreenRequest}
className="w-9 h-9 rounded-lg text-neutral-400 hover:text-white hover:bg-neutral-600/60 flex items-center justify-center transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-brand-orange focus:ring-offset-2 focus:ring-offset-neutral-800"
aria-label={isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'}
>
{isFullscreen ? (
<ExitFullScreenIcon className="w-4 h-4" />
) : (
<EnterFullScreenIcon className="w-4 h-4" />
)}
</button>
</div>
</div>
)
}

View File

@@ -0,0 +1,109 @@
'use client'
import { useState } from 'react'
import { useRouter } from 'next/navigation'
import { PlusIcon, PersonIcon, CubeIcon, CheckIcon } from '@radix-ui/react-icons'
import { switchContext, OrganizationMember } from '@/lib/api/organization'
import { setSessionAction } from '@/app/actions/auth'
import Link from 'next/link'
export default function WorkspaceSwitcher({ orgs, activeOrgId }: { orgs: OrganizationMember[], activeOrgId: string | null }) {
const router = useRouter()
const [switching, setSwitching] = useState<string | null>(null)
const handleSwitch = async (orgId: string | null) => {
console.log('Switching to workspace:', orgId)
setSwitching(orgId || 'personal')
try {
// * If orgId is null, we can't switch context via API in the same way if strict mode is on
// * BUT, Pulse doesn't support personal workspace.
// * So we should probably NOT show the "Personal" option in Pulse if strict mode is enforced.
// * However, to match Drop exactly, we might want to show it but have it fail or redirect?
// * Let's assume for now we want to match Drop's UI structure.
if (!orgId) {
// * Pulse doesn't support personal context.
// * We could redirect to onboarding or show an error.
// * For now, let's just return to avoid breaking.
return
}
const { access_token } = await switchContext(orgId)
// * Update session cookie via server action
// * Note: switchContext only returns access_token, we keep existing refresh token
await setSessionAction(access_token)
// Force reload to pick up new permissions
window.location.reload()
} catch (err) {
console.error('Failed to switch workspace', err)
setSwitching(null)
}
}
return (
<div className="border-b border-neutral-100 dark:border-neutral-800 pb-2 mb-2">
<div className="px-3 py-2 text-xs font-medium text-neutral-500 uppercase tracking-wider">
Workspaces
</div>
{/* Personal Workspace - HIDDEN IN PULSE (Strict Mode) */}
{/*
<button
onClick={() => handleSwitch(null)}
className={`w-full flex items-center justify-between px-3 py-2 text-sm rounded-md transition-colors group ${
!activeOrgId ? 'bg-neutral-100 dark:bg-neutral-800' : 'hover:bg-neutral-50 dark:hover:bg-neutral-800/50'
}`}
>
<div className="flex items-center gap-2">
<div className="h-5 w-5 rounded bg-neutral-200 dark:bg-neutral-700 flex items-center justify-center">
<PersonIcon className="h-3 w-3 text-neutral-500 dark:text-neutral-400" />
</div>
<span className="text-neutral-700 dark:text-neutral-300">Personal</span>
</div>
<div className="flex items-center gap-2">
{switching === 'personal' && <span className="text-xs text-neutral-400">Loading...</span>}
{!activeOrgId && !switching && <CheckIcon className="h-4 w-4 text-neutral-600 dark:text-neutral-400" />}
</div>
</button>
*/}
{/* Organization Workspaces */}
{orgs.map((org) => (
<button
key={org.organization_id}
onClick={() => handleSwitch(org.organization_id)}
className={`w-full flex items-center justify-between px-3 py-2 text-sm rounded-md transition-colors mt-1 ${
activeOrgId === org.organization_id ? 'bg-neutral-100 dark:bg-neutral-800' : 'hover:bg-neutral-50 dark:hover:bg-neutral-800/50'
}`}
>
<div className="flex items-center gap-2">
<div className="h-5 w-5 rounded bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center">
<CubeIcon className="h-3 w-3 text-blue-600 dark:text-blue-400" />
</div>
<span className="text-neutral-700 dark:text-neutral-300 truncate max-w-[140px]">
{org.organization_name}
</span>
</div>
<div className="flex items-center gap-2">
{switching === org.organization_id && <span className="text-xs text-neutral-400">Loading...</span>}
{activeOrgId === org.organization_id && !switching && <CheckIcon className="h-4 w-4 text-neutral-600 dark:text-neutral-400" />}
</div>
</button>
))}
{/* Create New */}
<Link
href="/onboarding"
className="w-full flex items-center gap-2 px-3 py-2 text-sm text-neutral-500 hover:text-blue-600 dark:text-neutral-400 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/10 rounded-md transition-colors mt-1"
>
<div className="h-5 w-5 rounded border border-dashed border-neutral-300 dark:border-neutral-600 flex items-center justify-center">
<PlusIcon className="h-3 w-3" />
</div>
<span>Create Organization</span>
</Link>
</div>
)
}