Files
supabase/apps/studio/components/interfaces/BranchManagement/WorkflowLogsCard.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

113 lines
3.5 KiB
TypeScript

import { motion } from 'framer-motion'
import { CircleDotDashed, GitMerge, X } from 'lucide-react'
import { useEffect, useRef } from 'react'
import { Button, Card, CardContent, CardHeader, CardTitle } from 'ui'
import { ActionRun } from '@/data/actions/action-detail-query'
interface WorkflowLogsCardProps {
workflowRun: ActionRun | null | undefined
logs: string | undefined
isLoading?: boolean
onClose?: () => void
// Override props for failed workflows
overrideTitle?: string
overrideDescription?: string
overrideIcon?: React.ReactNode
overrideAction?: React.ReactNode
}
export const WorkflowLogsCard = ({
workflowRun,
logs,
isLoading = false,
onClose,
overrideTitle,
overrideDescription,
overrideIcon,
overrideAction,
}: WorkflowLogsCardProps) => {
const scrollRef = useRef<HTMLDivElement>(null)
// Auto-scroll to bottom when logs change
useEffect(() => {
if (scrollRef.current && logs) {
scrollRef.current.scrollTop = scrollRef.current.scrollHeight
}
}, [logs])
const workflowRunStatus = workflowRun?.status
const isSuccess = workflowRunStatus === 'SUCCESS'
const isFailed = workflowRunStatus === 'FAILED'
const isPolling = workflowRunStatus === 'RUNNING'
const displayTitle =
overrideTitle ||
(isPolling
? 'Processing...'
: isSuccess
? 'Workflow completed successfully'
: isFailed
? 'Workflow failed'
: 'Workflow completed')
const displayIcon =
overrideIcon ||
(isPolling ? (
<motion.div
animate={{ rotate: 360 }}
transition={{ duration: 2, repeat: Infinity, ease: 'linear' }}
>
<CircleDotDashed size={16} strokeWidth={1.5} className="text-warning" />
</motion.div>
) : isSuccess ? (
<GitMerge size={16} strokeWidth={1.5} className="text-brand" />
) : null)
return (
<Card className="bg-background overflow-hidden h-64 flex flex-col">
<CardHeader className={isSuccess ? 'text-brand' : isFailed ? 'text-destructive' : ''}>
<div className="flex items-center justify-between">
<div className="flex items-center gap-4">
{displayIcon}
<div>
<CardTitle className="text-sm font-medium">{displayTitle}</CardTitle>
{overrideDescription && (
<div className="text-sm text-foreground-light font-normal mt-0">
{overrideDescription}
</div>
)}
</div>
</div>
<div className="flex items-center gap-4">
{overrideAction}
{onClose && (
<Button
type="text"
size="tiny"
icon={<X size={12} strokeWidth={1.5} />}
onClick={onClose}
className="h-5 w-5 p-0"
/>
)}
</div>
</div>
</CardHeader>
<CardContent
ref={scrollRef}
className="overflow-hidden border-0 overflow-y-auto relative p-0"
>
{/* sticky gradient overlay */}
<div className="sticky top-0 -mb-8 h-8 bg-linear-to-b from-background to-transparent pointer-events-none z-10" />
{logs ? (
<pre className="p-6 text-xs text-foreground-light p-0 rounded-sm">{logs}</pre>
) : (
<pre className="p-6 text-sm text-foreground-light rounded-sm">
{isLoading || isPolling ? 'Initializing workflow...' : 'Waiting for logs...'}
</pre>
)}
</CardContent>
</Card>
)
}