Spaces:
Running
Running
Update index.html
Browse files- index.html +12 -7
index.html
CHANGED
|
@@ -89,8 +89,11 @@
|
|
| 89 |
<button onclick="login()">Login</button>
|
| 90 |
<p id="login-error" style="color: red;"></p>
|
| 91 |
</div>
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
| 94 |
<h2>Reset Prompts</h2>
|
| 95 |
</header>
|
| 96 |
|
|
@@ -136,15 +139,17 @@
|
|
| 136 |
document.getElementById("login-error").innerText = error.message;
|
| 137 |
});
|
| 138 |
}
|
| 139 |
-
|
| 140 |
-
|
|
|
|
| 141 |
if (user) {
|
| 142 |
const promptCount = await countPromptsUsage(user.uid);
|
| 143 |
-
|
| 144 |
} else {
|
| 145 |
-
|
| 146 |
}
|
| 147 |
-
}
|
|
|
|
| 148 |
// Function to count the usage of prompts for a specific user
|
| 149 |
async function countPromptsUsage(userId) {
|
| 150 |
try {
|
|
|
|
| 89 |
<button onclick="login()">Login</button>
|
| 90 |
<p id="login-error" style="color: red;"></p>
|
| 91 |
</div>
|
| 92 |
+
main>
|
| 93 |
+
<h1>Prompt Usage Counter</h1>
|
| 94 |
+
<p id="promptCountDisplay">Prompt used Count: </p>
|
| 95 |
+
<button id="checkPromptCountButton" onclick="showPromptCount()">Check Prompt Count</button>
|
| 96 |
+
|
| 97 |
<h2>Reset Prompts</h2>
|
| 98 |
</header>
|
| 99 |
|
|
|
|
| 139 |
document.getElementById("login-error").innerText = error.message;
|
| 140 |
});
|
| 141 |
}
|
| 142 |
+
// Function to display prompt count on button press
|
| 143 |
+
async function showPromptCount() {
|
| 144 |
+
const user = auth.currentUser;
|
| 145 |
if (user) {
|
| 146 |
const promptCount = await countPromptsUsage(user.uid);
|
| 147 |
+
alert(`You have used ${promptCount} prompts.`);
|
| 148 |
} else {
|
| 149 |
+
alert("Please log in to check your prompt count.");
|
| 150 |
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
// Function to count the usage of prompts for a specific user
|
| 154 |
async function countPromptsUsage(userId) {
|
| 155 |
try {
|