Skip to content

Commit 2e43ff4

Browse files
committed
chore: small fixes to playground
Squashed commit of the following: commit 5ab0f54 Author: Wojtek Majewski <wojciech.majewski@pm.me> Date: Sun May 4 10:45:33 2025 +0200 refactor(website-analysis-ui): remove duplicate collapse buttons and streamline UI controls - Eliminated redundant collapse button at the bottom of expanded details - Simplified toggle logic for analysis details and results sections - Improved component readability by removing unnecessary code and markup commit 490e407 Author: Wojtek Majewski <wojciech.majewski@pm.me> Date: Sun May 4 10:43:15 2025 +0200 feat: update UI to include description for website analysis trigger - Added explanatory span to the "Analyze Website" header when analysis is completed or failed - Clarifies that triggering analysis uses a multi-step workflow with pgflow commit b5b6957 Author: Wojtek Majewski <wojciech.majewski@pm.me> Date: Sun May 4 10:42:23 2025 +0200 refactor: remove inline CSS and dynamic style injection for breathing animation - Removed CSS keyframes and breathing class from CSS files - Eliminated useEffect hook that dynamically injected styles in component - Simplifies styling approach by removing runtime style manipulation and inline styles
1 parent ba424e6 commit 2e43ff4

File tree

3 files changed

+27
-61
lines changed

3 files changed

+27
-61
lines changed

examples/playground/app/globals.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,28 @@
6363
* {
6464
@apply border-border;
6565
}
66+
6667
body {
6768
@apply bg-background text-foreground;
6869
}
6970
}
71+
72+
/********** CUSTOM OVERRIDES **********/
73+
74+
@keyframes breathe {
75+
0% {
76+
opacity: 0.4;
77+
}
78+
79+
50% {
80+
opacity: 1;
81+
}
82+
83+
100% {
84+
opacity: 0.4;
85+
}
86+
}
87+
88+
.breathing {
89+
animation: breathe 2s infinite ease-in-out;
90+
}

examples/playground/components/flow-run-details.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,6 @@ import {
1010
import JSONHighlighter from '@/components/json-highlighter';
1111
import { FormMessage } from '@/components/form-message';
1212

13-
// Add CSS for breathing animation
14-
const breathingAnimation = `
15-
@keyframes breathe {
16-
0% { opacity: 0.4; }
17-
50% { opacity: 1; }
18-
100% { opacity: 0.4; }
19-
}
20-
.breathing {
21-
animation: breathe 2s infinite ease-in-out;
22-
}
23-
`;
24-
2513
// Format time difference in a concise way (e.g., "5s", "3m 45s", "2h 15m")
2614
function formatTimeDifference(
2715
startDate: string | null,
@@ -107,19 +95,6 @@ export default function FlowRunDetails({
10795
error,
10896
currentTime,
10997
}: FlowRunDetailsProps) {
110-
// Add the breathing animation to the head
111-
useEffect(() => {
112-
// Add the style element to the head
113-
const styleElement = document.createElement('style');
114-
styleElement.innerHTML = breathingAnimation;
115-
document.head.appendChild(styleElement);
116-
117-
// Clean up when component unmounts
118-
return () => {
119-
document.head.removeChild(styleElement);
120-
};
121-
}, []);
122-
12398
if (loading) {
12499
return (
125100
<div className="flex items-center justify-center min-h-[30vh]">

examples/playground/components/website-analysis-ui.tsx

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ export default function WebsiteAnalysisUI({
211211
{/* Top bar with analyze form when analysis is completed */}
212212
{(isCompleted || isFailed) && (
213213
<div className="mb-6">
214-
<h3 className="text-base font-medium mb-2">Analyze Website</h3>
214+
<h3 className="text-base font-medium mb-2">
215+
Analyze Website
216+
<span className="ml-2 text-xs text-muted-foreground">
217+
Triggers a multi-step workflow using <strong>pgflow</strong>
218+
</span>
219+
</h3>
215220
<form
216221
onSubmit={handleSubmit}
217222
className="flex flex-col sm:flex-row gap-2"
@@ -538,17 +543,6 @@ export default function WebsiteAnalysisUI({
538543
</div>
539544
</motion.div>
540545
))}
541-
542-
{/* Duplicate collapse button at the bottom of expanded details */}
543-
{!isRunning && !isFailed && (
544-
<div
545-
onClick={() => setAnalysisExpanded(false)}
546-
className="flex items-center justify-between p-2 rounded-md cursor-pointer hover:bg-muted/50 border border-muted-foreground/20 mt-4"
547-
>
548-
<span className="text-sm font-medium">Hide Details</span>
549-
<ChevronUp className="h-4 w-4 text-muted-foreground" />
550-
</div>
551-
)}
552546
</motion.div>
553547
)}
554548
</AnimatePresence>
@@ -566,30 +560,6 @@ export default function WebsiteAnalysisUI({
566560
<div className="mb-4">
567561
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4">
568562
<h3 className="text-xl font-medium">Analysis Results</h3>
569-
{!isRunning && (
570-
<div
571-
onClick={() => setAnalysisExpanded(!analysisExpanded)}
572-
className="flex items-center gap-2 px-3 py-1 rounded-md cursor-pointer hover:bg-muted/50 border border-muted-foreground/20 mt-2 sm:mt-0 self-start"
573-
>
574-
<span className="text-sm font-medium">Details</span>
575-
<span
576-
className={`inline-flex items-center text-xs px-2 py-1 rounded-full ${
577-
runData?.status === 'completed'
578-
? 'bg-green-100 text-green-800'
579-
: runData?.status === 'failed'
580-
? 'bg-red-100 text-red-800'
581-
: 'bg-blue-100 text-blue-800'
582-
}`}
583-
>
584-
{runData?.status === 'completed' ? 'OK' : runData?.status}
585-
</span>
586-
{analysisExpanded ? (
587-
<ChevronUp className="h-4 w-4 text-muted-foreground" />
588-
) : (
589-
<ChevronDown className="h-4 w-4 text-muted-foreground" />
590-
)}
591-
</div>
592-
)}
593563
</div>
594564
<span className="text-sm font-medium text-muted-foreground">
595565
Website:

0 commit comments

Comments
 (0)