From 81c3516f55988feeb6e37e867afc7beb9dbff9c4 Mon Sep 17 00:00:00 2001 From: Sage Ross Date: Thu, 9 Nov 2023 11:27:22 -0800 Subject: [PATCH] Clean up empty training table markup --- .../components/timeline/TrainingModules/TrainingModules.jsx | 2 ++ .../timeline/TrainingModules/TrainingModulesViewMode.jsx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx index b534e3214c..9bf1559368 100644 --- a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx +++ b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModules.jsx @@ -92,6 +92,8 @@ const TrainingModules = createReactClass({ /> )); + if (!modules.length) { return null; } + const header = this.props.header || 'Training'; const headerId = header.toLowerCase().split(/[^a-z]/).join('-'); return ( diff --git a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx index d314651a35..ffd7dcbca3 100644 --- a/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx +++ b/app/assets/javascripts/components/timeline/TrainingModules/TrainingModulesViewMode.jsx @@ -21,6 +21,9 @@ const TrainingModulesViewMode = createReactClass({ const block = this.props.block; const modules = []; const length = block.training_modules.length; + + if (!length) { return null; } + const partitioned = block.training_modules.reduce((acc, mod) => { let key = 'modules'; if (mod.kind === EXERCISE_KIND) key = 'exercises';