Build HTMX server app

This commit is contained in:
sas.fajri
2026-04-13 14:53:20 +07:00
parent a631331e94
commit d34d70ef2e
4 changed files with 2865 additions and 0 deletions

34
README.md Normal file
View File

@@ -0,0 +1,34 @@
# DocLink Web
Server-rendered rebuild of the DocLink web app, following the structure in `project-specs/`.
## Stack
- Node.js HTTP server
- HTMX for partial updates
- Custom responsive CSS
- Upstream API adapter for auth, order, result, FPP, password change, and special message flows
## Run
```bash
npm start
```
Open:
```text
http://localhost:5173
```
## Notes
- Login calls the upstream API from `project-specs/API_ENDPOINTS.md`.
- If the upstream login rejects the credentials or is unavailable, demo mode creates a local session so the UI can still be exercised.
- Order search, order detail helpers, FPP loading, password change, and special message save are wired through the API adapter with mock fallback for local preview.
## Main Files
- `server.js`
- `styles.css`
- `package.json`

10
package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"name": "doclink-web",
"version": "1.0.0",
"private": true,
"type": "module",
"scripts": {
"start": "node server.js",
"dev": "node server.js"
}
}

1903
server.js Normal file

File diff suppressed because it is too large Load Diff

918
styles.css Normal file
View File

