This commit is contained in:
2025-10-09 22:16:29 +02:00
commit 768f8cb21c
33 changed files with 12047 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
node_modules
/dist
/.env.local
+43
View File
@@ -0,0 +1,43 @@
# Paperless-NEO Frontend
A minimal Webpack-powered SPA to interact with the Paperless-NEO Milestone 1 backend.
## Prerequisites
- Node.js 18+
- Backend API running locally on `http://127.0.0.1:3000`
## Setup
```bash
cd frontend
npm install
```
## Development
```bash
npm run dev
```
- Starts `webpack-dev-server` on <http://localhost:5173>
- Proxies `/api` requests to the backend (no CORS needed)
- Edit files in `src/` and the browser reloads automatically
## Production Build
```bash
npm run build
```
- Output written to `dist/`
- Set `API_BASE_URL` in `.env.local` if the API is not served from the same origin.
## Features
- Finder-style layout: folder tree, document table, and detail pane with metadata & tags
- Drag-and-drop moves (documents between folders) and file uploads (window-wide or onto a folder)
- Search box plus tag chips filter documents across the selected folder and all descendants
- Tag management (create/assign/remove) from the detail panel
- Login via the seeded admin account (`admin` / `adminadmin`) with stored JWT session
- Inline status banner for quick feedback on API interactions
+4855
View File
File diff suppressed because it is too large Load Diff
+23
View File
@@ -0,0 +1,23 @@
{
"name": "paperless-neo-frontend",
"version": "0.1.0",
"private": true,
"description": "Rudimentary Webpack SPA for Paperless-NEO Milestone 1",
"scripts": {
"dev": "webpack serve --mode development --open",
"build": "webpack --mode production",
"lint": "echo \"No linting configured\""
},
"dependencies": {
"axios": "1.7.7"
},
"devDependencies": {
"css-loader": "7.1.2",
"dotenv": "16.4.5",
"html-webpack-plugin": "5.6.3",
"style-loader": "4.0.0",
"webpack": "5.95.0",
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.1.0"
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Paperless-NEO</title>
</head>
<body>
<main id="app"></main>
</body>
</html>
File diff suppressed because it is too large Load Diff
+469
View File
@@ -0,0 +1,469 @@
:root {
color-scheme: light dark;
--bg: #f3f4f6;
--surface: rgba(255, 255, 255, 0.9);
--surface-strong: rgba(255, 255, 255, 0.95);
--fg: #1f2937;
--muted: #6b7280;
--border: #d1d5db;
--accent: #2563eb;
--accent-soft: rgba(37, 99, 235, 0.12);
--accent-strong: rgba(37, 99, 235, 0.2);
--danger: #dc2626;
--success: #10b981;
font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body {
margin: 0;
background: var(--bg);
color: var(--fg);
}
#app {
min-height: 100vh;
display: flex;
flex-direction: column;
padding: 2rem clamp(1rem, 3vw, 3rem);
box-sizing: border-box;
}
header.global-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.5rem;
gap: 1rem;
}
header.global-header h1 {
margin: 0;
font-size: 1.9rem;
}
button {
font: inherit;
border-radius: 8px;
border: none;
padding: 0.55rem 1.1rem;
background: var(--accent);
color: white;
cursor: pointer;
transition: transform 0.1s ease, box-shadow 0.15s ease;
}
button[disabled] {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
button:hover:not([disabled]) {
transform: translateY(-1px);
box-shadow: 0 10px 20px var(--accent-strong);
}
button.secondary {
background: transparent;
color: var(--accent);
border: 1px solid var(--accent);
}
button.danger {
background: var(--danger);
color: #fff;
box-shadow: none;
}
button.danger:hover:not([disabled]) {
box-shadow: 0 8px 16px rgba(220, 38, 38, 0.2);
}
button.icon-button {
padding: 0.35rem 0.65rem;
min-width: auto;
}
button.icon-button:hover:not([disabled]) {
transform: none;
}
.dashboard-layout {
display: grid;
grid-template-columns: 260px minmax(0, 1fr) 320px;
gap: 1.5rem;
align-items: start;
flex: 1;
}
.sidebar,
.table-panel,
.detail-panel {
background: var(--surface);
border-radius: 16px;
padding: 1.25rem;
box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
backdrop-filter: blur(14px);
}
.sidebar {
position: relative;
min-height: calc(100vh - 6rem);
}
.sidebar h2,
.table-panel h2,
.detail-panel h2 {
margin: 0 0 1rem;
font-size: 1.1rem;
}
.folder-tree {
list-style: none;
margin: 0;
padding: 0;
}
.folder-node {
margin: 0;
}
.folder-row {
display: flex;
align-items: center;
gap: 0.55rem;
padding: 0.4rem 0.55rem;
border-radius: 8px;
cursor: pointer;
color: var(--fg);
}
.folder-row span.name {
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.folder-row:hover {
background: var(--accent-soft);
}
.folder-row.active {
background: var(--accent);
color: white;
}
.folder-row .toggle {
width: 1.1rem;
text-align: center;
font-size: 0.9rem;
user-select: none;
}
.folder-row .toggle.invisible {
visibility: hidden;
}
.folder-children {
list-style: none;
margin: 0 0 0 1rem;
padding: 0;
}
.folder-row.is-drop-target {
outline: 2px dashed var(--accent);
outline-offset: 2px;
}
.table-panel {
overflow: hidden;
}
.table-panel header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 0.8rem;
gap: 1rem;
}
.header-actions {
display: flex;
gap: 0.5rem;
}
.table-panel table {
width: 100%;
border-collapse: collapse;
font-size: 0.95rem;
}
.table-panel thead {
background: var(--accent-soft);
}
.table-panel th,
.table-panel td {
padding: 0.65rem 0.75rem;
text-align: left;
border-bottom: 1px solid var(--border);
}
.table-panel th.actions-column,
.table-panel td.actions {
width: 1%;
white-space: nowrap;
}
.table-panel tbody tr {
background: var(--surface-strong);
transition: background 0.15s ease;
}
.table-panel tbody tr:nth-child(every) {
background: var(--surface-strong);
}
.table-panel tbody tr:hover {
background: rgba(37, 99, 235, 0.08);
}
.table-panel tbody tr.folder {
cursor: pointer;
font-weight: 600;
}
.table-panel tbody tr.document {
cursor: pointer;
}
.table-panel tbody tr.document.selected {
background: rgba(37, 99, 235, 0.2);
}
.table-panel tbody tr.document.dragging {
opacity: 0.4;
}
.filter-bar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.6rem;
margin-bottom: 1rem;
}
.filter-bar input[type='search'] {
flex: 1;
min-width: 220px;
}
.tag-filters {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
}
.tag-filter {
border: 1px solid var(--accent);
background: transparent;
color: var(--accent);
padding: 0.3rem 0.7rem;
border-radius: 999px;
cursor: pointer;
font-size: 0.85rem;
transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tag-filter:hover {
box-shadow: 0 8px 16px var(--accent-strong);
}
.tag-filter.active {
background: var(--accent);
color: white;
}
.filter-actions {
display: flex;
gap: 0.4rem;
}
.search-hint {
margin-top: 0.75rem;
font-size: 0.85rem;
color: var(--muted);
}
.badge {
display: inline-flex;
align-items: center;
padding: 0.15rem 0.5rem;
border-radius: 999px;
background: var(--accent-soft);
color: var(--accent);
font-size: 0.75rem;
margin-right: 0.35rem;
}
.empty-state {
border: 2px dashed var(--border);
border-radius: 12px;
text-align: center;
padding: 2.5rem 1rem;
color: var(--muted);
margin-top: 1.5rem;
}
.detail-panel {
position: relative;
min-height: calc(100vh - 6rem);
display: flex;
flex-direction: column;
gap: 1rem;
}
.detail-panel .meta {
font-size: 0.9rem;
color: var(--muted);
}
.detail-panel dl {
margin: 0;
}
.detail-panel dt {
font-weight: 600;
margin-top: 0.8rem;
}
.detail-panel dd {
margin: 0.2rem 0 0;
}
.detail-panel .tag-list {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-top: 0.6rem;
}
.tag-pill {
display: inline-flex;
align-items: center;
gap: 0.4rem;
background: var(--accent-soft);
color: var(--accent);
padding: 0.2rem 0.55rem;
border-radius: 999px;
font-size: 0.8rem;
}
.tag-pill button {
background: none;
border: none;
color: inherit;
padding: 0;
cursor: pointer;
font-size: 0.85rem;
}
input,
textarea,
select {
font: inherit;
border-radius: 8px;
border: 1px solid var(--border);
padding: 0.55rem 0.6rem;
background: var(--surface-strong);
color: inherit;
width: 100%;
box-sizing: border-box;
}
textarea {
resize: vertical;
}
form.inline {
display: flex;
gap: 0.5rem;
margin-top: 0.75rem;
}
.status-banner {
padding: 0.6rem 1rem;
border-radius: 10px;
font-size: 0.9rem;
margin-bottom: 1rem;
}
.status-banner.info {
background: rgba(107, 114, 128, 0.12);
color: var(--muted);
}
.status-banner.success {
background: rgba(16, 185, 129, 0.15);
color: var(--success);
}
.status-banner.error {
background: rgba(220, 38, 38, 0.15);
color: var(--danger);
}
.drop-overlay {
position: fixed;
inset: 0;
background: rgba(37, 99, 235, 0.25);
backdrop-filter: blur(8px);
display: none;
align-items: center;
justify-content: center;
z-index: 9999;
}
.drop-overlay.active {
display: flex;
}
.drop-overlay__content {
background: rgba(17, 24, 39, 0.85);
color: white;
padding: 2rem 3rem;
border-radius: 20px;
text-align: center;
font-size: 1.2rem;
box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}
@media (max-width: 1080px) {
.dashboard-layout {
grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
grid-template-rows: auto auto;
}
.detail-panel {
grid-column: 1 / -1;
}
}
@media (max-width: 768px) {
#app {
padding: 1.5rem 1rem 4rem;
}
header.global-header {
flex-direction: column;
align-items: flex-start;
}
.dashboard-layout {
grid-template-columns: 1fr;
}
.sidebar,
.table-panel,
.detail-panel {
min-height: auto;
}
}
+52
View File
@@ -0,0 +1,52 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const dotenv = require('dotenv');
const env = dotenv.config({ path: path.resolve(__dirname, '.env.local') }).parsed || {};
const API_BASE_URL =
env.API_BASE_URL || process.env.API_BASE_URL || 'http://127.0.0.1:3000';
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.[contenthash].js',
path: path.resolve(__dirname, 'dist'),
clean: true,
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
favicon: false,
}),
new webpack.DefinePlugin({
'process.env.API_BASE_URL': JSON.stringify(API_BASE_URL),
}),
],
devServer: {
static: {
directory: path.join(__dirname, 'public'),
},
compress: true,
port: 5173,
historyApiFallback: true,
open: true,
proxy: [
{
context: ['/api'],
target: API_BASE_URL,
changeOrigin: true,
},
],
},
devtool: 'source-map',
};