Embed U-Navigator in Dynamix

This commit is contained in:
Mikei386
2026-06-22 22:21:49 +02:00
parent 92434a945d
commit ae5e192eac
15 changed files with 353 additions and 214 deletions
+10 -5
View File
@@ -1,5 +1,6 @@
const workspace = document.querySelector('#workspace');
const statusText = document.querySelector('#statusText');
const API_BASE = window.UNAV_API_BASE || '/api';
const state = {
config: null,
windows: [],
@@ -25,7 +26,7 @@ init();
async function init() {
try {
state.config = await api('/api/config');
state.config = await api(apiUrl('config'));
statusText.textContent = `${state.config.roots.length} Root, ${state.config.readOnly ? 'Read-only' : 'Schreibzugriff aktiv'}`;
openExplorer(state.config.roots[0].path);
openProperties();
@@ -276,7 +277,7 @@ async function loadExplorer(win, targetPath) {
win.data.path = targetPath;
render();
try {
const result = await api(`/api/list?path=${encodeURIComponent(targetPath)}`);
const result = await api(apiUrl(`list.php?path=${encodeURIComponent(targetPath)}`));
win.data.path = result.path;
win.data.entries = result.entries;
} catch (error) {
@@ -307,7 +308,7 @@ async function handleDrop(event, win, targetPath) {
for (const file of event.dataTransfer.files) {
form.append('files', file, file.name);
}
await fetchChecked(`/api/upload?path=${encodeURIComponent(targetPath)}`, {
await fetchChecked(apiUrl(`upload.php?path=${encodeURIComponent(targetPath)}`), {
method: 'POST',
body: form
});
@@ -316,7 +317,7 @@ async function handleDrop(event, win, targetPath) {
}
async function createJob(type, source, destination) {
const job = await api(`/api/jobs/${type}`, {
const job = await api(apiUrl(`job.php?action=${encodeURIComponent(type)}`), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ source, destination })
@@ -327,7 +328,7 @@ async function createJob(type, source, destination) {
}
async function pollJob(id) {
const job = await api(`/api/jobs/${id}`);
const job = await api(apiUrl(`job.php?id=${encodeURIComponent(id)}`));
state.jobs.set(id, job);
render();
if (['queued', 'running', 'cancel_requested'].includes(job.status)) {
@@ -446,3 +447,7 @@ function escapeAttr(value) {
function clamp(value, min, max) {
return Math.max(min, Math.min(max, value));
}
function apiUrl(path) {
return `${API_BASE.replace(/\/$/, '')}/${path.replace(/^\//, '')}`;
}
+58 -74
View File
@@ -1,5 +1,4 @@
:root {
color-scheme: light dark;
.u-nav {
--bg: #f4f6f8;
--surface: #ffffff;
--surface-2: #eef2f5;
@@ -8,12 +7,17 @@
--line: #cfd8e1;
--accent: #e86f2d;
--accent-2: #287a65;
--danger: #b52c34;
--shadow: 0 18px 55px rgba(24, 34, 45, 0.22);
background: var(--bg);
color: var(--text);
display: grid;
font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
grid-template-rows: auto 1fr;
min-height: calc(100vh - 170px);
}
@media (prefers-color-scheme: dark) {
:root {
.u-nav {
--bg: #101418;
--surface: #1b2229;
--surface-2: #242e37;
@@ -24,22 +28,16 @@
}
}
* {
.u-nav *,
.u-nav *::before,
.u-nav *::after {
box-sizing: border-box;
}
body {
margin: 0;
min-height: 100vh;
background: var(--bg);
color: var(--text);
font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button {
.u-nav button {
background: var(--surface);
border: 1px solid var(--line);
border-radius: 6px;
background: var(--surface);
color: var(--text);
cursor: pointer;
font: inherit;
@@ -47,17 +45,11 @@ button {
padding: 0 10px;
}
button:hover {
.u-nav button:hover {
border-color: var(--accent);
}
button.primary {
background: var(--accent);
border-color: var(--accent);
color: #fff;
}
button.icon {
.u-nav button.icon {
align-items: center;
display: inline-flex;
height: 30px;
@@ -67,13 +59,7 @@ button.icon {
width: 32px;
}
.app-shell {
display: grid;
grid-template-rows: auto 1fr;
min-height: 100vh;
}
.topbar {
.u-nav .topbar {
align-items: center;
background: var(--surface);
border-bottom: 1px solid var(--line);
@@ -83,30 +69,32 @@ button.icon {
padding: 12px 16px;
}
.topbar h1 {
.u-nav .topbar h1 {
color: var(--text);
font-size: 18px;
line-height: 1;
margin: 0 0 4px;
}
.topbar p {
.u-nav .topbar p,
.u-nav .muted {
color: var(--muted);
margin: 0;
}
.toolbar {
.u-nav .toolbar {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.workspace {
.u-nav .workspace {
min-height: 0;
overflow: hidden;
position: relative;
}
.window {
.u-nav .window {
background: var(--surface);
border: 1px solid var(--line);
border-radius: 8px;
@@ -119,15 +107,15 @@ button.icon {
position: absolute;
}
.window.focused {
.u-nav .window.focused {
border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}
.window.maximized {
.u-nav .window.maximized {
border-radius: 0;
}
.titlebar {
.u-nav .titlebar {
align-items: center;
background: var(--surface-2);
border-bottom: 1px solid var(--line);
@@ -140,24 +128,24 @@ button.icon {
user-select: none;
}
.titlebar strong {
.u-nav .titlebar strong {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.window-actions {
.u-nav .window-actions {
display: flex;
gap: 6px;
}
.window-body {
.u-nav .window-body {
min-height: 0;
overflow: auto;
padding: 10px;
}
.resize-handle {
.u-nav .resize-handle {
bottom: 0;
cursor: nwse-resize;
height: 18px;
@@ -166,7 +154,7 @@ button.icon {
width: 18px;
}
.resize-handle::after {
.u-nav .resize-handle::after {
border-bottom: 2px solid var(--muted);
border-right: 2px solid var(--muted);
bottom: 5px;
@@ -177,7 +165,7 @@ button.icon {
width: 8px;
}
.pathbar {
.u-nav .pathbar {
align-items: center;
display: grid;
gap: 8px;
@@ -185,7 +173,7 @@ button.icon {
margin-bottom: 10px;
}
.pathbar input {
.u-nav .pathbar input {
background: var(--surface-2);
border: 1px solid var(--line);
border-radius: 6px;
@@ -196,53 +184,53 @@ button.icon {
width: 100%;
}
.drop-zone {
.u-nav .drop-zone {
border: 1px dashed transparent;
border-radius: 8px;
min-height: 180px;
}
.drop-zone.drag-over {
.u-nav .drop-zone.drag-over {
background: color-mix(in srgb, var(--accent) 10%, transparent);
border-color: var(--accent);
}
.file-table {
.u-nav .file-table {
border-collapse: collapse;
width: 100%;
}
.file-table th,
.file-table td {
.u-nav .file-table th,
.u-nav .file-table td {
border-bottom: 1px solid var(--line);
padding: 8px 7px;
text-align: left;
vertical-align: middle;
}
.file-table th {
.u-nav .file-table th {
color: var(--muted);
font-size: 12px;
font-weight: 600;
}
.file-row {
.u-nav .file-row {
cursor: default;
}
.file-row:hover,
.file-row.selected {
.u-nav .file-row:hover,
.u-nav .file-row.selected {
background: var(--surface-2);
}
.name-cell {
.u-nav .name-cell {
align-items: center;
display: flex;
gap: 8px;
min-width: 150px;
}
.badge {
.u-nav .badge {
border: 1px solid var(--line);
border-radius: 999px;
color: var(--muted);
@@ -253,22 +241,18 @@ button.icon {
padding: 2px 8px;
}
.muted {
color: var(--muted);
}
.queue-list {
.u-nav .queue-list {
display: grid;
gap: 10px;
}
.job {
.u-nav .job {
border: 1px solid var(--line);
border-radius: 8px;
padding: 10px;
}
.progress {
.u-nav .progress {
background: var(--surface-2);
border-radius: 999px;
height: 8px;
@@ -276,40 +260,40 @@ button.icon {
overflow: hidden;
}
.progress div {
.u-nav .progress div {
background: var(--accent-2);
height: 100%;
width: 0;
}
.properties dl {
.u-nav .properties dl {
display: grid;
grid-template-columns: max-content 1fr;
gap: 8px 14px;
grid-template-columns: max-content 1fr;
margin: 0;
}
.properties dt {
.u-nav .properties dt {
color: var(--muted);
}
.properties dd {
.u-nav .properties dd {
margin: 0;
overflow-wrap: anywhere;
}
@media (max-width: 720px) {
.topbar {
.u-nav .topbar {
align-items: flex-start;
flex-direction: column;
}
.workspace {
.u-nav .workspace {
overflow: auto;
}
.window,
.window.maximized {
.u-nav .window,
.u-nav .window.maximized {
border-left: 0;
border-radius: 0;
border-right: 0;
@@ -321,11 +305,11 @@ button.icon {
width: 100% !important;
}
.window:not(.focused) {
.u-nav .window:not(.focused) {
display: none;
}
.resize-handle {
.u-nav .resize-handle {
display: none;
}
}