Spaces:
Running
Running
Fix Granim background coverage on login page + cache bust
Browse files- Use 100vw/100vh to ensure full viewport coverage
- Add fallback background to canvas to prevent color blocks
- Improve Granim gradients with 4-stop colors for smoother transitions
- Higher resolution background image (w=2000)
- Updated service worker cache version to 1734825999
- Added onGradientChange callback to ensure canvas sizing
- static/login.html +29 -17
- static/sw.js +1 -1
static/login.html
CHANGED
@@ -25,9 +25,11 @@
|
|
25 |
position: fixed;
|
26 |
top: 0;
|
27 |
left: 0;
|
28 |
-
width:
|
29 |
-
height:
|
30 |
z-index: -1;
|
|
|
|
|
31 |
}
|
32 |
|
33 |
/* Forest SVG Pattern for Image Blending */
|
@@ -364,25 +366,33 @@
|
|
364 |
console.log('Initializing Granim...');
|
365 |
|
366 |
try {
|
367 |
-
// Initialize Granim with
|
368 |
var granimInstance = new Granim({
|
369 |
element: '#granim-canvas',
|
370 |
direction: 'diagonal',
|
371 |
isPausedWhenNotInView: true,
|
372 |
image: {
|
373 |
-
source: 'https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?q=80&w=
|
374 |
-
|
|
|
|
|
375 |
},
|
376 |
states: {
|
377 |
"default-state": {
|
378 |
gradients: [
|
379 |
-
['#
|
380 |
-
['#
|
381 |
-
['#
|
382 |
-
['#
|
383 |
],
|
384 |
-
transitionSpeed:
|
385 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
}
|
387 |
});
|
388 |
|
@@ -398,18 +408,20 @@
|
|
398 |
if (canvas) {
|
399 |
canvas.style.background = `
|
400 |
linear-gradient(45deg,
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
),
|
407 |
-
url('https://images.unsplash.com/photo-
|
408 |
`;
|
409 |
canvas.style.backgroundSize = 'cover';
|
410 |
canvas.style.backgroundPosition = 'center';
|
411 |
canvas.style.backgroundBlendMode = 'multiply';
|
412 |
-
|
|
|
|
|
413 |
}
|
414 |
}
|
415 |
|
|
|
25 |
position: fixed;
|
26 |
top: 0;
|
27 |
left: 0;
|
28 |
+
width: 100vw;
|
29 |
+
height: 100vh;
|
30 |
z-index: -1;
|
31 |
+
object-fit: cover;
|
32 |
+
background: linear-gradient(135deg, #1a2f1a, #2d5a2d, #4a7c4a);
|
33 |
}
|
34 |
|
35 |
/* Forest SVG Pattern for Image Blending */
|
|
|
366 |
console.log('Initializing Granim...');
|
367 |
|
368 |
try {
|
369 |
+
// Initialize Granim with full coverage and seamless gradients
|
370 |
var granimInstance = new Granim({
|
371 |
element: '#granim-canvas',
|
372 |
direction: 'diagonal',
|
373 |
isPausedWhenNotInView: true,
|
374 |
image: {
|
375 |
+
source: 'https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?q=80&w=2000&auto=format&fit=crop&ixlib=rb-4.0.3',
|
376 |
+
position: ['center', 'center'],
|
377 |
+
stretchMode: ['stretch', 'stretch'],
|
378 |
+
blendingMode: 'multiply'
|
379 |
},
|
380 |
states: {
|
381 |
"default-state": {
|
382 |
gradients: [
|
383 |
+
['#1a2f1a', '#2d5a2d', '#4a7c4a', '#2d5a2d'],
|
384 |
+
['#0d3d0d', '#1a5c1a', '#2e7c2e', '#1a5c1a'],
|
385 |
+
['#2c4c2c', '#3e6e3e', '#5a8a5a', '#3e6e3e'],
|
386 |
+
['#1e3e1e', '#2f5f2f', '#4a7a4a', '#2f5f2f']
|
387 |
],
|
388 |
+
transitionSpeed: 8000
|
389 |
}
|
390 |
+
},
|
391 |
+
onGradientChange: function(colorDetails) {
|
392 |
+
// Ensure canvas stays full width
|
393 |
+
const canvas = document.getElementById('granim-canvas');
|
394 |
+
canvas.style.width = '100vw';
|
395 |
+
canvas.style.height = '100vh';
|
396 |
}
|
397 |
});
|
398 |
|
|
|
408 |
if (canvas) {
|
409 |
canvas.style.background = `
|
410 |
linear-gradient(45deg,
|
411 |
+
#1a2f1a 0%,
|
412 |
+
#2d5a2d 25%,
|
413 |
+
#4a7c4a 50%,
|
414 |
+
#2d5a2d 75%,
|
415 |
+
#1a2f1a 100%
|
416 |
),
|
417 |
+
url('https://images.unsplash.com/photo-1542273917363-3b1817f69a2d?q=80&w=2000&auto=format&fit=crop&ixlib=rb-4.0.3')
|
418 |
`;
|
419 |
canvas.style.backgroundSize = 'cover';
|
420 |
canvas.style.backgroundPosition = 'center';
|
421 |
canvas.style.backgroundBlendMode = 'multiply';
|
422 |
+
canvas.style.width = '100vw';
|
423 |
+
canvas.style.height = '100vh';
|
424 |
+
console.log('Applied fallback CSS background with full coverage');
|
425 |
}
|
426 |
}
|
427 |
|
static/sw.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// TreeTrack Service Worker - PWA and Offline Support
|
2 |
-
const VERSION =
|
3 |
const CACHE_NAME = `treetrack-v${VERSION}`;
|
4 |
const STATIC_CACHE = `static-v${VERSION}`;
|
5 |
const API_CACHE = `api-v${VERSION}`;
|
|
|
1 |
// TreeTrack Service Worker - PWA and Offline Support
|
2 |
+
const VERSION = 1734825999; // Cache busting - updated for login background coverage fix
|
3 |
const CACHE_NAME = `treetrack-v${VERSION}`;
|
4 |
const STATIC_CACHE = `static-v${VERSION}`;
|
5 |
const API_CACHE = `api-v${VERSION}`;
|