mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: hide empty blocks in connection installation guide
Filter out blocks with no title, description, or buttons instead of rendering empty cards/accordions/timeline items.
This commit is contained in:
@@ -13,9 +13,15 @@ export function AccordionBlock({
|
||||
}: BlockRendererProps) {
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(0);
|
||||
|
||||
const visibleBlocks = blocks.filter(
|
||||
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||
);
|
||||
|
||||
if (!visibleBlocks.length) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{blocks.map((block, index) => {
|
||||
{visibleBlocks.map((block, index) => {
|
||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||
const isOpen = openIndex === index;
|
||||
|
||||
|
||||
@@ -10,9 +10,15 @@ export function CardsBlock({
|
||||
getSvgHtml,
|
||||
renderBlockButtons,
|
||||
}: BlockRendererProps) {
|
||||
const visibleBlocks = blocks.filter(
|
||||
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||
);
|
||||
|
||||
if (!visibleBlocks.length) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{blocks.map((block, index) => {
|
||||
{visibleBlocks.map((block, index) => {
|
||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||
|
||||
return (
|
||||
|
||||
@@ -10,11 +10,17 @@ export function MinimalBlock({
|
||||
getSvgHtml,
|
||||
renderBlockButtons,
|
||||
}: BlockRendererProps) {
|
||||
const visibleBlocks = blocks.filter(
|
||||
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||
);
|
||||
|
||||
if (!visibleBlocks.length) return null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
{blocks.map((block, index) => {
|
||||
{visibleBlocks.map((block, index) => {
|
||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||
const isLast = index === blocks.length - 1;
|
||||
const isLast = index === visibleBlocks.length - 1;
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -10,11 +10,17 @@ export function TimelineBlock({
|
||||
getSvgHtml,
|
||||
renderBlockButtons,
|
||||
}: BlockRendererProps) {
|
||||
const visibleBlocks = blocks.filter(
|
||||
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||
);
|
||||
|
||||
if (!visibleBlocks.length) return null;
|
||||
|
||||
return (
|
||||
<div className="space-y-0">
|
||||
{blocks.map((block, index) => {
|
||||
{visibleBlocks.map((block, index) => {
|
||||
const gradientStyle = getColorGradientSolid(block.svgIconColor || 'cyan', isLight);
|
||||
const isLast = index === blocks.length - 1;
|
||||
const isLast = index === visibleBlocks.length - 1;
|
||||
|
||||
return (
|
||||
<div key={index} className="flex gap-3 sm:gap-4">
|
||||
|
||||
Reference in New Issue
Block a user