0.10.2-15 Minor Frotnend callibarations
This commit is contained in:
@@ -51,8 +51,12 @@ function formatChapterTime(secondsValue) {
|
||||
return `${minutes}:${String(seconds).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function stripHtml(value) {
|
||||
return String(value || '').replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
|
||||
}
|
||||
|
||||
function truncateDescription(value, maxLength = 220) {
|
||||
const normalized = String(value || '').replace(/\s+/g, ' ').trim();
|
||||
const normalized = stripHtml(value);
|
||||
if (!normalized || normalized.length <= maxLength) {
|
||||
return normalized;
|
||||
}
|
||||
@@ -168,6 +172,7 @@ export default function AudiobookConfigPanel({
|
||||
const statusLabel = getStatusLabel(state);
|
||||
const statusSeverity = getStatusSeverity(state);
|
||||
const description = String(metadata?.description || '').trim();
|
||||
const descriptionStripped = stripHtml(description);
|
||||
const descriptionPreview = truncateDescription(description);
|
||||
const posterUrl = String(metadata?.poster || '').trim() || null;
|
||||
|
||||
@@ -196,7 +201,7 @@ export default function AudiobookConfigPanel({
|
||||
<div className="audiobook-description-preview">
|
||||
<strong>Beschreibung:</strong>
|
||||
<span>{descriptionPreview}</span>
|
||||
{description.length > descriptionPreview.length ? (
|
||||
{descriptionStripped.length > descriptionPreview.length ? (
|
||||
<Button
|
||||
type="button"
|
||||
label="Vollständig anzeigen"
|
||||
@@ -378,9 +383,11 @@ export default function AudiobookConfigPanel({
|
||||
style={{ width: 'min(48rem, 92vw)' }}
|
||||
onHide={() => setDescriptionDialogVisible(false)}
|
||||
>
|
||||
<div className="audiobook-description-dialog">
|
||||
<p>{description || 'Keine Beschreibung vorhanden.'}</p>
|
||||
</div>
|
||||
<div
|
||||
className="audiobook-description-dialog"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: description || '<p>Keine Beschreibung vorhanden.</p>' }}
|
||||
/>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user