diff --git a/src/components/PreviewBlock.jsx b/src/components/PreviewBlock.jsx index 8c3966e..b833b98 100644 --- a/src/components/PreviewBlock.jsx +++ b/src/components/PreviewBlock.jsx @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback, useRef } from 'react' import { modeOptionsFor, previewStatus, modeHint, isDevUnavailableError, NO_DEV_HINT } from '../lib/previewView' -import { isValidEnvName, buildEnvPayload, isDevPreview, dotColor, envValueTooLong, MAX_ENV_VARS } from '../lib/previewEnv' +import { isValidEnvName, buildEnvPayload, isDevPreview, envValueTooLong, MAX_ENV_VARS } from '../lib/previewEnv' import { fetchPreview, setPreviewMode, @@ -10,8 +10,9 @@ import { stopPreviewDev, fetchPreviewLog, } from '../lib/previewApi' +import { Button, Badge } from './ui' +import { previewColorTone } from './projectTones' -const STATE_OF_COLOR = { green: 'online', yellow: 'building', red: 'failed', grey: 'off' } const NOT_ACTIVE = 'Preview-Runner ist nicht aktiv' const logDate = (at) => { @@ -171,7 +172,7 @@ export default function PreviewBlock({ projectId }) { } } - if (loading) return
Lädt …
+ if (loading) return

Lädt …

const view = data ? { ...data } : { state: 'off' } const status = previewStatus(view) @@ -182,18 +183,15 @@ export default function PreviewBlock({ projectId }) { const dev = isDevPreview(data) const logs = [...(data?.logs || [])].sort((a, b) => new Date(b.at) - new Date(a.at)).slice(0, 5) - const small = { fontSize: 12 } - return ( -
+
{data && ( <> -
- +
+
- {data.devAvailable === false &&
{NO_DEV_HINT}
} - {hint &&
{hint}
} -
- - {status.text} + {data.devAvailable === false &&

{NO_DEV_HINT}

} + {hint &&

{hint}

} +
+ {status.text}
{data.state === 'failed' && data.error && !isDevUnavailableError(data.error) && ( -
{data.error}
+

{data.error}

)} )} - {inactive &&
{NOT_ACTIVE}.
} - {error &&
{error}
} + {inactive &&

{NOT_ACTIVE}.

} + {error &&

{error}

} {data && !inactive && ( <> -
- - + + {dev && ( <> - - + + )}
{showLogs && ( -
+ <> - {logFile && ( -
-                  {logText || '…'}
-                
- )} -
+ {logFile &&
{logText || '…'}
} + )} -
- Variablen -
- {names.length === 0 &&
Keine Variablen.
} - {names.map((n) => ( -
- {n} - ••• - {editName === n ? ( - <> - setEditValue(e.target.value)} /> - - - ) : ( - - )} - -
- ))} -
- setNewName(e.target.value)} /> - setNewValue(e.target.value)} /> - -
- {envError &&
{envError}
} - {dirty && ( -
- -
+

Variablen

+ {names.length === 0 &&

Keine Variablen.

} + {names.map((n) => ( +
+ {n} + ••• + {editName === n ? ( + <> + setEditValue(e.target.value)} /> + + + ) : ( + )} -
Alles mit VITE_ / NEXT_PUBLIC_ ist später im Browser sichtbar.
+
+ ))} +
+ setNewName(e.target.value)} /> + setNewValue(e.target.value)} /> +
+ {envError &&

{envError}

} + {dirty && ( +
+ +
+ )} +

Alles mit VITE_ / NEXT_PUBLIC_ ist später im Browser sichtbar.

)}
diff --git a/src/styles/global.css b/src/styles/global.css index f93dde9..fdfaa87 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -1150,6 +1150,7 @@ button.link { text-align: left; } /* Reset und Gewicht von button.link stehen im .pv-var { padding-bottom: 8px; border-bottom: 1px solid var(--line); } .pv-mode { width: 200px; max-width: 100%; } .pv-title { font-size: 13px; font-weight: 600; } +.pv-block .msg { overflow-wrap: anywhere; } /* Fehlertexte des Runners enthalten lange Pfade ohne Leerzeichen */ .pv-log { background: var(--bg-subtle); max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-all; padding: 8px; border-radius: var(--radius); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 16px; } .pv-var code, .pv-var .input, .pv-add .input { flex: 1 1 140px; min-width: 0; } .pv-var code { overflow-wrap: anywhere; }