@@ -0,0 +1,918 @@
:root {
color-scheme: light;
--bg: #f4f5f7;
--bg-soft: #eef2f5;
--surface: rgba(255, 255, 255, 0.82);
--surface-strong: #ffffff;
--line: rgba(15, 23, 42, 0.1);
--text: #122033;
--muted: #5b6677;
--muted-2: #7c8797;
--brand: #0f766e;
--brand-strong: #115e59;
--accent: #d97706;
--accent-soft: #fff4e6;
--success: #15803d;
--warning: #b45309;
--danger: #b91c1c;
--shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.14);
--shadow-md: 0 12px 28px rgba(15, 23, 42, 0.12);
--radius-xl: 28px;
--radius-lg: 22px;
--radius-md: 16px;
--radius-sm: 12px;
--nav-width: 290px;
--content-max: 1440px;
--gap: 22px;
--font: "Avenir Next", "Nunito Sans", "Segoe UI", system-ui, sans-serif;
}
* {
box-sizing: border-box;
}
html,
body {
min-height: 100%;
}
body {
margin: 0;
font-family: var(--font);
color: var(--text);
background:
radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 28%),
radial-gradient(circle at bottom right, rgba(217, 119, 6, 0.07), transparent 28%),
linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}
a {
color: inherit;
text-decoration: none;
}
button,
input,
select,
textarea {
font: inherit;
}
button {
cursor: pointer;
}
.bg-orb,
.bg-grid {
pointer-events: none;
position: fixed;
inset: auto;
z-index: 0;
}
.bg-orb {
width: 28rem;
height: 28rem;
border-radius: 999px;
filter: blur(32px);
opacity: 0.42;
}
.orb-one {
top: -9rem;
left: -8rem;
background: rgba(15, 118, 110, 0.18);
}
.orb-two {
right: -10rem;
bottom: 3rem;
background: rgba(217, 119, 6, 0.14);
}
.bg-grid {
inset: 0;
opacity: 0.26;
background-image:
linear-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px),
linear-gradient(90deg, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
background-size: 42px 42px;
mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 88%);
}
#app {
position: relative;
z-index: 1;
min-height: 100vh;
}
.page-shell {
min-height: 100vh;
display: grid;
grid-template-columns: var(--nav-width) minmax(0, 1fr);
}
.sidebar {
position: sticky;
top: 0;
height: 100vh;
padding: 18px;
border-right: 1px solid var(--line);
background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.72));
backdrop-filter: blur(22px);
}
.sidebar-card {
height: 100%;
display: flex;
flex-direction: column;
gap: 18px;
padding: 20px;
border-radius: var(--radius-xl);
background: var(--surface);
border: 1px solid rgba(255, 255, 255, 0.7);
box-shadow: var(--shadow-lg);
}
.brand {
display: flex;
align-items: center;
gap: 12px;
}
.brand-mark {
width: 46px;
height: 46px;
border-radius: 16px;
display: grid;
place-items: center;
font-weight: 800;
letter-spacing: 0.05em;
color: white;
background:
radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 38%),
linear-gradient(135deg, var(--brand), var(--brand-strong));
box-shadow: 0 14px 24px rgba(15, 118, 110, 0.26);
}
.brand-text strong {
display: block;
font-size: 1rem;
line-height: 1.1;
}
.brand-text span {
display: block;
color: var(--muted);
font-size: 0.85rem;
}
.nav-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.nav-label {
margin: 12px 10px 6px;
color: var(--muted-2);
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.14em;
}
.nav-link {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 12px 14px;
border-radius: 14px;
color: var(--muted);
transition:
transform 160ms ease,
background 160ms ease,
color 160ms ease;
}
.nav-link:hover {
transform: translateX(2px);
background: rgba(15, 118, 110, 0.08);
color: var(--text);
}
.nav-link.active {
color: white;
background: linear-gradient(135deg, var(--brand), #0f9488);
box-shadow: 0 12px 24px rgba(15, 118, 110, 0.24);
}
.nav-link small {
color: inherit;
opacity: 0.72;
}
.sidebar-footer {
margin-top: auto;
padding: 16px;
border-radius: 18px;
background: linear-gradient(135deg, rgba(255, 247, 237, 0.95), rgba(236, 253, 245, 0.9));
border: 1px solid rgba(217, 119, 6, 0.12);
}
.sidebar-footer strong {
display: block;
margin-bottom: 6px;
}
.sidebar-footer p {
margin: 0;
color: var(--muted);
font-size: 0.92rem;
line-height: 1.5;
}
.content {
min-width: 0;
padding: 24px;
}
.content-inner {
max-width: var(--content-max);
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 20px;
}
.topbar {
display: flex;
align-items: center;
gap: 16px;
padding: 18px 20px;
border-radius: var(--radius-xl);
background: var(--surface);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.7);
box-shadow: var(--shadow-md);
}
.topbar-main {
min-width: 0;
flex: 1;
}
.eyebrow {
color: var(--brand);
text-transform: uppercase;
letter-spacing: 0.16em;
font-size: 0.74rem;
font-weight: 700;
margin-bottom: 4px;
}
.page-title {
margin: 0;
font-size: clamp(1.35rem, 2vw, 2rem);
line-height: 1.15;
}
.page-subtitle {
margin: 6px 0 0;
color: var(--muted);
line-height: 1.5;
}
.topbar-actions {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
}
.search {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 14px;
min-width: 280px;
border-radius: 16px;
background: rgba(255, 255, 255, 0.92);
border: 1px solid var(--line);
}
.search input {
width: 100%;
border: 0;
outline: none;
background: transparent;
color: var(--text);
}
.icon-btn,
.btn {
border: 0;
border-radius: 14px;
transition:
transform 160ms ease,
box-shadow 160ms ease,
background 160ms ease;
}
.icon-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
background: rgba(255, 255, 255, 0.92);
border: 1px solid var(--line);
}
.btn {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 12px 16px;
font-weight: 700;
}
.btn:hover,
.icon-btn:hover {
transform: translateY(-1px);
}
.btn-primary {
color: white;
background: linear-gradient(135deg, var(--brand), #0f9488);
box-shadow: 0 14px 26px rgba(15, 118, 110, 0.22);
}
.btn-secondary {
color: var(--text);
background: white;
border: 1px solid var(--line);
}
.btn-ghost {
color: var(--muted);
background: rgba(255, 255, 255, 0.78);
border: 1px solid transparent;
}
.panel {
padding: 20px;
border-radius: var(--radius-xl);
background: var(--surface);
backdrop-filter: blur(20px);
border: 1px solid rgba(255, 255, 255, 0.72);
box-shadow: var(--shadow-md);
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 16px;
margin-bottom: 16px;
}
.panel-header h2,
.panel-header h3 {
margin: 0;
}
.panel-header p {
margin: 6px 0 0;
color: var(--muted);
}
.grid {
display: grid;
gap: 18px;
}
.grid-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.card {
padding: 18px;
border-radius: 22px;
background: rgba(255, 255, 255, 0.86);
border: 1px solid rgba(15, 23, 42, 0.06);
}
.metric {
display: flex;
flex-direction: column;
gap: 10px;
min-height: 150px;
}
.metric .kicker {
display: flex;
align-items: center;
justify-content: space-between;
color: var(--muted);
font-size: 0.88rem;
}
.metric strong {
font-size: clamp(1.8rem, 2.2vw, 2.65rem);
letter-spacing: -0.04em;
}
.metric .trend {
display: inline-flex;
align-items: center;
gap: 8px;
color: var(--success);
font-size: 0.88rem;
font-weight: 700;
}
.pill-row {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.pill {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 13px;
border-radius: 999px;
border: 1px solid rgba(15, 23, 42, 0.08);
background: rgba(255, 255, 255, 0.88);
color: var(--muted);
font-size: 0.88rem;
}
.pill.active {
color: var(--brand-strong);
background: rgba(15, 118, 110, 0.08);
border-color: rgba(15, 118, 110, 0.18);
}
.list {
display: flex;
flex-direction: column;
gap: 12px;
}
.table-wrap {
overflow: auto;
border-radius: 20px;
border: 1px solid rgba(15, 23, 42, 0.08);
}
table {
width: 100%;
border-collapse: collapse;
min-width: 860px;
background: rgba(255, 255, 255, 0.88);
}
th,
td {
padding: 14px 16px;
border-bottom: 1px solid rgba(15, 23, 42, 0.06);
text-align: left;
vertical-align: top;
}
th {
color: var(--muted);
font-size: 0.82rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
background: rgba(248, 250, 252, 0.98);
}
tr:last-child td {
border-bottom: 0;
}
.status {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 7px 11px;
border-radius: 999px;
font-size: 0.84rem;
font-weight: 700;
}
.status::before {
content: "";
width: 8px;
height: 8px;
border-radius: 999px;
background: currentColor;
}
.status.success {
color: var(--success);
background: rgba(21, 128, 61, 0.08);
}
.status.warning {
color: var(--warning);
background: rgba(180, 83, 9, 0.09);
}
.status.danger {
color: var(--danger);
background: rgba(185, 28, 28, 0.09);
}
.status.neutral {
color: var(--muted);
background: rgba(15, 23, 42, 0.06);
}
.detail-grid {
display: grid;
grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
gap: 20px;
}
.mini-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.mini-item {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 14px;
padding: 14px 15px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.84);
border: 1px solid rgba(15, 23, 42, 0.06);
}
.mini-item strong {
display: block;
margin-bottom: 4px;
}
.mini-item p {
margin: 0;
color: var(--muted);
font-size: 0.9rem;
}
.stack {
display: flex;
flex-direction: column;
gap: 18px;
}
.form {
display: grid;
gap: 16px;
}
.field {
display: grid;
gap: 8px;
}
.field label {
font-weight: 700;
font-size: 0.92rem;
}
.field input,
.field select,
.field textarea {
width: 100%;
padding: 13px 14px;
border-radius: 14px;
border: 1px solid rgba(15, 23, 42, 0.12);
background: rgba(255, 255, 255, 0.9);
color: var(--text);
outline: none;
}
.field textarea {
min-height: 120px;
resize: vertical;
}
.field small {
color: var(--muted);
}
.field-inline {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.stepper {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.step {
flex: 1 1 160px;
padding: 14px;
border-radius: 16px;
border: 1px solid rgba(15, 23, 42, 0.08);
background: rgba(255, 255, 255, 0.82);
}
.step.active {
background: rgba(15, 118, 110, 0.08);
border-color: rgba(15, 118, 110, 0.18);
}
.step strong {
display: block;
}
.step span {
display: block;
margin-top: 4px;
color: var(--muted);
font-size: 0.88rem;
}
.note-box {
padding: 16px 18px;
border-radius: 18px;
background: linear-gradient(135deg, rgba(255, 247, 237, 0.85), rgba(240, 253, 250, 0.9));
border: 1px solid rgba(217, 119, 6, 0.12);
color: var(--text);
}
.auth-screen {
min-height: 100vh;
display: grid;
place-items: center;
padding: 24px;
}
.auth-card {
width: min(1080px, 100%);
display: grid;
grid-template-columns: 1.1fr 0.9fr;
border-radius: 34px;
overflow: hidden;
background: rgba(255, 255, 255, 0.84);
border: 1px solid rgba(255, 255, 255, 0.68);
box-shadow: var(--shadow-lg);
}
.auth-visual {
padding: 32px;
color: white;
background:
radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 30%),
linear-gradient(135deg, #0f766e, #0f9488 52%, #115e59);
}
.auth-visual .badge {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 12px;
border-radius: 999px;
background: rgba(255, 255, 255, 0.16);
border: 1px solid rgba(255, 255, 255, 0.16);
margin-bottom: 24px;
font-size: 0.9rem;
}
.auth-visual h1 {
margin: 0;
font-size: clamp(2rem, 5vw, 4rem);
line-height: 1;
}
.auth-visual p {
max-width: 42ch;
font-size: 1.02rem;
line-height: 1.7;
opacity: 0.92;
}
.auth-points {
margin-top: 32px;
display: grid;
gap: 14px;
}
.auth-point {
padding: 14px 16px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.12);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.auth-form {
padding: 32px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 18px;
}
.auth-form h2 {
margin: 0;
font-size: 1.9rem;
}
.muted {
color: var(--muted);
}
.empty-state {
padding: 30px;
text-align: center;
border-radius: 24px;
background: rgba(255, 255, 255, 0.86);
border: 1px dashed rgba(15, 23, 42, 0.14);
}
.empty-state p {
color: var(--muted);
margin: 8px 0 0;
}
.mobile-nav {
display: none;
position: sticky;
bottom: 0;
z-index: 10;
padding: 12px 14px 18px;
background: linear-gradient(180deg, rgba(244, 245, 247, 0.08), rgba(244, 245, 247, 0.96) 28%);
}
.mobile-nav-inner {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 8px;
padding: 10px;
border-radius: 22px;
background: rgba(255, 255, 255, 0.82);
border: 1px solid rgba(15, 23, 42, 0.08);
box-shadow: var(--shadow-md);
backdrop-filter: blur(22px);
}
.mobile-nav .nav-link {
flex-direction: column;
justify-content: center;
gap: 4px;
padding: 11px 8px;
font-size: 0.78rem;
text-align: center;
}
.mobile-nav .nav-link small {
display: none;
}
.shell-footer {
display: none;
}
.hidden {
display: none !important;
}
.desktop-only {
display: block;
}
.mobile-only {
display: none;
}
@media (max-width: 1180px) {
.grid-4,
.grid-3 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-grid,
.auth-card {
grid-template-columns: 1fr;
}
}
@media (max-width: 860px) {
.page-shell {
grid-template-columns: 1fr;
}
.sidebar {
display: none;
}
.content {
padding: 16px 14px 0;
}
.topbar {
flex-direction: column;
align-items: stretch;
}
.topbar-actions {
justify-content: space-between;
}
.search {
min-width: 0;
}
.mobile-nav {
display: block;
}
.grid-4,
.grid-3,
.grid-2,
.field-inline {
grid-template-columns: 1fr;
}
.desktop-only {
display: none;
}
.mobile-only {
display: grid;
gap: 12px;
}
.panel,
.topbar {
border-radius: 22px;
}
.auth-screen {
padding: 12px;
}
}
@media (max-width: 620px) {
.content {
padding: 12px 10px 0;
}
.content-inner {
gap: 14px;
}
.panel,
.topbar,
.auth-form,
.auth-visual {
padding: 16px;
}
.mobile-nav-inner {
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 4px;
padding: 8px;
}
.btn {
width: 100%;
justify-content: center;
}
.topbar-actions {
flex-direction: column;
align-items: stretch;
}
.btn,
.icon-btn,
.search {
width: 100%;
}
.table-wrap {
border-radius: 18px;
}
}