j1225d commited on
Commit
678a8a7
·
verified ·
1 Parent(s): 4a155cf

Can we make the "share" button save the photo to an phones images? - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +56 -7
index.html CHANGED
@@ -7,6 +7,27 @@
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  @keyframes fadeIn {
11
  from { opacity: 0; transform: translateY(20px); }
12
  to { opacity: 1; transform: translateY(0); }
@@ -40,6 +61,17 @@
40
  .gold-bg {
41
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(249, 212, 35, 0.1));
42
  }
 
 
 
 
 
 
 
 
 
 
 
43
  </style>
44
  </head>
45
  <body class="bg-gray-900 min-h-screen flex items-center justify-center p-4">
@@ -56,8 +88,8 @@
56
  <canvas id="shareCanvas" class="hidden"></canvas>
57
 
58
  <!-- Trends Modal -->
59
- <div id="trendsModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center p-4 hidden">
60
- <div class="bg-gray-800 rounded-xl max-w-4xl w-full overflow-hidden shadow-2xl modal-enter">
61
  <!-- Modal Header -->
62
  <div class="gold-bg p-6 border-b gold-border">
63
  <div class="flex justify-between items-center">
@@ -108,8 +140,8 @@
108
  </div>
109
 
110
  <!-- Workout Analytics Modal -->
111
- <div id="workoutModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center p-4 hidden">
112
- <div class="bg-gray-800 rounded-xl max-w-2xl w-full overflow-hidden shadow-2xl modal-enter">
113
  <!-- Modal Header -->
114
  <div class="gold-bg p-6 border-b gold-border">
115
  <div class="flex justify-between items-center">
@@ -118,7 +150,7 @@
118
  <i class="fas fa-times text-xl"></i>
119
  </button>
120
  </div>
121
- <p class="mt-2 text-amber-200">You're stronger than yesterday! <span class="text-white">Keep shining!</span></p>
122
  </div>
123
 
124
  <!-- Modal Body -->
@@ -483,16 +515,33 @@
483
  ctx.ellipse(canvas.width - 100, canvas.height - 150, 120, 50, -Math.PI/4, 0, Math.PI * 2);
484
  ctx.fill();
485
 
486
- // Convert canvas to image and download
 
 
 
487
  canvas.toBlob((blob) => {
488
  const url = URL.createObjectURL(blob);
489
  const link = document.createElement('a');
490
- link.download = 'my-kintsugi-workout.png';
491
  link.href = url;
492
  document.body.appendChild(link);
493
  link.click();
494
  document.body.removeChild(link);
495
  URL.revokeObjectURL(url);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  }, 'image/png', 1);
497
  });
498
 
 
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
  <style>
10
+ @media (max-width: 640px) {
11
+ .modal-enter {
12
+ width: 95%;
13
+ margin: 0 auto;
14
+ }
15
+
16
+ .grid.grid-cols-2.md\\:grid-cols-4 {
17
+ grid-template-columns: repeat(2, 1fr);
18
+ gap: 0.5rem;
19
+ }
20
+
21
+ .flex.flex-col.sm\\:flex-row {
22
+ flex-direction: column;
23
+ gap: 0.5rem;
24
+ }
25
+
26
+ button {
27
+ padding: 0.75rem 1rem;
28
+ }
29
+ }
30
+
31
  @keyframes fadeIn {
32
  from { opacity: 0; transform: translateY(20px); }
33
  to { opacity: 1; transform: translateY(0); }
 
61
  .gold-bg {
62
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(249, 212, 35, 0.1));
63
  }
64
+
65
+ @keyframes fadeInOut {
66
+ 0% { opacity: 0; transform: translateY(20px) translateX(-50%); }
67
+ 10% { opacity: 1; transform: translateY(0) translateX(-50%); }
68
+ 90% { opacity: 1; transform: translateY(0) translateX(-50%); }
69
+ 100% { opacity: 0; transform: translateY(-20px) translateX(-50%); }
70
+ }
71
+
72
+ .fixed.bottom-4 {
73
+ animation: fadeInOut 3s ease forwards;
74
+ }
75
  </style>
76
  </head>
77
  <body class="bg-gray-900 min-h-screen flex items-center justify-center p-4">
 
88
  <canvas id="shareCanvas" class="hidden"></canvas>
89
 
90
  <!-- Trends Modal -->
91
+ <div id="trendsModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center p-4 hidden z-50 overflow-y-auto">
92
+ <div class="bg-gray-800 rounded-xl max-w-4xl w-full max-h-[90vh] mx-4 overflow-y-auto shadow-2xl modal-enter">
93
  <!-- Modal Header -->
94
  <div class="gold-bg p-6 border-b gold-border">
95
  <div class="flex justify-between items-center">
 
140
  </div>
141
 
142
  <!-- Workout Analytics Modal -->
143
+ <div id="workoutModal" class="fixed inset-0 bg-black bg-opacity-70 flex items-center justify-center p-4 hidden overflow-y-auto">
144
+ <div class="bg-gray-800 rounded-xl max-w-2xl w-full max-h-[90vh] mx-4 overflow-y-auto shadow-2xl modal-enter">
145
  <!-- Modal Header -->
146
  <div class="gold-bg p-6 border-b gold-border">
147
  <div class="flex justify-between items-center">
 
150
  <i class="fas fa-times text-xl"></i>
151
  </button>
152
  </div>
153
+ <p class="mt-2 text-amber-200">You're stronger than yesterday! <span class="text-white">Keep going!</span></p>
154
  </div>
155
 
156
  <!-- Modal Body -->
 
515
  ctx.ellipse(canvas.width - 100, canvas.height - 150, 120, 50, -Math.PI/4, 0, Math.PI * 2);
516
  ctx.fill();
517
 
518
+ // Convert canvas to image and download with timestamp
519
+ const now = new Date();
520
+ const timestamp = `${now.getFullYear()}${(now.getMonth()+1).toString().padStart(2,'0')}${now.getDate().toString().padStart(2,'0')}_${now.getHours().toString().padStart(2,'0')}${now.getMinutes().toString().padStart(2,'0')}`;
521
+
522
  canvas.toBlob((blob) => {
523
  const url = URL.createObjectURL(blob);
524
  const link = document.createElement('a');
525
+ link.download = `kintsugi_workout_${timestamp}.png`;
526
  link.href = url;
527
  document.body.appendChild(link);
528
  link.click();
529
  document.body.removeChild(link);
530
  URL.revokeObjectURL(url);
531
+
532
+ // Show success notification
533
+ const notification = document.createElement('div');
534
+ notification.className = 'fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-green-600 text-white px-4 py-2 rounded-lg shadow-lg flex items-center';
535
+ notification.innerHTML = `
536
+ <i class="fas fa-check-circle mr-2"></i>
537
+ <span>Saved to Photos as kintsugi_workout_${timestamp}.png</span>
538
+ `;
539
+ document.body.appendChild(notification);
540
+
541
+ // Remove notification after 3 seconds
542
+ setTimeout(() => {
543
+ notification.remove();
544
+ }, 3000);
545
  }, 'image/png', 1);
546
  });
547