Refactor footer context generation and enhance chart image styling for improved layout

This commit is contained in:
bolade
2025-09-26 22:32:39 +01:00
parent 894fbbcee3
commit 604ef375aa
4 changed files with 37 additions and 26 deletions
+16 -7
View File
@@ -15,16 +15,21 @@ header_context = {
"focus": "Endurance", "focus": "Endurance",
} }
footer_context = [{ footer_context = [
"contact_email": "info@ishplabs.com ", {
"website": "www.ishplabs.com", "contact_email": "info@ishplabs.com ",
"social": "@ishplabs", "website": "www.ishplabs.com",
"page_number": i + 1, "social": "@ishplabs",
} for i in range(len(context_list))] "page_number": i + 1,
}
for i in range(len(context_list))
]
header_html = env.get_template("header.html").render(header_context) header_html = env.get_template("header.html").render(header_context)
footer_html_list = [env.get_template("footer.html").render(context) for context in footer_context] footer_html_list = [
env.get_template("footer.html").render(context) for context in footer_context
]
for i, context in enumerate(context_list): for i, context in enumerate(context_list):
template = env.get_template(f"page_{i + 1}.html").render(context) template = env.get_template(f"page_{i + 1}.html").render(context)
@@ -84,6 +89,10 @@ html_doc = f"""
max-height: 200px; max-height: 200px;
object-fit: contain; object-fit: contain;
}} }}
/* Larger images for specific charts */
.chart-large {{
max-height: 500px !important;
}}
</style> </style>
</head> </head>
<body class="m-0 p-0"> <body class="m-0 p-0">
Binary file not shown.
+4 -2
View File
@@ -25,11 +25,13 @@
</div> </div>
<div class="w-full max-w-5xl"> <div class="w-full max-w-5xl">
<h1 class="text-2xl font-bold mb-4 text-center">Body Fat Percent Master Chart</h1> <h1 class="text-2xl font-bold mb-4 text-center">
Body Fat Percent Master Chart
</h1>
<img <img
src="data:image/png;base64,{{ body_fat_percentage_chart }}" src="data:image/png;base64,{{ body_fat_percentage_chart }}"
alt="Body Fat Percentage" alt="Body Fat Percentage"
class="w-full h-auto object-contain" class="w-full h-auto object-contain chart-large"
/> />
</div> </div>
</div> </div>
+17 -17
View File
@@ -1,21 +1,21 @@
<div class="w-full page bg-white"> <div class="w-full page bg-white">
<!-- Main Content -->
<div class="flex flex-col items-center justify-center h-full">
<!-- Fuel Utilization Chart -->
<div class="w-full max-w-5xl">
<img
src="data:image/png;base64,{{ fuel_utilization_chart }}"
alt="Fuel Utilization Report - Institute of Science, Health and Performance"
class="w-full h-auto object-contain chart-large"
/>
</div>
<!-- Main Content --> <!-- Chart Information -->
<div class="flex flex-col items-center justify-center h-full"> <div class="mt-8 text-center">
<!-- Fuel Utilization Chart --> <p class="text-gray-700 text-sm">
<div class="w-full max-w-5xl"> Client: {{ client_name | default('Keirstyn Moran') }} |
<img src="data:image/png;base64,{{ fuel_utilization_chart }}" Assessment Date: {{ assessment_date | default('July 29 2025') }}
alt="Fuel Utilization Report - Institute of Science, Health and Performance" </p>
class="w-full h-auto object-contain"> </div>
</div> </div>
<!-- Chart Information -->
<div class="mt-8 text-center">
<p class="text-gray-700 text-sm">
Client: {{ client_name | default('Keirstyn Moran') }} |
Assessment Date: {{ assessment_date | default('July 29 2025') }}
</p>
</div>
</div>
</div> </div>