fix: sparkline canvas wrapper display mode for flex layout
Change sparkline wrapper from inline-block to block w-full to properly
fill flex parent container. Inline-block was preventing the canvas from
calculating the correct width when width={0} (auto-size mode).
This commit is contained in:
parent
886368ec44
commit
4c6f565855
2 changed files with 12 additions and 3 deletions
|
|
@ -255,10 +255,10 @@ export const Sparkline: Component<SparklineProps> = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="relative inline-block">
|
<div class="relative block w-full">
|
||||||
<canvas
|
<canvas
|
||||||
ref={canvasRef}
|
ref={canvasRef}
|
||||||
class="inline-block cursor-crosshair"
|
class="block cursor-crosshair"
|
||||||
style={{
|
style={{
|
||||||
width: `${width()}px`,
|
width: `${width()}px`,
|
||||||
height: `${height()}px`,
|
height: `${height()}px`,
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,19 @@ function saveToLocalStorage(): void {
|
||||||
function loadFromLocalStorage(): void {
|
function loadFromLocalStorage(): void {
|
||||||
try {
|
try {
|
||||||
const stored = localStorage.getItem(STORAGE_KEY);
|
const stored = localStorage.getItem(STORAGE_KEY);
|
||||||
if (!stored) return;
|
if (!stored) {
|
||||||
|
logger.debug('[MetricsHistory] No stored data found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const payload = JSON.parse(stored);
|
const payload = JSON.parse(stored);
|
||||||
|
|
||||||
|
if (!payload || typeof payload !== 'object') {
|
||||||
|
logger.warn('[MetricsHistory] Invalid payload format, clearing');
|
||||||
|
localStorage.removeItem(STORAGE_KEY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check version and age
|
// Check version and age
|
||||||
if (payload.version !== STORAGE_VERSION) {
|
if (payload.version !== STORAGE_VERSION) {
|
||||||
logger.warn('[MetricsHistory] Storage version mismatch, clearing');
|
logger.warn('[MetricsHistory] Storage version mismatch, clearing');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue