GopalKrushnaMahapatra commited on
Commit
9936689
·
verified ·
1 Parent(s): c4672cd

Update history.html

Browse files
Files changed (1) hide show
  1. history.html +122 -122
history.html CHANGED
@@ -1,122 +1,122 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>My History – TrueWrite Scan</title>
6
- <script src="https://cdn.tailwindcss.com"></script>
7
- </head>
8
- <body class="bg-slate-950 text-white min-h-screen flex flex-col">
9
- <header class="border-b border-slate-800 bg-slate-950/90 backdrop-blur sticky top-0 z-20">
10
- <div class="max-w-6xl mx-auto px-4 py-3 flex items-center justify-between">
11
- <div class="flex items-center gap-3">
12
- <img src="images/logo.png" alt="TrueWrite Scan logo"
13
- class="w-9 h-9 rounded-2xl border border-slate-700 object-cover" />
14
- <div>
15
- <p class="text-lg md:text-xl font-extrabold tracking-tight">
16
- <span class="bg-gradient-to-r from-indigo-400 via-fuchsia-400 to-emerald-400 bg-clip-text text-transparent">
17
- TrueWrite
18
- </span> History
19
- </p>
20
- <p class="text-[11px] text-slate-400 uppercase tracking-[0.22em]">
21
- Recent grammar, plagiarism & AI scans
22
- </p>
23
- </div>
24
- </div>
25
- <a href="dashboard.html"
26
- class="text-xs px-3 py-1 rounded-full border border-slate-600 hover:bg-slate-800">
27
- ← Back to dashboard
28
- </a>
29
- </div>
30
- </header>
31
-
32
- <main class="flex-1 max-w-6xl mx-auto px-4 py-8">
33
- <h1 class="text-xl md:text-2xl font-semibold mb-3">My scan history</h1>
34
- <p class="text-sm text-slate-300 mb-4">
35
- Each entry represents one run of Grammar, Plagiarism, or AI content check. Stored per account
36
- on the backend using SQLite.
37
- </p>
38
-
39
- <div id="historyContainer"
40
- class="bg-slate-900/70 border border-slate-800 rounded-2xl p-4 text-sm">
41
- <p id="loading" class="text-xs text-slate-400">Loading history...</p>
42
- <table id="historyTable" class="w-full text-xs hidden">
43
- <thead class="border-b border-slate-800 text-slate-400">
44
- <tr>
45
- <th class="py-2 text-left">Time (UTC)</th>
46
- <th class="py-2 text-left">Tool</th>
47
- <th class="py-2 text-left">Summary</th>
48
- <th class="py-2 text-left">Snippet</th>
49
- </tr>
50
- </thead>
51
- <tbody id="historyBody" class="divide-y divide-slate-800"></tbody>
52
- </table>
53
- <p id="emptyMsg" class="text-xs text-slate-400 hidden">No history yet. Run a check to see it here.</p>
54
- </div>
55
- </main>
56
-
57
- <footer class="border-t border-slate-800">
58
- <div class="max-w-6xl mx-auto px-4 py-4 text-[11px] text-slate-400 flex flex-col md:flex-row items-center justify-between gap-2">
59
- <p>© 2025 TrueWrite Scan. All rights reserved.</p>
60
- <p>Designed & developed by <span class="text-indigo-300 font-medium">Gopal Krushna Mahapatra</span>.</p>
61
- </div>
62
- </footer>
63
-
64
- <script>
65
- const BACKEND_URL = "http://localhost:8000";
66
- const token = localStorage.getItem("truewriteToken");
67
- const user = localStorage.getItem("truewriteUser");
68
- if (!token || !user) {
69
- window.location.href = "login.html";
70
- }
71
-
72
- const loading = document.getElementById("loading");
73
- const table = document.getElementById("historyTable");
74
- const bodyEl = document.getElementById("historyBody");
75
- const emptyMsg = document.getElementById("emptyMsg");
76
-
77
- async function loadHistory() {
78
- try {
79
- const res = await fetch(`${BACKEND_URL}/api/history`, {
80
- headers: { "Authorization": `Bearer ${token}` }
81
- });
82
- const data = await res.json();
83
- if (!res.ok) {
84
- loading.textContent = data.detail || "Failed to load history.";
85
- return;
86
- }
87
-
88
- const items = data.items || [];
89
- if (items.length === 0) {
90
- loading.classList.add("hidden");
91
- emptyMsg.classList.remove("hidden");
92
- return;
93
- }
94
-
95
- bodyEl.innerHTML = items.map(item => {
96
- const toolLabel =
97
- item.tool === "grammar" ? "Grammar" :
98
- item.tool === "plagiarism" ? "Plagiarism" :
99
- item.tool === "ai" ? "AI Content" :
100
- item.tool;
101
- const snippet = (item.input_text || "").slice(0, 60).replace(/\s+/g, " ");
102
- return `
103
- <tr>
104
- <td class="py-2 pr-2 align-top text-slate-300">${item.created_at}</td>
105
- <td class="py-2 pr-2 align-top text-slate-200">${toolLabel}</td>
106
- <td class="py-2 pr-2 align-top text-slate-300">${item.summary}</td>
107
- <td class="py-2 pr-2 align-top text-slate-400">${snippet}${snippet.length === 60 ? "..." : ""}</td>
108
- </tr>
109
- `;
110
- }).join("");
111
-
112
- loading.classList.add("hidden");
113
- table.classList.remove("hidden");
114
- } catch (e) {
115
- loading.textContent = "Failed to contact backend.";
116
- }
117
- }
118
-
119
- loadHistory();
120
- </script>
121
- </body>
122
- </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>My History – TrueWrite Scan</title>
6
+ <script src="https://cdn.tailwindcss.com"></script>
7
+ </head>
8
+ <body class="bg-slate-950 text-white min-h-screen flex flex-col">
9
+ <header class="border-b border-slate-800 bg-slate-950/90 backdrop-blur sticky top-0 z-20">
10
+ <div class="max-w-6xl mx-auto px-4 py-3 flex items-center justify-between">
11
+ <div class="flex items-center gap-3">
12
+ <img src="images/logo.png" alt="TrueWrite Scan logo"
13
+ class="w-9 h-9 rounded-2xl border border-slate-700 object-cover" />
14
+ <div>
15
+ <p class="text-lg md:text-xl font-extrabold tracking-tight">
16
+ <span class="bg-gradient-to-r from-indigo-400 via-fuchsia-400 to-emerald-400 bg-clip-text text-transparent">
17
+ TrueWrite
18
+ </span> History
19
+ </p>
20
+ <p class="text-[11px] text-slate-400 uppercase tracking-[0.22em]">
21
+ Recent grammar, plagiarism & AI scans
22
+ </p>
23
+ </div>
24
+ </div>
25
+ <a href="dashboard.html"
26
+ class="text-xs px-3 py-1 rounded-full border border-slate-600 hover:bg-slate-800">
27
+ ← Back to dashboard
28
+ </a>
29
+ </div>
30
+ </header>
31
+
32
+ <main class="flex-1 max-w-6xl mx-auto px-4 py-8">
33
+ <h1 class="text-xl md:text-2xl font-semibold mb-3">My scan history</h1>
34
+ <p class="text-sm text-slate-300 mb-4">
35
+ Each entry represents one run of Grammar, Plagiarism, or AI content check. Stored per account
36
+ on the backend using SQLite.
37
+ </p>
38
+
39
+ <div id="historyContainer"
40
+ class="bg-slate-900/70 border border-slate-800 rounded-2xl p-4 text-sm">
41
+ <p id="loading" class="text-xs text-slate-400">Loading history...</p>
42
+ <table id="historyTable" class="w-full text-xs hidden">
43
+ <thead class="border-b border-slate-800 text-slate-400">
44
+ <tr>
45
+ <th class="py-2 text-left">Time (UTC)</th>
46
+ <th class="py-2 text-left">Tool</th>
47
+ <th class="py-2 text-left">Summary</th>
48
+ <th class="py-2 text-left">Snippet</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody id="historyBody" class="divide-y divide-slate-800"></tbody>
52
+ </table>
53
+ <p id="emptyMsg" class="text-xs text-slate-400 hidden">No history yet. Run a check to see it here.</p>
54
+ </div>
55
+ </main>
56
+
57
+ <footer class="border-t border-slate-800">
58
+ <div class="max-w-6xl mx-auto px-4 py-4 text-[11px] text-slate-400 flex flex-col md:flex-row items-center justify-between gap-2">
59
+ <p>© 2025 TrueWrite Scan. All rights reserved.</p>
60
+ <p>Designed & developed by <span class="text-indigo-300 font-medium">Gopal Krushna Mahapatra</span>.</p>
61
+ </div>
62
+ </footer>
63
+
64
+ <script>
65
+ const BACKEND_URL = "https://gopalkrushnamahapatra-truewrite-scan.hf.space";
66
+ const token = localStorage.getItem("truewriteToken");
67
+ const user = localStorage.getItem("truewriteUser");
68
+ if (!token || !user) {
69
+ window.location.href = "login.html";
70
+ }
71
+
72
+ const loading = document.getElementById("loading");
73
+ const table = document.getElementById("historyTable");
74
+ const bodyEl = document.getElementById("historyBody");
75
+ const emptyMsg = document.getElementById("emptyMsg");
76
+
77
+ async function loadHistory() {
78
+ try {
79
+ const res = await fetch(`${BACKEND_URL}/api/history`, {
80
+ headers: { "Authorization": `Bearer ${token}` }
81
+ });
82
+ const data = await res.json();
83
+ if (!res.ok) {
84
+ loading.textContent = data.detail || "Failed to load history.";
85
+ return;
86
+ }
87
+
88
+ const items = data.items || [];
89
+ if (items.length === 0) {
90
+ loading.classList.add("hidden");
91
+ emptyMsg.classList.remove("hidden");
92
+ return;
93
+ }
94
+
95
+ bodyEl.innerHTML = items.map(item => {
96
+ const toolLabel =
97
+ item.tool === "grammar" ? "Grammar" :
98
+ item.tool === "plagiarism" ? "Plagiarism" :
99
+ item.tool === "ai" ? "AI Content" :
100
+ item.tool;
101
+ const snippet = (item.input_text || "").slice(0, 60).replace(/\s+/g, " ");
102
+ return `
103
+ <tr>
104
+ <td class="py-2 pr-2 align-top text-slate-300">${item.created_at}</td>
105
+ <td class="py-2 pr-2 align-top text-slate-200">${toolLabel}</td>
106
+ <td class="py-2 pr-2 align-top text-slate-300">${item.summary}</td>
107
+ <td class="py-2 pr-2 align-top text-slate-400">${snippet}${snippet.length === 60 ? "..." : ""}</td>
108
+ </tr>
109
+ `;
110
+ }).join("");
111
+
112
+ loading.classList.add("hidden");
113
+ table.classList.remove("hidden");
114
+ } catch (e) {
115
+ loading.textContent = "Failed to contact backend.";
116
+ }
117
+ }
118
+
119
+ loadHistory();
120
+ </script>
121
+ </body>
122
+ </html>