mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23: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) {
|
}: BlockRendererProps) {
|
||||||
const [openIndex, setOpenIndex] = useState<number | null>(0);
|
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 (
|
return (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
{blocks.map((block, index) => {
|
{visibleBlocks.map((block, index) => {
|
||||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||||
const isOpen = openIndex === index;
|
const isOpen = openIndex === index;
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,15 @@ export function CardsBlock({
|
|||||||
getSvgHtml,
|
getSvgHtml,
|
||||||
renderBlockButtons,
|
renderBlockButtons,
|
||||||
}: BlockRendererProps) {
|
}: BlockRendererProps) {
|
||||||
|
const visibleBlocks = blocks.filter(
|
||||||
|
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!visibleBlocks.length) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{blocks.map((block, index) => {
|
{visibleBlocks.map((block, index) => {
|
||||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -10,11 +10,17 @@ export function MinimalBlock({
|
|||||||
getSvgHtml,
|
getSvgHtml,
|
||||||
renderBlockButtons,
|
renderBlockButtons,
|
||||||
}: BlockRendererProps) {
|
}: BlockRendererProps) {
|
||||||
|
const visibleBlocks = blocks.filter(
|
||||||
|
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!visibleBlocks.length) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{blocks.map((block, index) => {
|
{visibleBlocks.map((block, index) => {
|
||||||
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight);
|
||||||
const isLast = index === blocks.length - 1;
|
const isLast = index === visibleBlocks.length - 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -10,11 +10,17 @@ export function TimelineBlock({
|
|||||||
getSvgHtml,
|
getSvgHtml,
|
||||||
renderBlockButtons,
|
renderBlockButtons,
|
||||||
}: BlockRendererProps) {
|
}: BlockRendererProps) {
|
||||||
|
const visibleBlocks = blocks.filter(
|
||||||
|
(b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!visibleBlocks.length) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-0">
|
<div className="space-y-0">
|
||||||
{blocks.map((block, index) => {
|
{visibleBlocks.map((block, index) => {
|
||||||
const gradientStyle = getColorGradientSolid(block.svgIconColor || 'cyan', isLight);
|
const gradientStyle = getColorGradientSolid(block.svgIconColor || 'cyan', isLight);
|
||||||
const isLast = index === blocks.length - 1;
|
const isLast = index === visibleBlocks.length - 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={index} className="flex gap-3 sm:gap-4">
|
<div key={index} className="flex gap-3 sm:gap-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user