Spaces:
Sleeping
Sleeping
Upload 12 files
Browse files- .gitattributes +2 -0
- README.md +3 -10
- bg.jpg +0 -0
- bg2.png +3 -0
- dashboard.html +468 -0
- dashboardlogic.js +613 -0
- index.html +92 -0
- logic.js +113 -0
- login.html +39 -0
- logo.png +0 -0
- screenshot.png +3 -0
- sign-up.html +36 -0
- style.css +174 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
bg2.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
screenshot.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,10 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
colorFrom: purple
|
| 5 |
-
colorTo: purple
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
---
|
| 9 |
-
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
+

|
| 2 |
+
# Animated-attractive-Login-Page
|
| 3 |
+
Creating Animated Login Page with awesome background HTML & CSS.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bg.jpg
ADDED
|
bg2.png
ADDED
|
Git LFS Details
|
dashboard.html
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8"/>
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
+
<title>Pockit | Dashboard</title>
|
| 7 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"/>
|
| 8 |
+
<style>
|
| 9 |
+
* { margin:0; padding:0; box-sizing:border-box; font-family:'Inter',sans-serif; }
|
| 10 |
+
body { color:#1a1a2e; line-height:1.6; overflow-x:hidden; min-height:100vh; }
|
| 11 |
+
|
| 12 |
+
.bg-layer {
|
| 13 |
+
position:fixed; top:0; left:0; width:100%; height:100%;
|
| 14 |
+
background-image:url(bg2.png);
|
| 15 |
+
background-size:cover; background-position:center;
|
| 16 |
+
background-attachment:fixed;
|
| 17 |
+
z-index:-1;
|
| 18 |
+
}
|
| 19 |
+
.bg-layer::after {
|
| 20 |
+
content:''; position:absolute; inset:0;
|
| 21 |
+
background:rgba(255,255,255,0.72);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/* ── TOPBAR ── */
|
| 25 |
+
.topbar {
|
| 26 |
+
position:sticky; top:0; z-index:100;
|
| 27 |
+
height:66px; display:flex; align-items:center; justify-content:space-between;
|
| 28 |
+
padding:0 40px;
|
| 29 |
+
background:rgba(255,255,255,0.7); backdrop-filter:blur(18px);
|
| 30 |
+
border-bottom:1px solid rgba(0,0,0,0.08);
|
| 31 |
+
}
|
| 32 |
+
.topbar-brand img { height:38px; width:auto; display:block; }
|
| 33 |
+
.topbar-brand .fb { font-size:1.3em; font-weight:700; letter-spacing:-.5px; }
|
| 34 |
+
|
| 35 |
+
.topbar-center { flex:1; display:flex; justify-content:center; }
|
| 36 |
+
.search-wrap { position:relative; width:min(360px,100%); }
|
| 37 |
+
.search-wrap i { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:rgba(0,0,0,.35); font-size:.84em; }
|
| 38 |
+
.search-wrap input {
|
| 39 |
+
width:100%; background:rgba(255,255,255,0.7); border:1px solid rgba(0,0,0,0.12);
|
| 40 |
+
border-radius:8px; padding:9px 16px 9px 38px;
|
| 41 |
+
font-size:.85em; color:#1a1a2e; outline:none;
|
| 42 |
+
backdrop-filter:blur(10px); transition:border-color .2s, box-shadow .2s;
|
| 43 |
+
}
|
| 44 |
+
.search-wrap input::placeholder { color:rgba(0,0,0,.3); }
|
| 45 |
+
.search-wrap input:focus { border-color:rgba(0,0,0,.28); box-shadow:0 0 0 3px rgba(0,0,0,.05); }
|
| 46 |
+
|
| 47 |
+
.topbar-right { display:flex; align-items:center; gap:12px; }
|
| 48 |
+
.account-chip {
|
| 49 |
+
display:flex; align-items:center; gap:10px;
|
| 50 |
+
background:rgba(255,255,255,0.7); border:1px solid rgba(0,0,0,0.12);
|
| 51 |
+
border-radius:8px; padding:6px 14px 6px 6px;
|
| 52 |
+
cursor:pointer; backdrop-filter:blur(10px); transition:border-color .2s;
|
| 53 |
+
}
|
| 54 |
+
.account-chip:hover { border-color:rgba(0,0,0,.28); }
|
| 55 |
+
.avatar {
|
| 56 |
+
width:32px; height:32px; border-radius:6px;
|
| 57 |
+
background:#1a1a2e; color:#fff;
|
| 58 |
+
display:flex; align-items:center; justify-content:center;
|
| 59 |
+
font-weight:700; font-size:.72em;
|
| 60 |
+
}
|
| 61 |
+
.account-name { font-size:.84em; font-weight:600; }
|
| 62 |
+
|
| 63 |
+
.role-tag {
|
| 64 |
+
font-size:.62em; font-weight:700; text-transform:uppercase; letter-spacing:1px;
|
| 65 |
+
padding:2px 8px; border-radius:4px;
|
| 66 |
+
}
|
| 67 |
+
.role-tag.free { background:rgba(0,0,0,.06); color:#666; border:1px solid rgba(0,0,0,.15); }
|
| 68 |
+
.role-tag.tester { background:rgba(180,120,0,.1); color:#a07800; border:1px solid rgba(180,120,0,.3); }
|
| 69 |
+
.role-tag.pro { background:rgba(0,0,0,.08); color:#1a1a2e; border:1px solid rgba(0,0,0,.25); }
|
| 70 |
+
.role-tag.dev { background:rgba(0,140,80,.1); color:#007a45; border:1px solid rgba(0,140,80,.3); }
|
| 71 |
+
|
| 72 |
+
/* ── LAYOUT ── */
|
| 73 |
+
.body-wrap { display:flex; min-height:calc(100vh - 66px); }
|
| 74 |
+
|
| 75 |
+
/* ── SIDEBAR ── */
|
| 76 |
+
.sidebar {
|
| 77 |
+
width:218px; flex-shrink:0;
|
| 78 |
+
background:rgba(255,255,255,0.55); backdrop-filter:blur(18px);
|
| 79 |
+
border-right:1px solid rgba(0,0,0,0.08);
|
| 80 |
+
padding:22px 0; display:flex; flex-direction:column; gap:2px;
|
| 81 |
+
}
|
| 82 |
+
.nav-section {
|
| 83 |
+
font-size:.6em; font-weight:700; text-transform:uppercase;
|
| 84 |
+
letter-spacing:2px; color:rgba(0,0,0,.3); padding:14px 20px 4px;
|
| 85 |
+
}
|
| 86 |
+
.nav-item {
|
| 87 |
+
display:flex; align-items:center; gap:11px;
|
| 88 |
+
padding:10px 20px; font-size:.86em; font-weight:500;
|
| 89 |
+
color:rgba(0,0,0,.45); cursor:pointer;
|
| 90 |
+
border-left:3px solid transparent; transition:all .18s; user-select:none;
|
| 91 |
+
}
|
| 92 |
+
.nav-item i { width:17px; text-align:center; font-size:.9em; }
|
| 93 |
+
.nav-item:hover { background:rgba(0,0,0,.05); color:#1a1a2e; }
|
| 94 |
+
.nav-item.active { background:rgba(0,0,0,.07); color:#1a1a2e; border-left-color:#1a1a2e; }
|
| 95 |
+
.sidebar-storage {
|
| 96 |
+
margin-top:auto; padding:18px 20px;
|
| 97 |
+
border-top:1px solid rgba(0,0,0,.08);
|
| 98 |
+
}
|
| 99 |
+
.stor-label { display:flex; justify-content:space-between; font-size:.72em; color:rgba(0,0,0,.4); margin-bottom:8px; }
|
| 100 |
+
.sbar { height:4px; background:rgba(0,0,0,.1); border-radius:10px; overflow:hidden; }
|
| 101 |
+
.sbar-fill { height:100%; border-radius:10px; background:#1a1a2e; width:36%; }
|
| 102 |
+
|
| 103 |
+
/* ── MAIN ── */
|
| 104 |
+
.main { flex:1; overflow-y:auto; padding:36px 40px; display:flex; flex-direction:column; gap:28px; }
|
| 105 |
+
|
| 106 |
+
/* ── STATS ── */
|
| 107 |
+
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:24px; }
|
| 108 |
+
.card {
|
| 109 |
+
background:rgba(255,255,255,0.65); padding:30px; border-radius:16px;
|
| 110 |
+
border:1px solid rgba(0,0,0,0.08); backdrop-filter:blur(10px);
|
| 111 |
+
transition:border-color .2s, transform .2s;
|
| 112 |
+
}
|
| 113 |
+
.card:hover { border-color:rgba(0,0,0,.18); transform:translateY(-2px); }
|
| 114 |
+
.card-label { font-size:.68em; font-weight:600; text-transform:uppercase; letter-spacing:1px; color:rgba(0,0,0,.4); margin-bottom:6px; }
|
| 115 |
+
.card-val { font-size:2.2em; font-weight:700; line-height:1; }
|
| 116 |
+
.card-sub { font-size:.74em; color:rgba(0,0,0,.38); margin-top:4px; }
|
| 117 |
+
.card-bar { height:4px; background:rgba(0,0,0,.08); border-radius:10px; overflow:hidden; margin-top:14px; }
|
| 118 |
+
.card-bar-fill { height:100%; border-radius:10px; background:#1a1a2e; }
|
| 119 |
+
|
| 120 |
+
/* ── UPLOAD ZONE ── */
|
| 121 |
+
.drop-zone {
|
| 122 |
+
border:2px dashed rgba(0,0,0,0.15); border-radius:16px; padding:30px;
|
| 123 |
+
text-align:center; cursor:pointer;
|
| 124 |
+
background:rgba(255,255,255,0.5); backdrop-filter:blur(10px); transition:all .2s;
|
| 125 |
+
}
|
| 126 |
+
.drop-zone:hover, .drop-zone.drag { border-color:rgba(0,0,0,.4); background:rgba(255,255,255,.7); }
|
| 127 |
+
.drop-zone input { display:none; }
|
| 128 |
+
.drop-zone i { font-size:2em; color:rgba(0,0,0,.4); margin-bottom:10px; display:block; }
|
| 129 |
+
.dz-text { font-size:.88em; color:rgba(0,0,0,.45); }
|
| 130 |
+
.dz-text strong { color:#1a1a2e; }
|
| 131 |
+
|
| 132 |
+
/* ── TOOLBAR ── */
|
| 133 |
+
.toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
|
| 134 |
+
.toolbar-title { font-size:1.1em; font-weight:700; margin-right:auto; text-shadow:none; }
|
| 135 |
+
|
| 136 |
+
/* match landing page .btn */
|
| 137 |
+
.btn {
|
| 138 |
+
display:inline-flex; align-items:center; gap:7px;
|
| 139 |
+
padding:10px 22px; background:#1a1a2e; color:#fff; border-radius:8px;
|
| 140 |
+
font-family:'Inter',sans-serif; font-size:.83em; font-weight:700;
|
| 141 |
+
cursor:pointer; border:none; text-decoration:none;
|
| 142 |
+
transition:background .2s, transform .15s;
|
| 143 |
+
}
|
| 144 |
+
.btn:hover { background:#2e2e4e; }
|
| 145 |
+
.btn-ghost {
|
| 146 |
+
background:rgba(255,255,255,0.6); color:#1a1a2e;
|
| 147 |
+
border:1px solid rgba(0,0,0,0.15); backdrop-filter:blur(10px);
|
| 148 |
+
}
|
| 149 |
+
.btn-ghost:hover { background:rgba(255,255,255,.85); border-color:rgba(0,0,0,.28); }
|
| 150 |
+
.btn-danger {
|
| 151 |
+
background:rgba(200,30,30,.08); color:#b22222;
|
| 152 |
+
border:1px solid rgba(200,30,30,.22); backdrop-filter:blur(10px);
|
| 153 |
+
}
|
| 154 |
+
.btn-danger:hover { background:rgba(200,30,30,.16); }
|
| 155 |
+
|
| 156 |
+
.view-toggle {
|
| 157 |
+
display:flex; background:rgba(255,255,255,0.6);
|
| 158 |
+
border:1px solid rgba(0,0,0,0.12); border-radius:8px; overflow:hidden;
|
| 159 |
+
backdrop-filter:blur(10px);
|
| 160 |
+
}
|
| 161 |
+
.view-toggle button {
|
| 162 |
+
background:none; border:none; color:rgba(0,0,0,.4);
|
| 163 |
+
padding:8px 13px; cursor:pointer; font-size:.83em; transition:all .18s;
|
| 164 |
+
}
|
| 165 |
+
.view-toggle button.active { background:rgba(0,0,0,.12); color:#1a1a2e; }
|
| 166 |
+
|
| 167 |
+
/* ── FILE GRID ── */
|
| 168 |
+
.file-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:16px; }
|
| 169 |
+
.file-card {
|
| 170 |
+
background:rgba(255,255,255,0.65); border:1px solid rgba(0,0,0,0.08);
|
| 171 |
+
border-radius:16px; padding:20px 14px 16px;
|
| 172 |
+
display:flex; flex-direction:column; align-items:center; gap:10px;
|
| 173 |
+
cursor:pointer; backdrop-filter:blur(10px);
|
| 174 |
+
transition:all .2s; position:relative; user-select:none;
|
| 175 |
+
}
|
| 176 |
+
.file-card:hover { border-color:rgba(0,0,0,.22); transform:translateY(-3px); box-shadow:0 10px 28px rgba(0,0,0,.12); }
|
| 177 |
+
.file-card.selected { border-color:#1a1a2e; background:rgba(26,26,46,.06); }
|
| 178 |
+
.fc-check {
|
| 179 |
+
position:absolute; top:9px; right:9px;
|
| 180 |
+
width:18px; height:18px; border-radius:4px;
|
| 181 |
+
background:rgba(0,0,0,.06); border:1.5px solid rgba(0,0,0,.2);
|
| 182 |
+
display:flex; align-items:center; justify-content:center;
|
| 183 |
+
font-size:.6em; transition:all .18s; color:#fff;
|
| 184 |
+
}
|
| 185 |
+
.file-card.selected .fc-check { background:#1a1a2e; border-color:#1a1a2e; }
|
| 186 |
+
.fc-icon { font-size:2.6em; line-height:1; }
|
| 187 |
+
.fc-name { font-size:.74em; font-weight:600; text-align:center; word-break:break-all; }
|
| 188 |
+
.fc-meta { font-size:.67em; color:rgba(0,0,0,.38); }
|
| 189 |
+
|
| 190 |
+
/* ── FILE TABLE (styled like landing comparison) ── */
|
| 191 |
+
.comparison-wrapper { overflow-x:auto; }
|
| 192 |
+
.comparison {
|
| 193 |
+
width:100%; border-collapse:collapse;
|
| 194 |
+
background:rgba(255,255,255,0.65); border-radius:16px; overflow:hidden;
|
| 195 |
+
backdrop-filter:blur(10px);
|
| 196 |
+
}
|
| 197 |
+
.comparison th, .comparison td {
|
| 198 |
+
padding:18px 22px; border-bottom:1px solid rgba(0,0,0,0.07); text-align:left;
|
| 199 |
+
}
|
| 200 |
+
.comparison th { color:rgba(0,0,0,.4); font-weight:600; font-size:.72em; text-transform:uppercase; letter-spacing:1px; background:rgba(0,0,0,.03); }
|
| 201 |
+
.comparison tbody tr { transition:background .15s; cursor:pointer; }
|
| 202 |
+
.comparison tbody tr:last-child td { border-bottom:none; }
|
| 203 |
+
.comparison tbody tr:hover { background:rgba(0,0,0,.04); }
|
| 204 |
+
.td-name { display:flex; align-items:center; gap:10px; font-weight:600; font-size:.88em; }
|
| 205 |
+
.td-muted { color:rgba(0,0,0,.42); font-size:.83em; }
|
| 206 |
+
.td-actions { text-align:right; white-space:nowrap; }
|
| 207 |
+
.tbl-btn { background:none; border:none; color:rgba(0,0,0,.28); padding:5px 8px; border-radius:6px; cursor:pointer; font-size:.88em; transition:all .15s; }
|
| 208 |
+
.tbl-btn:hover { background:rgba(0,0,0,.06); color:#1a1a2e; }
|
| 209 |
+
.tbl-btn.del:hover { color:#b22222; }
|
| 210 |
+
|
| 211 |
+
/* ── PREVIEW PANE ── */
|
| 212 |
+
.preview-pane {
|
| 213 |
+
width:230px; flex-shrink:0;
|
| 214 |
+
background:rgba(255,255,255,0.55); backdrop-filter:blur(18px);
|
| 215 |
+
border-left:1px solid rgba(0,0,0,.08);
|
| 216 |
+
padding:24px 18px; display:flex; flex-direction:column; gap:16px; overflow-y:auto;
|
| 217 |
+
}
|
| 218 |
+
.preview-head { font-size:.6em; font-weight:700; text-transform:uppercase; letter-spacing:2px; color:rgba(0,0,0,.3); }
|
| 219 |
+
.preview-thumb {
|
| 220 |
+
aspect-ratio:1; width:100%; border-radius:12px;
|
| 221 |
+
background:rgba(0,0,0,0.05); border:1px solid rgba(0,0,0,0.08);
|
| 222 |
+
display:flex; align-items:center; justify-content:center; font-size:3em; backdrop-filter:blur(8px);
|
| 223 |
+
}
|
| 224 |
+
.preview-filename { font-size:.83em; font-weight:600; word-break:break-all; text-align:center; line-height:1.4; }
|
| 225 |
+
.preview-row { display:flex; justify-content:space-between; font-size:.75em; padding:7px 0; border-bottom:1px solid rgba(0,0,0,.07); }
|
| 226 |
+
.preview-row:last-of-type { border-bottom:none; }
|
| 227 |
+
.preview-row span:first-child { color:rgba(0,0,0,.38); }
|
| 228 |
+
.preview-actions { display:flex; flex-direction:column; gap:8px; margin-top:4px; }
|
| 229 |
+
.preview-actions .btn { border-radius:8px; justify-content:center; font-size:.78em; }
|
| 230 |
+
|
| 231 |
+
/* ── MODAL ── */
|
| 232 |
+
.modal-bg { position:fixed; inset:0; background:rgba(0,0,0,.25); backdrop-filter:blur(10px); z-index:200; display:none; align-items:center; justify-content:center; }
|
| 233 |
+
.modal-bg.open { display:flex; }
|
| 234 |
+
.modal-box {
|
| 235 |
+
background:rgba(255,255,255,0.88); backdrop-filter:blur(24px);
|
| 236 |
+
border:1px solid rgba(0,0,0,0.1); border-radius:16px; padding:32px;
|
| 237 |
+
width:min(400px,90vw); display:flex; flex-direction:column; gap:18px;
|
| 238 |
+
}
|
| 239 |
+
.modal-head { display:flex; align-items:center; gap:10px; font-size:1.1em; font-weight:700; color:#1a1a2e; }
|
| 240 |
+
.modal-close { margin-left:auto; background:none; border:none; color:rgba(0,0,0,.35); cursor:pointer; font-size:1em; padding:4px 8px; border-radius:6px; transition:all .15s; }
|
| 241 |
+
.modal-close:hover { background:rgba(0,0,0,.07); color:#1a1a2e; }
|
| 242 |
+
.modal-input-wrap label { display:block; font-size:.72em; font-weight:600; color:rgba(0,0,0,.4); margin-bottom:7px; text-transform:uppercase; letter-spacing:.8px; }
|
| 243 |
+
.modal-input-wrap input {
|
| 244 |
+
width:100%; background:rgba(255,255,255,0.8); border:1px solid rgba(0,0,0,.14);
|
| 245 |
+
border-radius:8px; padding:11px 14px; color:#1a1a2e;
|
| 246 |
+
font-size:.86em; outline:none; backdrop-filter:blur(8px); transition:border-color .2s;
|
| 247 |
+
}
|
| 248 |
+
.modal-input-wrap input:focus { border-color:rgba(0,0,0,.35); }
|
| 249 |
+
.modal-actions { display:flex; gap:10px; margin-top:4px; }
|
| 250 |
+
.modal-actions .btn { flex:1; border-radius:8px; justify-content:center; }
|
| 251 |
+
|
| 252 |
+
/* ── TOAST ── */
|
| 253 |
+
.toast {
|
| 254 |
+
position:fixed; bottom:28px; right:28px;
|
| 255 |
+
background:rgba(255,255,255,0.9); backdrop-filter:blur(16px);
|
| 256 |
+
border:1px solid rgba(0,0,0,.1); border-radius:10px;
|
| 257 |
+
padding:12px 20px; display:flex; align-items:center; gap:10px; font-size:.84em; color:#1a1a2e;
|
| 258 |
+
transform:translateY(70px); opacity:0;
|
| 259 |
+
transition:all .35s cubic-bezier(.34,1.56,.64,1); z-index:500;
|
| 260 |
+
box-shadow:0 8px 24px rgba(0,0,0,.12);
|
| 261 |
+
}
|
| 262 |
+
.toast.show { transform:none; opacity:1; }
|
| 263 |
+
.toast i { color:#007a45; }
|
| 264 |
+
|
| 265 |
+
/* ── LOADER ── */
|
| 266 |
+
.loader-overlay { position:fixed; inset:0; background:rgba(255,255,255,.45); backdrop-filter:blur(6px); z-index:900; display:none; align-items:center; justify-content:center; }
|
| 267 |
+
.loader-overlay.on { display:flex; }
|
| 268 |
+
.spinner { width:42px; height:42px; border:3px solid rgba(0,0,0,.1); border-top-color:#1a1a2e; border-radius:50%; animation:spin .65s linear infinite; }
|
| 269 |
+
@keyframes spin { to { transform:rotate(360deg); } }
|
| 270 |
+
|
| 271 |
+
/* ── RESPONSIVE ── */
|
| 272 |
+
@media(max-width:960px) {
|
| 273 |
+
.sidebar { width:54px; }
|
| 274 |
+
.nav-section,.nav-item span,.sidebar-storage { display:none; }
|
| 275 |
+
.nav-item { justify-content:center; padding:13px; }
|
| 276 |
+
.preview-pane { display:none; }
|
| 277 |
+
.topbar-center { display:none; }
|
| 278 |
+
}
|
| 279 |
+
@media(max-width:640px) {
|
| 280 |
+
.main { padding:22px 18px; gap:20px; }
|
| 281 |
+
.grid { grid-template-columns:1fr 1fr; }
|
| 282 |
+
.file-grid { grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); }
|
| 283 |
+
.topbar { padding:0 18px; }
|
| 284 |
+
}
|
| 285 |
+
</style>
|
| 286 |
+
</head>
|
| 287 |
+
<body>
|
| 288 |
+
|
| 289 |
+
<div class="bg-layer"></div>
|
| 290 |
+
|
| 291 |
+
<!-- TOPBAR -->
|
| 292 |
+
<header class="topbar">
|
| 293 |
+
<div class="topbar-brand">
|
| 294 |
+
<img src="logo.png" alt="Pockit"
|
| 295 |
+
onerror="this.style.display='none';document.getElementById('logo-fb').style.display='block'"/>
|
| 296 |
+
<span id="logo-fb" style="display:none;" class="fb">Pockit.</span>
|
| 297 |
+
</div>
|
| 298 |
+
|
| 299 |
+
<div class="topbar-center">
|
| 300 |
+
<div class="search-wrap">
|
| 301 |
+
<i class="fa-solid fa-magnifying-glass"></i>
|
| 302 |
+
<input type="text" placeholder="Search files…" oninput="filterFiles(this.value)"/>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
|
| 306 |
+
<div class="topbar-right">
|
| 307 |
+
<div class="account-chip" title="Account">
|
| 308 |
+
<div class="avatar">JD</div>
|
| 309 |
+
<span class="account-name">user</span>
|
| 310 |
+
<span class="role-tag pro" id="role-tag">Pro</span>
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
</header>
|
| 314 |
+
|
| 315 |
+
<div class="body-wrap">
|
| 316 |
+
|
| 317 |
+
<!-- SIDEBAR -->
|
| 318 |
+
<nav class="sidebar">
|
| 319 |
+
<span class="nav-section">Storage</span>
|
| 320 |
+
<div class="nav-item active" onclick="setNav(this,'all')">
|
| 321 |
+
<i class="fa-solid fa-folder-open"></i><span>My Files</span>
|
| 322 |
+
</div>
|
| 323 |
+
<div class="nav-item" onclick="setNav(this,'recent')">
|
| 324 |
+
<i class="fa-solid fa-clock-rotate-left"></i><span>Recent</span>
|
| 325 |
+
</div>
|
| 326 |
+
<span class="nav-section">Account</span>
|
| 327 |
+
<div class="nav-item" onclick="openModal('pw-modal')">
|
| 328 |
+
<i class="fa-solid fa-key"></i><span>Change Password</span>
|
| 329 |
+
</div>
|
| 330 |
+
<div class="nav-item" onclick="logoutUser()">
|
| 331 |
+
<i class="fa-solid fa-right-from-bracket"></i><span>Logout</span>
|
| 332 |
+
</div>
|
| 333 |
+
<div class="sidebar-storage">
|
| 334 |
+
<div class="stor-label"><span>Storage</span><span>1.8 / 5 GB</span></div>
|
| 335 |
+
<div class="sbar"><div class="sbar-fill"></div></div>
|
| 336 |
+
</div>
|
| 337 |
+
</nav>
|
| 338 |
+
|
| 339 |
+
<!-- MAIN -->
|
| 340 |
+
<main class="main">
|
| 341 |
+
|
| 342 |
+
<!-- Stats Cards -->
|
| 343 |
+
<div class="grid">
|
| 344 |
+
<div class="card">
|
| 345 |
+
<div class="card-label">Storage Used</div>
|
| 346 |
+
<div class="card-val">1.8 <span style="font-size:.38em;font-weight:400;color:rgba(0,0,0,.38)">GB</span></div>
|
| 347 |
+
<div class="card-bar"><div class="card-bar-fill" style="width:36%"></div></div>
|
| 348 |
+
<div class="card-sub">36% of 5 GB used</div>
|
| 349 |
+
</div>
|
| 350 |
+
<div class="card">
|
| 351 |
+
<div class="card-label">Total Files</div>
|
| 352 |
+
<div class="card-val">12</div>
|
| 353 |
+
<div class="card-sub">Across 5 file types</div>
|
| 354 |
+
</div>
|
| 355 |
+
<div class="card">
|
| 356 |
+
<div class="card-label">Uploaded Today</div>
|
| 357 |
+
<div class="card-val">3</div>
|
| 358 |
+
<div class="card-sub">Last upload 2h ago</div>
|
| 359 |
+
</div>
|
| 360 |
+
<div class="card">
|
| 361 |
+
<div class="card-label">Account Tier</div>
|
| 362 |
+
<div class="card-val" id="tier-val">Pro</div>
|
| 363 |
+
<div class="card-sub">5 GB max capacity</div>
|
| 364 |
+
</div>
|
| 365 |
+
</div>
|
| 366 |
+
|
| 367 |
+
<!-- Upload Drop Zone -->
|
| 368 |
+
<label class="drop-zone" id="drop-zone"
|
| 369 |
+
ondragover="event.preventDefault();this.classList.add('drag')"
|
| 370 |
+
ondragleave="this.classList.remove('drag')"
|
| 371 |
+
ondrop="handleDrop(event)">
|
| 372 |
+
<input type="file" id="file-input" onchange="handleUpload(this)"/>
|
| 373 |
+
<i class="fa-solid fa-cloud-arrow-up"></i>
|
| 374 |
+
<div class="dz-text">
|
| 375 |
+
<strong>Drop files here</strong> or click to upload<br/>
|
| 376 |
+
<span style="font-size:.82em;color:rgba(0,0,0,.3)">Supports any file type</span>
|
| 377 |
+
</div>
|
| 378 |
+
</label>
|
| 379 |
+
|
| 380 |
+
<!-- Toolbar -->
|
| 381 |
+
<div class="toolbar">
|
| 382 |
+
<span class="toolbar-title" id="page-title">My Files</span>
|
| 383 |
+
<div class="view-toggle">
|
| 384 |
+
<button class="active" id="vt-grid" onclick="setView('grid')"><i class="fa-solid fa-table-cells"></i></button>
|
| 385 |
+
<button id="vt-list" onclick="setView('list')"><i class="fa-solid fa-list"></i></button>
|
| 386 |
+
</div>
|
| 387 |
+
<button class="btn btn-ghost" style="padding:9px 15px;font-size:.82em;" onclick="clearSelection()">
|
| 388 |
+
<i class="fa-regular fa-square"></i> Deselect
|
| 389 |
+
</button>
|
| 390 |
+
<button class="btn btn-danger" style="padding:9px 15px;font-size:.82em;" onclick="deleteSelected()">
|
| 391 |
+
<i class="fa-solid fa-trash"></i> Delete
|
| 392 |
+
</button>
|
| 393 |
+
<label class="btn" style="padding:10px 22px;font-size:.83em;" for="file-input">
|
| 394 |
+
<i class="fa-solid fa-plus"></i> Upload
|
| 395 |
+
</label>
|
| 396 |
+
</div>
|
| 397 |
+
|
| 398 |
+
<!-- File Grid -->
|
| 399 |
+
<div class="file-grid" id="file-grid"></div>
|
| 400 |
+
|
| 401 |
+
<!-- File Table -->
|
| 402 |
+
<div class="comparison-wrapper" id="file-table-wrap" style="display:none;">
|
| 403 |
+
<table class="comparison">
|
| 404 |
+
<thead>
|
| 405 |
+
<tr><th>Name</th><th>Size</th><th>Modified</th><th>Type</th><th>Actions</th></tr>
|
| 406 |
+
</thead>
|
| 407 |
+
<tbody id="file-tbody"></tbody>
|
| 408 |
+
</table>
|
| 409 |
+
</div>
|
| 410 |
+
|
| 411 |
+
</main>
|
| 412 |
+
|
| 413 |
+
<!-- PREVIEW PANE -->
|
| 414 |
+
<aside class="preview-pane">
|
| 415 |
+
<div class="preview-head">File Info</div>
|
| 416 |
+
<div class="preview-thumb" id="preview-thumb">
|
| 417 |
+
<i class="fa-regular fa-file" style="font-size:.7em;color:rgba(0,0,0,.2);"></i>
|
| 418 |
+
</div>
|
| 419 |
+
<div class="preview-filename" id="preview-name" style="color:rgba(0,0,0,.3);">Select a file</div>
|
| 420 |
+
<div>
|
| 421 |
+
<div class="preview-row"><span>Size</span><span id="pv-size">—</span></div>
|
| 422 |
+
<div class="preview-row"><span>Modified</span><span id="pv-date">—</span></div>
|
| 423 |
+
<div class="preview-row"><span>Type</span><span id="pv-type">—</span></div>
|
| 424 |
+
</div>
|
| 425 |
+
<div class="preview-actions">
|
| 426 |
+
<button class="btn btn-ghost" style="font-size:.78em;" onclick="downloadPreviewFile()"><i class="fa-solid fa-download"></i> Download</button>
|
| 427 |
+
<button class="btn btn-danger" style="font-size:.78em;" onclick="deletePreviewFile()"><i class="fa-solid fa-trash"></i> Delete</button>
|
| 428 |
+
</div>
|
| 429 |
+
</aside>
|
| 430 |
+
|
| 431 |
+
</div>
|
| 432 |
+
|
| 433 |
+
<!-- CHANGE PASSWORD MODAL -->
|
| 434 |
+
<div class="modal-bg" id="pw-modal">
|
| 435 |
+
<div class="modal-box">
|
| 436 |
+
<div class="modal-head">
|
| 437 |
+
<i class="fa-solid fa-key"></i> Change Password
|
| 438 |
+
<button class="modal-close" onclick="closeModal('pw-modal')"><i class="fa-solid fa-xmark"></i></button>
|
| 439 |
+
</div>
|
| 440 |
+
<div class="modal-input-wrap">
|
| 441 |
+
<label>New Password</label>
|
| 442 |
+
<input type="password" id="new-pw" placeholder="Enter new password"/>
|
| 443 |
+
</div>
|
| 444 |
+
<div class="modal-input-wrap">
|
| 445 |
+
<label>Confirm Password</label>
|
| 446 |
+
<input type="password" id="conf-pw" placeholder="Confirm new password"/>
|
| 447 |
+
</div>
|
| 448 |
+
<div class="modal-actions">
|
| 449 |
+
<button class="btn btn-ghost" onclick="closeModal('pw-modal')">Cancel</button>
|
| 450 |
+
<button class="btn" onclick="changePassword()">Update</button>
|
| 451 |
+
</div>
|
| 452 |
+
</div>
|
| 453 |
+
</div>
|
| 454 |
+
|
| 455 |
+
<!-- TOAST -->
|
| 456 |
+
<div class="toast" id="toast">
|
| 457 |
+
<i class="fa-solid fa-circle-check"></i>
|
| 458 |
+
<span id="toast-msg">Done.</span>
|
| 459 |
+
</div>
|
| 460 |
+
|
| 461 |
+
<!-- LOADER -->
|
| 462 |
+
<div class="loader-overlay" id="loader">
|
| 463 |
+
<div class="spinner"></div>
|
| 464 |
+
</div>
|
| 465 |
+
|
| 466 |
+
<script type="module" src="dashboardlogic.js"></script>
|
| 467 |
+
</body>
|
| 468 |
+
</html>
|
dashboardlogic.js
ADDED
|
@@ -0,0 +1,613 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client@1.9.0/dist/index.min.js";
|
| 2 |
+
|
| 3 |
+
let client;
|
| 4 |
+
let currentUser = null;
|
| 5 |
+
let currentPassword = null;
|
| 6 |
+
let files = [];
|
| 7 |
+
let selected = new Set();
|
| 8 |
+
let currentView = 'grid';
|
| 9 |
+
let previewFile = null;
|
| 10 |
+
let isLoadingFiles = false;
|
| 11 |
+
|
| 12 |
+
const iconMap = {
|
| 13 |
+
'pdf': '📄', 'doc': '📄', 'docx': '📄',
|
| 14 |
+
'png': '🖼️', 'jpg': '🖼️', 'jpeg': '🖼️', 'gif': '🖼️',
|
| 15 |
+
'mp3': '🎵', 'wav': '🎵', 'flac': '🎵',
|
| 16 |
+
'mp4': '📹', 'avi': '📹', 'mov': '📹',
|
| 17 |
+
'zip': '🗜️', 'rar': '🗜️', '7z': '🗜️',
|
| 18 |
+
'txt': '📝', 'md': '📝',
|
| 19 |
+
'py': '🐍', 'js': '📜', 'html': '🌐', 'css': '🌐',
|
| 20 |
+
'psd': '🎨', 'ai': '🎨',
|
| 21 |
+
'sql': '🗃️', 'xlsx': '📊', 'csv': '📊',
|
| 22 |
+
'pptx': '📑', 'ppt': '📑',
|
| 23 |
+
};
|
| 24 |
+
|
| 25 |
+
// Initialize dashboard on page load
|
| 26 |
+
async function initDashboard() {
|
| 27 |
+
console.log('=== Dashboard Init Started ===');
|
| 28 |
+
currentUser = sessionStorage.getItem('pockit_user');
|
| 29 |
+
currentPassword = sessionStorage.getItem('pockit_pass');
|
| 30 |
+
|
| 31 |
+
if (!currentUser || !currentPassword) {
|
| 32 |
+
console.warn('No session found, redirecting to login');
|
| 33 |
+
window.location.href = 'index.html';
|
| 34 |
+
return;
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
try {
|
| 38 |
+
client = await Client.connect("pockit-cloud/main");
|
| 39 |
+
console.log('✓ Connected to API');
|
| 40 |
+
|
| 41 |
+
// Update account info
|
| 42 |
+
const initials = currentUser.substring(0, 2).toUpperCase();
|
| 43 |
+
document.querySelector('.avatar').textContent = initials;
|
| 44 |
+
document.querySelector('.account-name').textContent = currentUser;
|
| 45 |
+
|
| 46 |
+
// Load data
|
| 47 |
+
await loadUserData();
|
| 48 |
+
await loadFiles();
|
| 49 |
+
|
| 50 |
+
} catch (err) {
|
| 51 |
+
console.error('Init error:', err);
|
| 52 |
+
showToast('Connection failed');
|
| 53 |
+
setTimeout(() => window.location.href = 'index.html', 2000);
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// Load user info and update cards
|
| 58 |
+
async function loadUserData() {
|
| 59 |
+
try {
|
| 60 |
+
console.log('Loading user data...');
|
| 61 |
+
const result = await client.predict("/search_user", { user_id: currentUser });
|
| 62 |
+
const [log, isDev, isPro, isTester, capacityUsed, usedTotal] = result.data;
|
| 63 |
+
|
| 64 |
+
// Determine role
|
| 65 |
+
let role = 'free';
|
| 66 |
+
if (isDev) role = 'dev';
|
| 67 |
+
else if (isPro) role = 'pro';
|
| 68 |
+
else if (isTester) role = 'tester';
|
| 69 |
+
|
| 70 |
+
const tag = document.getElementById('role-tag');
|
| 71 |
+
tag.className = 'role-tag ' + role;
|
| 72 |
+
tag.textContent = role.charAt(0).toUpperCase() + role.slice(1);
|
| 73 |
+
document.getElementById('tier-val').textContent = tag.textContent;
|
| 74 |
+
|
| 75 |
+
// Parse capacity
|
| 76 |
+
const capacityPercent = Math.round(capacityUsed);
|
| 77 |
+
let usedDisplay = usedTotal || '0 / 5 GB';
|
| 78 |
+
let usedParts = usedDisplay.split('/');
|
| 79 |
+
let usedAmount = usedParts[0].trim();
|
| 80 |
+
let maxAmount = usedParts[1] ? usedParts[1].trim() : '5 GB';
|
| 81 |
+
|
| 82 |
+
// Update storage displays
|
| 83 |
+
document.querySelector('.card-bar-fill').style.width = capacityPercent + '%';
|
| 84 |
+
document.querySelector('.stor-label span:last-child').textContent = usedDisplay;
|
| 85 |
+
document.querySelector('.sbar-fill').style.width = capacityPercent + '%';
|
| 86 |
+
|
| 87 |
+
const storageCard = document.querySelectorAll('.card')[0];
|
| 88 |
+
storageCard.querySelector('.card-val').innerHTML = usedAmount + ' <span style="font-size:.38em;font-weight:400;color:rgba(0,0,0,.38)">(' + capacityPercent + '%)</span>';
|
| 89 |
+
storageCard.querySelector('.card-sub').textContent = usedDisplay + ' used';
|
| 90 |
+
|
| 91 |
+
document.querySelectorAll('.card')[3].querySelector('.card-sub').textContent = maxAmount + ' max capacity';
|
| 92 |
+
|
| 93 |
+
console.log('✓ User data loaded');
|
| 94 |
+
} catch (err) {
|
| 95 |
+
console.error('User data error:', err);
|
| 96 |
+
}
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
// Load files from API
|
| 100 |
+
async function loadFiles() {
|
| 101 |
+
// Prevent concurrent loads
|
| 102 |
+
if (isLoadingFiles) return;
|
| 103 |
+
isLoadingFiles = true;
|
| 104 |
+
|
| 105 |
+
try {
|
| 106 |
+
console.log('Loading files...');
|
| 107 |
+
loading(true);
|
| 108 |
+
const result = await client.predict("/get_files_secure", {
|
| 109 |
+
user_id: currentUser,
|
| 110 |
+
password: currentPassword,
|
| 111 |
+
});
|
| 112 |
+
// API returns [dropdown, status]
|
| 113 |
+
const dropdownData = result.data[0];
|
| 114 |
+
console.log('Raw dropdownData:', dropdownData);
|
| 115 |
+
let fileNames = [];
|
| 116 |
+
if (dropdownData && typeof dropdownData === 'object' && dropdownData.choices) {
|
| 117 |
+
// Flatten all sub-arrays in choices
|
| 118 |
+
fileNames = dropdownData.choices.flat ? dropdownData.choices.flat() : [].concat(...dropdownData.choices);
|
| 119 |
+
} else if (Array.isArray(dropdownData)) {
|
| 120 |
+
fileNames = dropdownData;
|
| 121 |
+
} else if (typeof dropdownData === 'string') {
|
| 122 |
+
fileNames = [dropdownData];
|
| 123 |
+
}
|
| 124 |
+
// Convert all to string, trim, and filter empty
|
| 125 |
+
fileNames = fileNames.map(f => String(f).trim()).filter(Boolean);
|
| 126 |
+
console.log('Extracted fileNames from dropdown:', fileNames);
|
| 127 |
+
// Deduplicate file names (case-insensitive, trim)
|
| 128 |
+
const seen = new Set();
|
| 129 |
+
const deduped = [];
|
| 130 |
+
for (const name of fileNames) {
|
| 131 |
+
const key = name.toLowerCase();
|
| 132 |
+
if (!key || seen.has(key)) continue;
|
| 133 |
+
seen.add(key);
|
| 134 |
+
deduped.push(name);
|
| 135 |
+
}
|
| 136 |
+
files = deduped.map((name, idx) => {
|
| 137 |
+
const ext = name.includes('.') ? name.split('.').pop().toLowerCase() : '';
|
| 138 |
+
return {
|
| 139 |
+
id: idx,
|
| 140 |
+
name: name,
|
| 141 |
+
icon: iconMap[ext] || '📁',
|
| 142 |
+
size: '—',
|
| 143 |
+
date: 'Recently',
|
| 144 |
+
type: ext ? ext.toUpperCase() : '',
|
| 145 |
+
preview: null // for preview content
|
| 146 |
+
};
|
| 147 |
+
});
|
| 148 |
+
console.log('Final files array before render:', files);
|
| 149 |
+
selected.clear();
|
| 150 |
+
updateStatsCards();
|
| 151 |
+
render(files);
|
| 152 |
+
loading(false);
|
| 153 |
+
console.log('✓ Files loaded and rendered');
|
| 154 |
+
} catch (err) {
|
| 155 |
+
console.error('Files load error:', err);
|
| 156 |
+
loading(false);
|
| 157 |
+
files = [];
|
| 158 |
+
selected.clear();
|
| 159 |
+
render([]);
|
| 160 |
+
showToast('Failed to load files');
|
| 161 |
+
} finally {
|
| 162 |
+
isLoadingFiles = false;
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
// Update stats cards
|
| 167 |
+
function updateStatsCards() {
|
| 168 |
+
const cards = document.querySelectorAll('.card');
|
| 169 |
+
if (cards.length < 3) return;
|
| 170 |
+
|
| 171 |
+
// Files count
|
| 172 |
+
cards[1].querySelector('.card-val').textContent = files.length;
|
| 173 |
+
|
| 174 |
+
// File types
|
| 175 |
+
const fileTypes = new Set(files.map(f => f.type));
|
| 176 |
+
cards[1].querySelector('.card-sub').textContent = `Across ${fileTypes.size} file type${fileTypes.size !== 1 ? 's' : ''}`;
|
| 177 |
+
|
| 178 |
+
// Upload card
|
| 179 |
+
cards[2].querySelector('.card-val').textContent = files.length > 0 ? '1' : '0';
|
| 180 |
+
cards[2].querySelector('.card-sub').textContent = files.length > 0 ? 'Last upload: Recently' : 'No uploads yet';
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
// Render grid and table
|
| 184 |
+
function render(list) {
|
| 185 |
+
console.log('Rendering', list.length, 'files:', list.map(f => f.name));
|
| 186 |
+
|
| 187 |
+
const grid = document.getElementById('file-grid');
|
| 188 |
+
const tbody = document.getElementById('file-tbody');
|
| 189 |
+
|
| 190 |
+
if (!grid) {
|
| 191 |
+
console.error('file-grid missing');
|
| 192 |
+
return;
|
| 193 |
+
}
|
| 194 |
+
if (!tbody) {
|
| 195 |
+
console.error('file-tbody missing');
|
| 196 |
+
return;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
// Clear everything first
|
| 200 |
+
grid.innerHTML = '';
|
| 201 |
+
tbody.innerHTML = '';
|
| 202 |
+
|
| 203 |
+
// Only render if there are files
|
| 204 |
+
if (!list || list.length === 0) {
|
| 205 |
+
console.log('No files to render');
|
| 206 |
+
return;
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
// Grid HTML
|
| 210 |
+
const gridHTML = list.map((f, i) => `
|
| 211 |
+
<div class="file-card ${selected.has(i) ? 'selected' : ''}" onclick="toggleSelect(${i})" ondblclick="openPreview(${i})">
|
| 212 |
+
<span class="fc-check"><i class="fa-solid fa-check"></i></span>
|
| 213 |
+
<span class="fc-icon">${f.icon}</span>
|
| 214 |
+
<span class="fc-name">${f.name}</span>
|
| 215 |
+
<span class="fc-meta">${f.size}</span>
|
| 216 |
+
</div>
|
| 217 |
+
`).join('');
|
| 218 |
+
|
| 219 |
+
grid.innerHTML = gridHTML;
|
| 220 |
+
console.log('Grid rendered with', list.length, 'items');
|
| 221 |
+
|
| 222 |
+
// Table HTML
|
| 223 |
+
const tableHTML = list.map((f, i) => `
|
| 224 |
+
<tr onclick="openPreview(${i})">
|
| 225 |
+
<td class="td-name"><span>${f.icon}</span> ${f.name}</td>
|
| 226 |
+
<td class="td-muted">${f.size}</td>
|
| 227 |
+
<td class="td-muted">${f.date}</td>
|
| 228 |
+
<td class="td-muted">${f.type}</td>
|
| 229 |
+
<td class="td-actions">
|
| 230 |
+
<button class="tbl-btn" onclick="event.stopPropagation();openPreview(${i})"><i class="fa-solid fa-eye"></i></button>
|
| 231 |
+
<button class="tbl-btn" onclick="event.stopPropagation();downloadFile(${i})"><i class="fa-solid fa-download"></i></button>
|
| 232 |
+
<button class="tbl-btn del" onclick="event.stopPropagation();deleteFile(${i})"><i class="fa-solid fa-trash"></i></button>
|
| 233 |
+
</td>
|
| 234 |
+
</tr>
|
| 235 |
+
`).join('');
|
| 236 |
+
|
| 237 |
+
tbody.innerHTML = tableHTML;
|
| 238 |
+
console.log('Table rendered with', list.length, 'items');
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
// Select/deselect file
|
| 242 |
+
function toggleSelect(id) {
|
| 243 |
+
if (id < 0 || id >= files.length) return;
|
| 244 |
+
selected.has(id) ? selected.delete(id) : selected.add(id);
|
| 245 |
+
render(currentView === 'grid' ? files : files);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
function clearSelection() {
|
| 249 |
+
selected.clear();
|
| 250 |
+
render(files);
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
function handleSelectAll(checked) {
|
| 254 |
+
if (checked) {
|
| 255 |
+
files.forEach((_, i) => selected.add(i));
|
| 256 |
+
} else {
|
| 257 |
+
selected.clear();
|
| 258 |
+
}
|
| 259 |
+
render(files);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
// Open file preview
|
| 263 |
+
function openPreview(id) {
|
| 264 |
+
if (id < 0 || id >= files.length) return;
|
| 265 |
+
previewFile = files[id];
|
| 266 |
+
document.getElementById('preview-thumb').textContent = previewFile.icon;
|
| 267 |
+
document.getElementById('preview-name').textContent = previewFile.name;
|
| 268 |
+
document.getElementById('preview-name').style.color = '#1a1a2e';
|
| 269 |
+
document.getElementById('pv-size').textContent = previewFile.size;
|
| 270 |
+
document.getElementById('pv-date').textContent = previewFile.date;
|
| 271 |
+
document.getElementById('pv-type').textContent = previewFile.type;
|
| 272 |
+
// Load preview content from API
|
| 273 |
+
loadPreviewContent(previewFile);
|
| 274 |
+
selected.clear();
|
| 275 |
+
selected.add(id);
|
| 276 |
+
render(files);
|
| 277 |
+
// Load preview content for a file using /handle_preview_secure and /get_preview_text_action
|
| 278 |
+
async function loadPreviewContent(file) {
|
| 279 |
+
if (!file || !file.name) return;
|
| 280 |
+
const previewContainer = document.getElementById('preview-content');
|
| 281 |
+
if (!previewContainer) return;
|
| 282 |
+
previewContainer.innerHTML = '<span style="color:#aaa">Loading preview...</span>';
|
| 283 |
+
try {
|
| 284 |
+
// Try /handle_preview_secure first
|
| 285 |
+
const result = await client.predict("/handle_preview_secure", {
|
| 286 |
+
user_id: currentUser,
|
| 287 |
+
password: currentPassword,
|
| 288 |
+
filename: file.name,
|
| 289 |
+
});
|
| 290 |
+
// result.data: [file, localPath, html, image, code]
|
| 291 |
+
let previewHtml = '';
|
| 292 |
+
if (result.data[3] && typeof result.data[3] === 'string' && result.data[3].startsWith('data:image')) {
|
| 293 |
+
// Image preview
|
| 294 |
+
previewHtml = `<img src="${result.data[3]}" alt="Preview" style="max-width:100%;max-height:200px;">`;
|
| 295 |
+
} else if (result.data[2] && typeof result.data[2] === 'string' && result.data[2].length > 0) {
|
| 296 |
+
// HTML preview
|
| 297 |
+
previewHtml = `<div class="pv-html">${result.data[2]}</div>`;
|
| 298 |
+
} else if (result.data[4] && typeof result.data[4] === 'string' && result.data[4].length > 0) {
|
| 299 |
+
// Code preview
|
| 300 |
+
previewHtml = `<pre class="pv-code">${escapeHtml(result.data[4])}</pre>`;
|
| 301 |
+
} else {
|
| 302 |
+
// Try /get_preview_text_action for text preview
|
| 303 |
+
const textResult = await client.predict("/get_preview_text_action", {
|
| 304 |
+
user_id: currentUser,
|
| 305 |
+
password: currentPassword,
|
| 306 |
+
filename: file.name,
|
| 307 |
+
});
|
| 308 |
+
if (textResult.data && typeof textResult.data[0] === 'string' && textResult.data[0].length > 0) {
|
| 309 |
+
previewHtml = `<pre class="pv-text">${escapeHtml(textResult.data[0])}</pre>`;
|
| 310 |
+
} else {
|
| 311 |
+
previewHtml = '<span style="color:#aaa">No preview available.</span>';
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
previewContainer.innerHTML = previewHtml;
|
| 315 |
+
} catch (err) {
|
| 316 |
+
console.error('Preview error:', err);
|
| 317 |
+
previewContainer.innerHTML = '<span style="color:#f55">Failed to load preview.</span>';
|
| 318 |
+
}
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
// Helper to escape HTML for code/text preview
|
| 322 |
+
function escapeHtml(str) {
|
| 323 |
+
return String(str)
|
| 324 |
+
.replace(/&/g, '&')
|
| 325 |
+
.replace(/</g, '<')
|
| 326 |
+
.replace(/>/g, '>')
|
| 327 |
+
.replace(/"/g, '"')
|
| 328 |
+
.replace(/'/g, ''');
|
| 329 |
+
}
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
// Delete single file
|
| 333 |
+
async function deleteFile(id) {
|
| 334 |
+
if (id < 0 || id >= files.length) return;
|
| 335 |
+
const file = files[id];
|
| 336 |
+
|
| 337 |
+
try {
|
| 338 |
+
loading(true);
|
| 339 |
+
const result = await client.predict("/delete_file_secure", {
|
| 340 |
+
user_id: currentUser,
|
| 341 |
+
password: currentPassword,
|
| 342 |
+
filename: file.name,
|
| 343 |
+
});
|
| 344 |
+
|
| 345 |
+
console.log('Deleted:', file.name);
|
| 346 |
+
|
| 347 |
+
// Update storage
|
| 348 |
+
const [status, capacityUsed, usedTotal] = result.data;
|
| 349 |
+
const percent = Math.round(capacityUsed);
|
| 350 |
+
document.querySelector('.card-bar-fill').style.width = percent + '%';
|
| 351 |
+
document.querySelector('.sbar-fill').style.width = percent + '%';
|
| 352 |
+
document.querySelector('.stor-label span:last-child').textContent = usedTotal;
|
| 353 |
+
|
| 354 |
+
// Remove from array
|
| 355 |
+
files.splice(id, 1);
|
| 356 |
+
selected.delete(id);
|
| 357 |
+
|
| 358 |
+
updateStatsCards();
|
| 359 |
+
render(files);
|
| 360 |
+
loading(false);
|
| 361 |
+
showToast(file.name + ' deleted');
|
| 362 |
+
} catch (err) {
|
| 363 |
+
console.error('Delete error:', err);
|
| 364 |
+
loading(false);
|
| 365 |
+
showToast('Delete failed');
|
| 366 |
+
}
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
// Delete selected files
|
| 370 |
+
async function deleteSelected() {
|
| 371 |
+
if (selected.size === 0) {
|
| 372 |
+
showToast('No files selected');
|
| 373 |
+
return;
|
| 374 |
+
}
|
| 375 |
+
const ids = Array.from(selected).sort((a, b) => b - a);
|
| 376 |
+
for (const id of ids) {
|
| 377 |
+
await deleteFile(id);
|
| 378 |
+
}
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
// Delete preview file
|
| 382 |
+
async function deletePreviewFile() {
|
| 383 |
+
if (!previewFile) return;
|
| 384 |
+
const idx = files.indexOf(previewFile);
|
| 385 |
+
if (idx >= 0) await deleteFile(idx);
|
| 386 |
+
previewFile = null;
|
| 387 |
+
document.getElementById('preview-name').textContent = 'Select a file';
|
| 388 |
+
document.getElementById('preview-name').style.color = 'rgba(0,0,0,.3)';
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
// Download file
|
| 392 |
+
async function downloadFile(id) {
|
| 393 |
+
if (id < 0 || id >= files.length) return;
|
| 394 |
+
const file = files[id];
|
| 395 |
+
try {
|
| 396 |
+
loading(true);
|
| 397 |
+
// Use /get_download_link_action to get the raw download link
|
| 398 |
+
const result = await client.predict("/get_download_link_action", {
|
| 399 |
+
user_id: currentUser,
|
| 400 |
+
password: currentPassword,
|
| 401 |
+
filename: file.name,
|
| 402 |
+
});
|
| 403 |
+
const fileUrl = result.data[0];
|
| 404 |
+
if (typeof fileUrl === 'string' && (fileUrl.startsWith('http') || fileUrl.startsWith('https'))) {
|
| 405 |
+
// Fetch as blob to force download, with optional Hugging Face token
|
| 406 |
+
const hfToken = sessionStorage.getItem('hf_read_token');
|
| 407 |
+
const fetchOptions = hfToken ? {
|
| 408 |
+
headers: { 'Authorization': 'Bearer ' + hfToken }
|
| 409 |
+
} : {};
|
| 410 |
+
const response = await fetch(fileUrl, fetchOptions);
|
| 411 |
+
if (!response.ok) {
|
| 412 |
+
console.error('Download fetch error:', {
|
| 413 |
+
url: fileUrl,
|
| 414 |
+
status: response.status,
|
| 415 |
+
statusText: response.statusText
|
| 416 |
+
});
|
| 417 |
+
throw new Error('Network response was not ok (status ' + response.status + '): ' + response.statusText);
|
| 418 |
+
}
|
| 419 |
+
const blob = await response.blob();
|
| 420 |
+
const url = window.URL.createObjectURL(blob);
|
| 421 |
+
const a = document.createElement('a');
|
| 422 |
+
a.href = url;
|
| 423 |
+
a.download = file.name;
|
| 424 |
+
document.body.appendChild(a);
|
| 425 |
+
a.click();
|
| 426 |
+
setTimeout(() => {
|
| 427 |
+
document.body.removeChild(a);
|
| 428 |
+
window.URL.revokeObjectURL(url);
|
| 429 |
+
}, 100);
|
| 430 |
+
showToast('Download started: ' + file.name);
|
| 431 |
+
} else {
|
| 432 |
+
showToast('Download link error');
|
| 433 |
+
}
|
| 434 |
+
loading(false);
|
| 435 |
+
} catch (err) {
|
| 436 |
+
console.error('Download error:', err);
|
| 437 |
+
loading(false);
|
| 438 |
+
showToast('Download failed: ' + (err && err.message ? err.message : ''));
|
| 439 |
+
}
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
async function downloadPreviewFile() {
|
| 443 |
+
if (!previewFile) return;
|
| 444 |
+
const idx = files.indexOf(previewFile);
|
| 445 |
+
if (idx >= 0) {
|
| 446 |
+
await downloadFile(idx);
|
| 447 |
+
}
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
// Upload file
|
| 451 |
+
async function handleUpload(input) {
|
| 452 |
+
if (!input.files || !input.files[0]) return;
|
| 453 |
+
const file = input.files[0];
|
| 454 |
+
try {
|
| 455 |
+
loading(true);
|
| 456 |
+
// Use File object and pass custom_name for filename preservation
|
| 457 |
+
console.log('Uploading file:', file, 'type:', file.constructor.name);
|
| 458 |
+
const result = await client.predict("/upload_file_secure", {
|
| 459 |
+
user_id: currentUser,
|
| 460 |
+
password: currentPassword,
|
| 461 |
+
filepath: file,
|
| 462 |
+
custom_name: file.name,
|
| 463 |
+
});
|
| 464 |
+
console.log('Uploaded:', file.name);
|
| 465 |
+
// Update storage
|
| 466 |
+
const [status, capacityUsed, usedTotal] = result.data;
|
| 467 |
+
const percent = Math.round(capacityUsed);
|
| 468 |
+
document.querySelector('.card-bar-fill').style.width = percent + '%';
|
| 469 |
+
document.querySelector('.sbar-fill').style.width = percent + '%';
|
| 470 |
+
document.querySelector('.stor-label span:last-child').textContent = usedTotal;
|
| 471 |
+
// Reload files
|
| 472 |
+
await loadFiles();
|
| 473 |
+
showToast(file.name + ' uploaded');
|
| 474 |
+
input.value = '';
|
| 475 |
+
} catch (err) {
|
| 476 |
+
console.error('Upload error:', err);
|
| 477 |
+
loading(false);
|
| 478 |
+
showToast('Upload failed');
|
| 479 |
+
}
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
function handleDrop(e) {
|
| 483 |
+
e.preventDefault();
|
| 484 |
+
document.getElementById('drop-zone').classList.remove('drag');
|
| 485 |
+
if (e.dataTransfer.files) {
|
| 486 |
+
handleUpload({ files: e.dataTransfer.files });
|
| 487 |
+
}
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
// Filter files by search
|
| 491 |
+
function filterFiles(q) {
|
| 492 |
+
const query = q.toLowerCase();
|
| 493 |
+
const filtered = files.filter(f => f.name.toLowerCase().includes(query));
|
| 494 |
+
render(filtered);
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
// Toggle view
|
| 498 |
+
function setView(v) {
|
| 499 |
+
currentView = v;
|
| 500 |
+
document.getElementById('file-grid').style.display = v === 'grid' ? 'grid' : 'none';
|
| 501 |
+
document.getElementById('file-table-wrap').style.display = v === 'list' ? 'block' : 'none';
|
| 502 |
+
document.getElementById('vt-grid').classList.toggle('active', v === 'grid');
|
| 503 |
+
document.getElementById('vt-list').classList.toggle('active', v === 'list');
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
// Navigation sections
|
| 507 |
+
function setNav(el, section) {
|
| 508 |
+
document.querySelectorAll('.nav-item').forEach(n => n.classList.remove('active'));
|
| 509 |
+
el.classList.add('active');
|
| 510 |
+
|
| 511 |
+
if (section === 'recent') {
|
| 512 |
+
document.getElementById('page-title').textContent = 'Recent Files';
|
| 513 |
+
render(files.slice(0, 5));
|
| 514 |
+
} else {
|
| 515 |
+
document.getElementById('page-title').textContent = 'My Files';
|
| 516 |
+
render(files);
|
| 517 |
+
}
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// Change password
|
| 521 |
+
async function changePassword() {
|
| 522 |
+
const p1 = document.getElementById('new-pw').value;
|
| 523 |
+
const p2 = document.getElementById('conf-pw').value;
|
| 524 |
+
|
| 525 |
+
if (!p1 || p1 !== p2) {
|
| 526 |
+
showToast('Passwords do not match');
|
| 527 |
+
return;
|
| 528 |
+
}
|
| 529 |
+
|
| 530 |
+
try {
|
| 531 |
+
loading(true);
|
| 532 |
+
const result = await client.predict("/update_password", {
|
| 533 |
+
user_id: currentUser,
|
| 534 |
+
new_password: p1,
|
| 535 |
+
});
|
| 536 |
+
|
| 537 |
+
if (result.data[0].toLowerCase().includes('success') || result.data[0].toLowerCase().includes('updated')) {
|
| 538 |
+
currentPassword = p1;
|
| 539 |
+
sessionStorage.setItem('pockit_pass', p1);
|
| 540 |
+
closeModal('pw-modal');
|
| 541 |
+
showToast('Password updated');
|
| 542 |
+
document.getElementById('new-pw').value = '';
|
| 543 |
+
document.getElementById('conf-pw').value = '';
|
| 544 |
+
} else {
|
| 545 |
+
showToast('Password update failed');
|
| 546 |
+
}
|
| 547 |
+
loading(false);
|
| 548 |
+
} catch (err) {
|
| 549 |
+
console.error('Password error:', err);
|
| 550 |
+
loading(false);
|
| 551 |
+
showToast('Password update failed');
|
| 552 |
+
}
|
| 553 |
+
}
|
| 554 |
+
|
| 555 |
+
// Logout
|
| 556 |
+
function logoutUser() {
|
| 557 |
+
sessionStorage.clear();
|
| 558 |
+
showToast('Logged out');
|
| 559 |
+
setTimeout(() => window.location.href = 'index.html', 1500);
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
// Modal helpers
|
| 563 |
+
function openModal(id) {
|
| 564 |
+
document.getElementById(id).classList.add('open');
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
function closeModal(id) {
|
| 568 |
+
document.getElementById(id).classList.remove('open');
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
// UI helpers
|
| 572 |
+
function loading(on) {
|
| 573 |
+
document.getElementById('loader').classList.toggle('on', on);
|
| 574 |
+
}
|
| 575 |
+
|
| 576 |
+
let toastTimer;
|
| 577 |
+
function showToast(msg) {
|
| 578 |
+
const toast = document.getElementById('toast');
|
| 579 |
+
document.getElementById('toast-msg').textContent = msg;
|
| 580 |
+
toast.classList.add('show');
|
| 581 |
+
clearTimeout(toastTimer);
|
| 582 |
+
toastTimer = setTimeout(() => toast.classList.remove('show'), 3000);
|
| 583 |
+
}
|
| 584 |
+
|
| 585 |
+
// Initialize on page load
|
| 586 |
+
document.addEventListener('DOMContentLoaded', initDashboard);
|
| 587 |
+
|
| 588 |
+
// Expose to global scope
|
| 589 |
+
window.initDashboard = initDashboard;
|
| 590 |
+
window.loadUserData = loadUserData;
|
| 591 |
+
window.loadFiles = loadFiles;
|
| 592 |
+
window.updateStatsCards = updateStatsCards;
|
| 593 |
+
window.render = render;
|
| 594 |
+
window.toggleSelect = toggleSelect;
|
| 595 |
+
window.clearSelection = clearSelection;
|
| 596 |
+
window.handleSelectAll = handleSelectAll;
|
| 597 |
+
window.openPreview = openPreview;
|
| 598 |
+
window.deleteFile = deleteFile;
|
| 599 |
+
window.deleteSelected = deleteSelected;
|
| 600 |
+
window.deletePreviewFile = deletePreviewFile;
|
| 601 |
+
window.downloadFile = downloadFile;
|
| 602 |
+
window.downloadPreviewFile = downloadPreviewFile;
|
| 603 |
+
window.handleUpload = handleUpload;
|
| 604 |
+
window.handleDrop = handleDrop;
|
| 605 |
+
window.filterFiles = filterFiles;
|
| 606 |
+
window.setView = setView;
|
| 607 |
+
window.setNav = setNav;
|
| 608 |
+
window.changePassword = changePassword;
|
| 609 |
+
window.logoutUser = logoutUser;
|
| 610 |
+
window.openModal = openModal;
|
| 611 |
+
window.closeModal = closeModal;
|
| 612 |
+
window.loading = loading;
|
| 613 |
+
window.showToast = showToast;
|
index.html
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Pockit | Scalable Cloud Storage</title>
|
| 7 |
+
<style>
|
| 8 |
+
/* Reset & Base */
|
| 9 |
+
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
|
| 10 |
+
body { color: #fff; line-height: 1.6; overflow-x: hidden; }
|
| 11 |
+
|
| 12 |
+
/* Stationary Background Layer */
|
| 13 |
+
.bg-layer {
|
| 14 |
+
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
| 15 |
+
background-image: url(bg.jpg);
|
| 16 |
+
background-size: cover;
|
| 17 |
+
background-position: center;
|
| 18 |
+
background-attachment: fixed; /* Keeps background stationary */
|
| 19 |
+
z-index: -1;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
/* Layout Helpers */
|
| 23 |
+
.container { width: 90%; max-width: 1200px; margin: 0 auto; }
|
| 24 |
+
.section-padding { padding: 100px 0; }
|
| 25 |
+
|
| 26 |
+
/* Hero */
|
| 27 |
+
.hero { height: 100vh; display: flex; align-items: center; justify-content: space-between; gap: 50px; }
|
| 28 |
+
.hero-text { flex: 1; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
|
| 29 |
+
.hero-text h1 { font-size: 5rem; line-height: 1; margin-bottom: 20px; }
|
| 30 |
+
.hero-text p { font-size: 1.5rem; margin-bottom: 30px; color: #fff; }
|
| 31 |
+
.btn { padding: 18px 40px; background: #fff; color: #000; border-radius: 8px; text-decoration: none; font-weight: 700; display: inline-block; transition: 0.3s; }
|
| 32 |
+
.btn:hover { background: #ddd; }
|
| 33 |
+
|
| 34 |
+
.hero-image { flex: 1; display: flex; justify-content: flex-end; }
|
| 35 |
+
.hero-image img { width: 100%; max-width: 600px; border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,0.8); }
|
| 36 |
+
|
| 37 |
+
/* Section Styling */
|
| 38 |
+
h2 { font-size: 3rem; margin-bottom: 60px; text-align: center; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
|
| 39 |
+
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
|
| 40 |
+
.card { background: rgba(0, 0, 0, 0.4); padding: 40px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px); }
|
| 41 |
+
.card h3 { margin-bottom: 15px; color: #fff; font-size: 1.5rem; }
|
| 42 |
+
.card p { color: #eee; }
|
| 43 |
+
|
| 44 |
+
/* Table Styling */
|
| 45 |
+
.comparison-wrapper { overflow-x: auto; }
|
| 46 |
+
.comparison { width: 100%; border-collapse: collapse; margin-top: 30px; background: rgba(0, 0, 0, 0.4); border-radius: 16px; overflow: hidden; backdrop-filter: blur(10px); }
|
| 47 |
+
.comparison th, .comparison td { padding: 25px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: left; }
|
| 48 |
+
.comparison th { color: #fff; font-weight: 600; }
|
| 49 |
+
|
| 50 |
+
footer { padding: 50px 0; text-align: center; color: #fff; border-top: 1px solid rgba(255,255,255,0.1); }
|
| 51 |
+
</style>
|
| 52 |
+
</head>
|
| 53 |
+
<body>
|
| 54 |
+
|
| 55 |
+
<div class="bg-layer"></div>
|
| 56 |
+
|
| 57 |
+
<section class="hero container">
|
| 58 |
+
<div class="hero-text">
|
| 59 |
+
<h1>Pockit.</h1>
|
| 60 |
+
<p>Infinite storage for heavy assets, binaries, and production data. Built for developers who need more.</p>
|
| 61 |
+
<a href="login.html" class="btn">Get Started</a>
|
| 62 |
+
</div>
|
| 63 |
+
<div class="hero-image"><img src="screenshot.png" alt="Pockit Dashboard"></div>
|
| 64 |
+
</section>
|
| 65 |
+
|
| 66 |
+
<div class="container section-padding">
|
| 67 |
+
<h2>Workflow Optimized</h2>
|
| 68 |
+
<div class="grid">
|
| 69 |
+
<div class="card"><h3>Cold Storage Tiers</h3><p>Archive dormant assets for pennies. Instant retrieval, total reliability.</p></div>
|
| 70 |
+
<div class="card"><h3>Immutable History</h3><p>Every commit creates a unique hash. Roll back to any state in seconds.</p></div>
|
| 71 |
+
<div class="card"><h3>Global Edge Replication</h3><p>Your data lives everywhere. Low latency, high availability, no excuses.</p></div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>
|
| 74 |
+
|
| 75 |
+
<div class="container section-padding">
|
| 76 |
+
<h2>Performance Comparison</h2>
|
| 77 |
+
<div class="comparison-wrapper">
|
| 78 |
+
<table class="comparison">
|
| 79 |
+
<tr><th>Feature</th><th>Traditional Cloud</th><th>Pockit</th></tr>
|
| 80 |
+
<tr><td>Binary Performance</td><td>Standard</td><td>Optimized</td></tr>
|
| 81 |
+
<tr><td>CLI/API Access</td><td>Limited</td><td>Full Root/Dev Access</td></tr>
|
| 82 |
+
<tr><td>Latency</td><td>Variable</td><td>Global Edge-Synced</td></tr>
|
| 83 |
+
</table>
|
| 84 |
+
</div>
|
| 85 |
+
</div>
|
| 86 |
+
|
| 87 |
+
<footer class="container">
|
| 88 |
+
<p>© 2026 Pockit Storage Systems. Built for developers.</p>
|
| 89 |
+
</footer>
|
| 90 |
+
|
| 91 |
+
</body>
|
| 92 |
+
</html>
|
logic.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client@1.9.0/dist/index.min.js";
|
| 2 |
+
|
| 3 |
+
const loginForm = document.getElementById('loginForm');
|
| 4 |
+
const signupForm = document.getElementById('signupForm');
|
| 5 |
+
|
| 6 |
+
// Ensure overlay exists and setup
|
| 7 |
+
const loadingOverlay = document.getElementById('loadingOverlay');
|
| 8 |
+
if (loadingOverlay) {
|
| 9 |
+
loadingOverlay.style.display = 'none';
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
// Helper to toggle the loading overlay - PROPERLY
|
| 13 |
+
function setLoading(isLoading) {
|
| 14 |
+
const overlay = document.getElementById('loadingOverlay');
|
| 15 |
+
if (!overlay) {
|
| 16 |
+
console.error('Loading overlay element not found!');
|
| 17 |
+
return;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
if (isLoading) {
|
| 21 |
+
overlay.style.display = 'flex';
|
| 22 |
+
overlay.style.position = 'fixed';
|
| 23 |
+
overlay.style.top = '0';
|
| 24 |
+
overlay.style.left = '0';
|
| 25 |
+
overlay.style.width = '100%';
|
| 26 |
+
overlay.style.height = '100%';
|
| 27 |
+
overlay.style.backgroundColor = 'rgba(0, 0, 0, 0.6)';
|
| 28 |
+
overlay.style.backdropFilter = 'blur(5px)';
|
| 29 |
+
overlay.style.justifyContent = 'center';
|
| 30 |
+
overlay.style.alignItems = 'center';
|
| 31 |
+
overlay.style.zIndex = '9999';
|
| 32 |
+
} else {
|
| 33 |
+
overlay.style.display = 'none';
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// Registration Logic
|
| 38 |
+
if (signupForm) {
|
| 39 |
+
signupForm.addEventListener('submit', async (e) => {
|
| 40 |
+
e.preventDefault();
|
| 41 |
+
setLoading(true);
|
| 42 |
+
|
| 43 |
+
const user = document.getElementById('username').value;
|
| 44 |
+
const pass = document.getElementById('password').value;
|
| 45 |
+
|
| 46 |
+
try {
|
| 47 |
+
const client = await Client.connect("pockit-cloud/main");
|
| 48 |
+
const result = await client.predict("/create_user", {
|
| 49 |
+
user_id: user,
|
| 50 |
+
password: pass,
|
| 51 |
+
});
|
| 52 |
+
|
| 53 |
+
// Debug: log the result
|
| 54 |
+
console.log("/create_user result:", result.data);
|
| 55 |
+
|
| 56 |
+
let log = "";
|
| 57 |
+
if (typeof result.data === "string") {
|
| 58 |
+
log = result.data.toLowerCase();
|
| 59 |
+
} else if (Array.isArray(result.data)) {
|
| 60 |
+
log = result.data.map(x => String(x).toLowerCase()).join(" ");
|
| 61 |
+
} else if (typeof result.data === "object" && result.data !== null) {
|
| 62 |
+
log = JSON.stringify(result.data).toLowerCase();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
if (log.includes("success") || log.includes("user created")) {
|
| 66 |
+
sessionStorage.setItem("pockit_user", user);
|
| 67 |
+
sessionStorage.setItem("pockit_pass", pass);
|
| 68 |
+
window.location.href = "dashboard.html"; // Success redirect
|
| 69 |
+
} else {
|
| 70 |
+
alert("Error: " + (typeof result.data === "object" ? JSON.stringify(result.data) : result.data));
|
| 71 |
+
setLoading(false);
|
| 72 |
+
}
|
| 73 |
+
} catch (err) {
|
| 74 |
+
console.error(err);
|
| 75 |
+
setLoading(false);
|
| 76 |
+
}
|
| 77 |
+
});
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// Login Logic
|
| 81 |
+
if (loginForm) {
|
| 82 |
+
loginForm.addEventListener('submit', async (e) => {
|
| 83 |
+
e.preventDefault();
|
| 84 |
+
setLoading(true);
|
| 85 |
+
|
| 86 |
+
const user = document.getElementById('username').value;
|
| 87 |
+
const pass = document.getElementById('password').value;
|
| 88 |
+
|
| 89 |
+
try {
|
| 90 |
+
const client = await Client.connect("pockit-cloud/main");
|
| 91 |
+
const result = await client.predict("/get_files_secure", {
|
| 92 |
+
user_id: user,
|
| 93 |
+
password: pass,
|
| 94 |
+
});
|
| 95 |
+
|
| 96 |
+
// Status message is at index 1 for get_files_secure
|
| 97 |
+
const status = result.data[1].toLowerCase();
|
| 98 |
+
|
| 99 |
+
if (status.includes("found") || status.includes("success")) {
|
| 100 |
+
sessionStorage.setItem("pockit_user", user);
|
| 101 |
+
sessionStorage.setItem("pockit_pass", pass);
|
| 102 |
+
window.location.href = "dashboard.html"; // Success redirect
|
| 103 |
+
} else {
|
| 104 |
+
alert("Login failed: " + result.data[1]);
|
| 105 |
+
setLoading(false);
|
| 106 |
+
}
|
| 107 |
+
} catch (err) {
|
| 108 |
+
console.error(err);
|
| 109 |
+
alert("Connection error.");
|
| 110 |
+
setLoading(false);
|
| 111 |
+
}
|
| 112 |
+
});
|
| 113 |
+
}
|
login.html
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Sign In with Pockit ID</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css" />
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="loadingOverlay" class="loading-overlay"></div>
|
| 11 |
+
<section>
|
| 12 |
+
<div class="login-box">
|
| 13 |
+
<form id="loginForm">
|
| 14 |
+
<h2>Sign In with Pockit ID</h2>
|
| 15 |
+
<div class="input-box">
|
| 16 |
+
<span class="icon"><ion-icon name="mail"></ion-icon> </span>
|
| 17 |
+
<input type="text" id="username" required>
|
| 18 |
+
<label> Username</label>
|
| 19 |
+
</div>
|
| 20 |
+
<div class="input-box">
|
| 21 |
+
<span class="icon"><ion-icon name="lock-closed"></ion-icon> </span>
|
| 22 |
+
<input type="password" id="password" required>
|
| 23 |
+
<label> Password</label>
|
| 24 |
+
</div>
|
| 25 |
+
<div class="remember-forget">
|
| 26 |
+
<a href="#">Forget Password</a>
|
| 27 |
+
</div>
|
| 28 |
+
<button type="submit">Login</button>
|
| 29 |
+
<div class="register-link">
|
| 30 |
+
<p>Don't have an account? <a href="sign-up.html">Register</a></p>
|
| 31 |
+
</div>
|
| 32 |
+
</form>
|
| 33 |
+
</div>
|
| 34 |
+
</section>
|
| 35 |
+
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
|
| 36 |
+
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
| 37 |
+
<script type="module" src="logic.js"></script>
|
| 38 |
+
</body>
|
| 39 |
+
</html>
|
logo.png
ADDED
|
screenshot.png
ADDED
|
Git LFS Details
|
sign-up.html
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>Register - Pockit ID</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css" />
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="loadingOverlay" class="loading-overlay"></div>
|
| 11 |
+
<section>
|
| 12 |
+
<div class="login-box">
|
| 13 |
+
<form id="signupForm">
|
| 14 |
+
<h2>Create a Pockit ID</h2>
|
| 15 |
+
<div class="input-box">
|
| 16 |
+
<span class="icon"><ion-icon name="mail"></ion-icon> </span>
|
| 17 |
+
<input type="text" id="username" required>
|
| 18 |
+
<label> Username</label>
|
| 19 |
+
</div>
|
| 20 |
+
<div class="input-box">
|
| 21 |
+
<span class="icon"><ion-icon name="lock-closed"></ion-icon> </span>
|
| 22 |
+
<input type="password" id="password" required>
|
| 23 |
+
<label> Password</label>
|
| 24 |
+
</div>
|
| 25 |
+
<button type="submit">Register</button>
|
| 26 |
+
<div class="register-link">
|
| 27 |
+
<p>Already have an account? <a href="index.html">Login</a></p>
|
| 28 |
+
</div>
|
| 29 |
+
</form>
|
| 30 |
+
</div>
|
| 31 |
+
</section>
|
| 32 |
+
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
|
| 33 |
+
<script nomodule src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"></script>
|
| 34 |
+
<script type="module" src="logic.js"></script>
|
| 35 |
+
</body>
|
| 36 |
+
</html>
|
style.css
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ===( CODE AASHU )=== */
|
| 2 |
+
*{
|
| 3 |
+
margin: 0;
|
| 4 |
+
padding: 0;
|
| 5 |
+
box-sizing: border-box;
|
| 6 |
+
font-family: 'Poppins', sans-serif;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
section{
|
| 10 |
+
display: flex;
|
| 11 |
+
justify-content: center;
|
| 12 |
+
align-items: center;
|
| 13 |
+
width: 100%;
|
| 14 |
+
height: 100vh;
|
| 15 |
+
background-image: url(bg.jpg);
|
| 16 |
+
background-size: cover;
|
| 17 |
+
background-position: center;
|
| 18 |
+
animation: animateBg 5s linear infinite;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
@keyframes animateBg{
|
| 22 |
+
100%{
|
| 23 |
+
filter: hue-rotate(360deg);
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.login-box{
|
| 28 |
+
position: relative;
|
| 29 |
+
width: 400px;
|
| 30 |
+
height: 450px;
|
| 31 |
+
background: transparent;
|
| 32 |
+
border: 2px solid rgba(255, 255, 255, .5);
|
| 33 |
+
border-radius: 20px;
|
| 34 |
+
display: flex;
|
| 35 |
+
justify-content: center;
|
| 36 |
+
align-items: center;
|
| 37 |
+
backdrop-filter: blur(15px);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
h2{
|
| 41 |
+
font-size: 2em;
|
| 42 |
+
color: #fff;
|
| 43 |
+
text-align: center;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.input-box{
|
| 47 |
+
position: relative;
|
| 48 |
+
width: 310px;
|
| 49 |
+
margin: 30px 0;
|
| 50 |
+
border-bottom: 2px solid #fff;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
.input-box label{
|
| 54 |
+
position: absolute;
|
| 55 |
+
top: 50%;
|
| 56 |
+
left: 5px;
|
| 57 |
+
transform: translateY(-50%);
|
| 58 |
+
font-size: 1em;
|
| 59 |
+
color: #fff;
|
| 60 |
+
pointer-events: none;
|
| 61 |
+
transition: .5s;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
.input-box input:focus~label,
|
| 65 |
+
.input-box input:valid~label{
|
| 66 |
+
top: -5px;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
.input-box input{
|
| 70 |
+
width: 100%;
|
| 71 |
+
height: 50px;
|
| 72 |
+
background: transparent;
|
| 73 |
+
border: none;
|
| 74 |
+
outline: none;
|
| 75 |
+
font-size: 1em;
|
| 76 |
+
color: #fff;
|
| 77 |
+
padding: 0 35px 0 5px;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.input-box .icon{
|
| 81 |
+
position: absolute;
|
| 82 |
+
right: 8px;
|
| 83 |
+
color: #fff;
|
| 84 |
+
font-size: 1.2em;
|
| 85 |
+
line-height: 57px;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.remember-forget{
|
| 89 |
+
margin: -15px 0 15px;
|
| 90 |
+
font-size: .9em;
|
| 91 |
+
color: #fff;
|
| 92 |
+
display: flex;
|
| 93 |
+
justify-content: space-between;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.remember-forget label input{
|
| 97 |
+
margin-right: 3px;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.remember-forget a{
|
| 101 |
+
color: #fff;
|
| 102 |
+
text-decoration: none;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.remember-forget a:hover{
|
| 106 |
+
text-decoration: underline;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
button{
|
| 110 |
+
width: 100%;
|
| 111 |
+
height: 40px;
|
| 112 |
+
background: #fff;
|
| 113 |
+
border: none;
|
| 114 |
+
outline: none;
|
| 115 |
+
border-radius: 40px;
|
| 116 |
+
cursor: pointer;
|
| 117 |
+
font-size: 1em;
|
| 118 |
+
color: #000;
|
| 119 |
+
font-weight: 500;
|
| 120 |
+
display: flex;
|
| 121 |
+
justify-content: center;
|
| 122 |
+
align-items: center;
|
| 123 |
+
transition: background 0.3s;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/* === LOADING STATE STYLES === */
|
| 127 |
+
|
| 128 |
+
/* Dark blur overlay for loading state */
|
| 129 |
+
.loading-overlay {
|
| 130 |
+
position: fixed;
|
| 131 |
+
top: 0;
|
| 132 |
+
left: 0;
|
| 133 |
+
width: 100%;
|
| 134 |
+
height: 100%;
|
| 135 |
+
background: rgba(0, 0, 0, 0.6);
|
| 136 |
+
backdrop-filter: blur(5px);
|
| 137 |
+
display: none;
|
| 138 |
+
justify-content: center;
|
| 139 |
+
align-items: center;
|
| 140 |
+
z-index: 9999;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
.loading-overlay.active {
|
| 144 |
+
display: flex;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
.register-link{
|
| 148 |
+
font-size: .9em;
|
| 149 |
+
color: #fff;
|
| 150 |
+
text-align: center;
|
| 151 |
+
margin: 25px 0 10px;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.register-link p a{
|
| 155 |
+
color: #fff;
|
| 156 |
+
text-decoration: none;
|
| 157 |
+
font-weight: 600;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.register-link p a:hover{
|
| 161 |
+
text-decoration: underline;
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
@media (max-width:360px){
|
| 165 |
+
.login-box{
|
| 166 |
+
width: 100%;
|
| 167 |
+
height: 100vh;
|
| 168 |
+
border: none;
|
| 169 |
+
border-radius: 0;
|
| 170 |
+
}
|
| 171 |
+
.input-box{
|
| 172 |
+
width: 290px;
|
| 173 |
+
}
|
| 174 |
+
}
|