Create Kaleido Desktop, a cinematic Plex client for Windows

Tauri 2 shell with a React/TypeScript interface and libmpv playback composed
beneath the web view (DirectComposition on Windows). Shared code with per-OS
platform modules and configs so macOS and Linux can follow.

- Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home
- Home, Movies and TV Shows (Discover, Library, Collections), search, people
- Title pages with logos, ratings, cast, extras, seasons and episodes
- Direct play with Plex conversion fallback, tracks, markers, autoplay
- Metadata editing, artwork, fix match, refresh, analyze and deletion
- Resumable offline downloads
- App settings and Plex server administration with a live dashboard
- Signed updater feed and Forgejo CI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-10-30 16:26:37 -07:00
commit 00d72e70f4
121 changed files with 25315 additions and 0 deletions

View file

@ -0,0 +1,96 @@
import { useState } from 'react';
import * as api from '../../plex/api';
import type { Item } from '../../plex/types';
import { useServer } from '../../app/session';
import { invalidateItem, invalidateLibrary, useServerQuery } from '../../app/queries';
import { Dialog, promptDialog, toast, toastError } from '../../ui/overlays';
import { Button, EmptyState, PageLoader } from '../../ui/primitives';
import { Icon } from '../../ui/Icon';
const KIND = { poster: 'posters', art: 'arts', clearLogo: 'clearLogos' } as const;
const LABEL = { poster: 'poster', art: 'background', clearLogo: 'logo' } as const;
export function ArtworkDialog({ item, type, onClose }: { item: Item; type: 'poster' | 'art' | 'clearLogo'; onClose: () => void }) {
const server = useServer();
const options = useServerQuery(['artwork', item.id, type], (s) => api.artworkOptions(s, item.id, KIND[type]), { staleTime: 0 });
const [busy, setBusy] = useState('');
const choose = async (key: string) => {
setBusy(key);
try {
await api.selectArtwork(server, item.id, type, key);
toast(`Updated the ${LABEL[type]}`, 'success');
invalidateItem(item.id);
invalidateLibrary();
onClose();
} catch (e) {
toastError(e);
} finally {
setBusy('');
}
};
const upload = () => {
const input = document.createElement('input');
input.type = 'file';
input.accept = 'image/jpeg,image/png,image/webp';
input.onchange = async () => {
const file = input.files?.[0];
if (!file) return;
setBusy('upload');
try {
await api.uploadArtwork(server, item.id, KIND[type], file);
toast(`Uploaded a new ${LABEL[type]}`, 'success');
invalidateItem(item.id);
invalidateLibrary();
onClose();
} catch (e) {
toastError(e);
} finally {
setBusy('');
}
};
input.click();
};
const fromUrl = async () => {
const url = await promptDialog({ title: `Use an image from the web`, message: `Plex downloads the image and uses it as the ${LABEL[type]}.`, confirm: 'Use image', input: { label: 'Image URL', placeholder: 'https://…' } });
if (url) choose(url);
};
const shape = type === 'poster' ? 'poster' : type === 'art' ? 'landscape' : 'logo';
return (
<Dialog
title={`Choose ${LABEL[type]}`}
subtitle={item.title}
onClose={onClose}
width={880}
footer={
<div className="actions">
<Button variant="ghost" icon="link" onClick={fromUrl}>
From URL
</Button>
<Button variant="ghost" icon="upload" busy={busy === 'upload'} onClick={upload}>
Upload image
</Button>
</div>
}
>
{options.isLoading && <PageLoader />}
{options.data && !options.data.length && <EmptyState icon="image" title="No alternatives">Upload an image or use one from the web.</EmptyState>}
<div className={`artwork-grid ${shape}`}>
{options.data?.map((o) => (
<button key={o.key} className={`artwork-option${o.selected ? ' selected' : ''}`} onClick={() => choose(o.key)} disabled={!!busy}>
<img src={server.image(o.thumb, shape === 'poster' ? 180 : 320, shape === 'poster' ? 270 : 180, { format: shape === 'logo' ? 'png' : 'jpeg' })} alt="" loading="lazy" />
{o.selected && (
<span className="artwork-selected">
<Icon name="check" size={14} strokeWidth={2.4} />
</span>
)}
{o.provider && <span className="artwork-provider">{o.provider.replace(/^com\.plexapp\.agents\.|^tv\.plex\.agents\./, '')}</span>}
</button>
))}
</div>
</Dialog>
);
}

View file

@ -0,0 +1,60 @@
import { useDialogs } from '../../app/actions';
import { useSession } from '../../app/session';
import { Dialog } from '../../ui/overlays';
import { EditMetadataDialog } from './EditMetadata';
import { FixMatchDialog } from './FixMatch';
import { ArtworkDialog } from './Artwork';
import { MediaInfoDialog } from './MediaInfo';
import { CollectionDialog, PlaylistDialog } from './Lists';
import { channelLabel, resolutionLabel } from '../../app/format';
export function DialogHost() {
const dialog = useDialogs((s) => s.dialog);
const close = useDialogs((s) => s.close);
const server = useSession((s) => s.server);
if (!dialog || !server) return null;
switch (dialog.kind) {
case 'edit':
return <EditMetadataDialog item={dialog.item} onClose={close} />;
case 'match':
return <FixMatchDialog item={dialog.item} onClose={close} />;
case 'artwork':
return <ArtworkDialog item={dialog.item} type={dialog.type} onClose={close} />;
case 'info':
return <MediaInfoDialog item={dialog.item} onClose={close} />;
case 'collection':
return <CollectionDialog item={dialog.item} onClose={close} />;
case 'playlist':
return <PlaylistDialog item={dialog.item} onClose={close} />;
case 'synopsis':
return (
<Dialog title={dialog.item.title} subtitle={[dialog.item.year, dialog.item.tagline].filter(Boolean).join(' · ')} onClose={close} width={620}>
<p className="synopsis-full selectable">{dialog.item.summary}</p>
</Dialog>
);
case 'versions':
return (
<Dialog title="Choose a version" subtitle={dialog.item.title} onClose={close} width={520}>
<div className="version-list">
{dialog.item.media.map((m, i) => (
<button
key={m.id}
className="version-row"
onClick={() => {
close();
dialog.onPick(i);
}}
>
<b>{m.title || [resolutionLabel(m), m.dynamicRange].filter(Boolean).join(' ')}</b>
<span>
{[m.videoCodec.toUpperCase(), `${m.audioCodec.toUpperCase()} ${channelLabel(m.audioChannels)}`, m.bitrate ? `${Math.round(m.bitrate / 1000)} Mbps` : '', m.container.toUpperCase()].filter(Boolean).join(' · ')}
</span>
</button>
))}
</div>
</Dialog>
);
default:
return null;
}
}

View file

@ -0,0 +1,208 @@
import { useState } from 'react';
import * as api from '../../plex/api';
import type { Item } from '../../plex/types';
import { useServer } from '../../app/session';
import { invalidateItem, invalidateLibrary, useItem } from '../../app/queries';
import { openDialog } from '../../app/actions';
import { Dialog, toast, toastError } from '../../ui/overlays';
import { Button, PageLoader, Segmented } from '../../ui/primitives';
import { Icon } from '../../ui/Icon';
type Tab = 'general' | 'tags' | 'artwork';
const FIELDS: { key: string; label: string; types: string[]; multiline?: boolean; type?: string }[] = [
{ key: 'title', label: 'Title', types: ['movie', 'show', 'season', 'episode', 'collection'] },
{ key: 'titleSort', label: 'Sort title', types: ['movie', 'show', 'collection'] },
{ key: 'originalTitle', label: 'Original title', types: ['movie', 'show'] },
{ key: 'originallyAvailableAt', label: 'Release date', types: ['movie', 'show', 'episode'], type: 'date' },
{ key: 'contentRating', label: 'Content rating', types: ['movie', 'show', 'collection'] },
{ key: 'studio', label: 'Studio', types: ['movie', 'show'] },
{ key: 'tagline', label: 'Tagline', types: ['movie', 'show'] },
{ key: 'summary', label: 'Summary', types: ['movie', 'show', 'season', 'episode', 'collection'], multiline: true },
];
const TAGS: { key: string; label: string; source: keyof Item; types: string[] }[] = [
{ key: 'genre', label: 'Genres', source: 'genres', types: ['movie', 'show'] },
{ key: 'collection', label: 'Collections', source: 'collections', types: ['movie', 'show'] },
{ key: 'label', label: 'Labels', source: 'labels', types: ['movie', 'show', 'episode', 'season', 'collection'] },
{ key: 'director', label: 'Directors', source: 'directors', types: ['movie', 'episode'] },
{ key: 'writer', label: 'Writers', source: 'writers', types: ['movie', 'episode'] },
{ key: 'country', label: 'Countries', source: 'countries', types: ['movie', 'show'] },
];
function TagEditor({ label, values, onChange, locked, onLock }: { label: string; values: string[]; onChange: (v: string[]) => void; locked: boolean; onLock: () => void }) {
const [draft, setDraft] = useState('');
const add = () => {
const v = draft.trim();
if (v && !values.includes(v)) onChange([...values, v]);
setDraft('');
};
return (
<div className="field">
<span>
{label}
<LockToggle locked={locked} onClick={onLock} />
</span>
<div className="tag-editor">
{values.map((v) => (
<span key={v} className="chip">
{v}
<button aria-label={`Remove ${v}`} onClick={() => onChange(values.filter((x) => x !== v))}>
<Icon name="x" size={12} />
</button>
</span>
))}
<input
value={draft}
placeholder="Add…"
onChange={(e) => setDraft(e.target.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ',') {
e.preventDefault();
add();
} else if (e.key === 'Backspace' && !draft && values.length) onChange(values.slice(0, -1));
}}
onBlur={add}
/>
</div>
</div>
);
}
function LockToggle({ locked, onClick }: { locked: boolean; onClick: () => void }) {
return (
<button type="button" className={`lock-toggle${locked ? ' on' : ''}`} onClick={onClick} title={locked ? 'Locked: refreshes keep this value' : 'Unlocked: refreshes may replace this value'}>
<Icon name={locked ? 'lock' : 'unlock'} size={12} />
</button>
);
}
export function EditMetadataDialog({ item: initial, onClose }: { item: Item; onClose: () => void }) {
const server = useServer();
const full = useItem(initial.id);
const item = full.data ?? initial;
const [tab, setTab] = useState<Tab>('general');
const [values, setValues] = useState<Record<string, string> | null>(null);
const [tags, setTags] = useState<Record<string, string[]> | null>(null);
const [locks, setLocks] = useState<Record<string, boolean>>({});
const [busy, setBusy] = useState(false);
const fields = FIELDS.filter((f) => f.types.includes(item.type));
const tagFields = TAGS.filter((t) => t.types.includes(item.type));
const lockedFields: Record<string, boolean> = Object.fromEntries((item.raw?.Field ?? []).map((f: any) => [f.name, !!f.locked]));
if (full.data && !values) {
setValues(Object.fromEntries(fields.map((f) => [f.key, String(item.raw?.[f.key] ?? '')])));
setTags(Object.fromEntries(tagFields.map((t) => [t.key, ((item[t.source] as { tag: string }[]) ?? []).map((x) => x.tag)])));
setLocks(lockedFields);
}
const save = async () => {
if (!values || !tags) return;
setBusy(true);
try {
const changed: Record<string, string> = {};
for (const f of fields) if ((values[f.key] ?? '') !== String(item.raw?.[f.key] ?? '')) changed[f.key] = values[f.key];
const tagChanges: Record<string, { add: string[]; remove: string[] }> = {};
for (const t of tagFields) {
const before = ((item[t.source] as { tag: string }[]) ?? []).map((x) => x.tag);
const after = tags[t.key];
if (before.join('\u0000') !== after.join('\u0000')) tagChanges[t.key] = { add: after, remove: before.filter((b) => !after.includes(b)) };
}
const lockChanges: Record<string, boolean> = {};
for (const [k, v] of Object.entries(locks)) if (!!lockedFields[k] !== v) lockChanges[k] = v;
for (const k of [...Object.keys(changed), ...Object.keys(tagChanges)]) if (!(k in lockChanges)) lockChanges[k] = true;
if (!Object.keys(changed).length && !Object.keys(tagChanges).length && !Object.keys(lockChanges).length) {
onClose();
return;
}
await api.editMetadata(server, item, changed, tagChanges, lockChanges);
toast('Metadata saved', 'success');
invalidateItem(item.id);
invalidateLibrary();
onClose();
} catch (e) {
toastError(e);
} finally {
setBusy(false);
}
};
return (
<Dialog
title="Edit metadata"
subtitle={`${item.title}${item.librarySectionTitle ? ` · ${item.librarySectionTitle}` : ''}`}
onClose={onClose}
width={760}
className="edit-dialog"
footer={
<>
<span className="dialog-note">
<Icon name="lock" size={13} /> Edited fields are locked so metadata refreshes keep them.
</span>
<div className="actions">
<Button variant="ghost" onClick={onClose}>
Cancel
</Button>
<Button variant="primary" icon="check" busy={busy} onClick={save} disabled={!values}>
Save
</Button>
</div>
</>
}
>
<Segmented
value={tab}
onChange={setTab}
options={[
{ value: 'general', label: 'General' },
...(tagFields.length ? [{ value: 'tags' as Tab, label: 'Tags' }] : []),
{ value: 'artwork', label: 'Artwork' },
]}
className="dialog-tabs"
/>
{!values || !tags ? (
<PageLoader />
) : tab === 'general' ? (
<div className="field-grid">
{fields.map((f) => (
<label key={f.key} className="field" style={f.multiline || f.key === 'title' || f.key === 'tagline' ? { gridColumn: '1 / -1' } : undefined}>
<span>
{f.label}
<LockToggle locked={!!locks[f.key]} onClick={() => setLocks((l) => ({ ...l, [f.key]: !l[f.key] }))} />
</span>
{f.multiline ? (
<textarea value={values[f.key]} onChange={(e) => setValues({ ...values, [f.key]: e.target.value })} rows={6} />
) : (
<input type={f.type ?? 'text'} value={values[f.key]} onChange={(e) => setValues({ ...values, [f.key]: e.target.value })} />
)}
</label>
))}
</div>
) : tab === 'tags' ? (
<div>
{tagFields.map((t) => (
<TagEditor key={t.key} label={t.label} values={tags[t.key]} onChange={(v) => setTags({ ...tags, [t.key]: v })} locked={!!locks[t.key]} onLock={() => setLocks((l) => ({ ...l, [t.key]: !l[t.key] }))} />
))}
</div>
) : (
<div className="artwork-tab">
{(
[
['poster', 'Poster', item.thumb, 'poster'],
['art', 'Background', item.art, 'landscape'],
['clearLogo', 'Logo', item.logo, 'logo'],
] as const
).map(([type, label, path, shape]) => (
<button key={type} className={`artwork-choice ${shape}`} onClick={() => openDialog({ kind: 'artwork', item, type })}>
<div className="artwork-choice-img">{path ? <img src={server.image(path, shape === 'poster' ? 200 : 360, shape === 'poster' ? 300 : 200, { format: shape === 'logo' ? 'png' : 'jpeg' })} alt="" /> : <Icon name="image" size={24} />}</div>
<span>
{label} <Icon name="next" size={13} />
</span>
</button>
))}
</div>
)}
</Dialog>
);
}

View file

@ -0,0 +1,91 @@
import { useEffect, useState } from 'react';
import * as api from '../../plex/api';
import type { Item } from '../../plex/types';
import { useServer } from '../../app/session';
import { invalidateItem, invalidateLibrary, useSections } from '../../app/queries';
import { Dialog, toast, toastError } from '../../ui/overlays';
import { Button, EmptyState, Spinner } from '../../ui/primitives';
export function FixMatchDialog({ item, onClose }: { item: Item; onClose: () => void }) {
const server = useServer();
const sections = useSections();
const section = sections.data?.find((s) => s.id === item.librarySectionId);
const [title, setTitle] = useState(item.title);
const [year, setYear] = useState(item.year ? String(item.year) : '');
const [results, setResults] = useState<api.MatchCandidate[] | null>(null);
const [busy, setBusy] = useState(false);
const [applying, setApplying] = useState('');
const search = async () => {
setBusy(true);
try {
setResults(await api.matches(server, item.id, { title, year, agent: section?.agent, language: section?.language }));
} catch (e) {
toastError(e);
} finally {
setBusy(false);
}
};
useEffect(() => {
search();
}, [section?.agent]);
const apply = async (m: api.MatchCandidate) => {
setApplying(m.guid);
try {
await api.applyMatch(server, item.id, m.guid, m.name, m.year);
toast(`Matched to “${m.name}”. Plex is updating its metadata.`, 'success');
setTimeout(() => {
invalidateItem(item.id);
invalidateLibrary();
}, 2500);
onClose();
} catch (e) {
toastError(e);
} finally {
setApplying('');
}
};
return (
<Dialog title="Fix match" subtitle={`Choose the correct ${item.type === 'show' ? 'series' : 'movie'} for ${item.raw?.Media?.[0]?.Part?.[0]?.file?.split(/[\\/]/).pop() ?? item.title}`} onClose={onClose} width={720}>
<form
className="match-search"
onSubmit={(e) => {
e.preventDefault();
search();
}}
>
<input className="text-input" value={title} onChange={(e) => setTitle(e.target.value)} placeholder="Title" />
<input className="text-input year" value={year} onChange={(e) => setYear(e.target.value.replace(/\D/g, '').slice(0, 4))} placeholder="Year" />
<Button variant="ghost" icon="search" busy={busy} type="submit">
Search
</Button>
</form>
<div className="match-results">
{busy && !results && (
<div className="center-pad">
<Spinner />
</div>
)}
{results && !results.length && <EmptyState icon="search" title="No matches found">Try a different title or year.</EmptyState>}
{results?.map((m) => (
<button key={m.guid} className="match-row" onClick={() => apply(m)} disabled={!!applying}>
<div className="match-thumb">{m.thumb && <img src={m.thumb.startsWith('http') ? m.thumb : server.image(m.thumb, 80, 120)} alt="" />}</div>
<div className="match-text">
<b>
{m.name} {m.year ? <span className="dim">({m.year})</span> : null}
</b>
{m.summary && <p>{m.summary}</p>}
<small>
{m.matched ? 'Current match · ' : ''}
{m.score}% confidence
</small>
</div>
{applying === m.guid && <Spinner size={18} />}
</button>
))}
</div>
</Dialog>
);
}

View file

@ -0,0 +1,101 @@
import { useState } from 'react';
import * as api from '../../plex/api';
import type { Item } from '../../plex/types';
import { useServer } from '../../app/session';
import { invalidateLibrary, useServerQuery } from '../../app/queries';
import { Dialog, toast, toastError } from '../../ui/overlays';
import { Button, PageLoader } from '../../ui/primitives';
import { Icon } from '../../ui/Icon';
export function CollectionDialog({ item, onClose }: { item: Item; onClose: () => void }) {
const server = useServer();
const collections = useServerQuery(['collections', item.librarySectionId], (s) => api.collections(s, item.librarySectionId), { enabled: !!item.librarySectionId });
const [name, setName] = useState('');
const [busy, setBusy] = useState(false);
const current = new Set(item.collections.map((c) => c.tag));
const add = async (title: string) => {
setBusy(true);
try {
await api.addToCollection(server, item, title);
toast(`Added to “${title}”`, 'success');
invalidateLibrary();
onClose();
} catch (e) {
toastError(e);
} finally {
setBusy(false);
}
};
return (
<Dialog title="Add to collection" subtitle={item.title} onClose={onClose} width={480}>
<form
className="inline-create"
onSubmit={(e) => {
e.preventDefault();
if (name.trim()) add(name.trim());
}}
>
<input className="text-input" value={name} onChange={(e) => setName(e.target.value)} placeholder="New collection name" />
<Button variant="ghost" icon="plus" type="submit" disabled={!name.trim() || busy}>
Create
</Button>
</form>
{collections.isLoading && <PageLoader />}
<div className="list-pick">
{collections.data?.map((c) => (
<button key={c.id} className="list-pick-row" disabled={busy || current.has(c.title)} onClick={() => add(c.title)}>
<Icon name="collection" size={17} />
<span>{c.title}</span>
{current.has(c.title) && <Icon name="check" size={15} className="dim" />}
</button>
))}
</div>
</Dialog>
);
}
export function PlaylistDialog({ item, onClose }: { item: Item; onClose: () => void }) {
const server = useServer();
const playlists = useServerQuery(['playlists'], (s) => api.playlists(s));
const [name, setName] = useState('');
const [busy, setBusy] = useState(false);
const run = async (fn: () => Promise<unknown>, done: string) => {
setBusy(true);
try {
await fn();
toast(done, 'success');
onClose();
} catch (e) {
toastError(e);
} finally {
setBusy(false);
}
};
return (
<Dialog title="Add to playlist" subtitle={item.title} onClose={onClose} width={480}>
<form
className="inline-create"
onSubmit={(e) => {
e.preventDefault();
if (name.trim()) run(() => api.createPlaylist(server, name.trim(), server.machineId, item.id), `Created “${name.trim()}”`);
}}
>
<input className="text-input" value={name} onChange={(e) => setName(e.target.value)} placeholder="New playlist name" />
<Button variant="ghost" icon="plus" type="submit" disabled={!name.trim() || busy}>
Create
</Button>
</form>
{playlists.isLoading && <PageLoader />}
<div className="list-pick">
{playlists.data?.map((p) => (
<button key={p.id} className="list-pick-row" disabled={busy} onClick={() => run(() => api.addToPlaylist(server, p.id, server.machineId, item.id), `Added to “${p.title}”`)}>
<Icon name="queue" size={17} />
<span>{p.title}</span>
<small className="dim">{p.leafCount ? `${p.leafCount} items` : ''}</small>
</button>
))}
{playlists.data && !playlists.data.length && <p className="muted">No video playlists yet. Create one above.</p>}
</div>
</Dialog>
);
}

View file

@ -0,0 +1,109 @@
import type { Item, Stream } from '../../plex/types';
import { useItem } from '../../app/queries';
import { bitrate, channelLabel, date, duration, fileSize, resolutionLabel } from '../../app/format';
import { Dialog } from '../../ui/overlays';
import { PageLoader } from '../../ui/primitives';
function streamLine(s: Stream): string {
if (s.streamType === 1)
return [s.codec.toUpperCase(), s.profile, s.width && s.height ? `${s.width}×${s.height}` : '', s.frameRate ? `${s.frameRate} fps` : '', s.bitDepth ? `${s.bitDepth}-bit` : '', s.doviPresent ? 'Dolby Vision' : s.colorTrc === 'smpte2084' ? 'HDR10' : '', bitrate(s.bitrate)]
.filter(Boolean)
.join(' · ');
if (s.streamType === 2) return [s.extendedDisplayTitle || s.displayTitle, s.samplingRate ? `${(s.samplingRate / 1000).toFixed(1)} kHz` : '', bitrate(s.bitrate)].filter(Boolean).join(' · ');
return [s.extendedDisplayTitle || s.displayTitle, s.key ? 'External file' : 'Embedded'].filter(Boolean).join(' · ');
}
export function MediaInfoDialog({ item: initial, onClose }: { item: Item; onClose: () => void }) {
const q = useItem(initial.id);
const item = q.data ?? initial;
return (
<Dialog title="Media info" subtitle={item.type === 'episode' ? `${item.grandparentTitle} · ${item.title}` : item.title} onClose={onClose} width={760}>
{q.isLoading && <PageLoader />}
<div className="media-info selectable">
{item.media.map((m, mi) => (
<section key={m.id} className="media-version">
<h3>
{item.media.length > 1 ? `Version ${mi + 1} · ` : ''}
{[resolutionLabel(m), m.dynamicRange, m.container.toUpperCase()].filter(Boolean).join(' · ')}
</h3>
<div className="info-grid">
<div>
<span>Duration</span>
<b>{duration(m.duration || item.duration)}</b>
</div>
<div>
<span>Bitrate</span>
<b>{bitrate(m.bitrate) || '—'}</b>
</div>
<div>
<span>Video</span>
<b>{[m.videoCodec.toUpperCase(), m.videoProfile, m.videoFrameRate].filter(Boolean).join(' · ')}</b>
</div>
<div>
<span>Audio</span>
<b>{[m.audioCodec.toUpperCase(), channelLabel(m.audioChannels)].filter(Boolean).join(' · ')}</b>
</div>
</div>
{m.parts.map((p) => (
<div key={p.id} className="media-part">
<div className="media-file">
<span>File</span>
<code>{p.file || p.key}</code>
</div>
<div className="info-grid">
<div>
<span>Size</span>
<b>{fileSize(p.size) || '—'}</b>
</div>
<div>
<span>Availability</span>
<b>{p.exists === false ? 'Missing' : p.accessible === false ? 'Not accessible' : 'Available'}</b>
</div>
<div>
<span>Previews</span>
<b>{p.indexes.includes('sd') ? 'Generated' : 'Not generated'}</b>
</div>
</div>
<table className="stream-table">
<tbody>
{p.streams.map((s) => (
<tr key={s.id}>
<td>{s.streamType === 1 ? 'Video' : s.streamType === 2 ? 'Audio' : s.streamType === 3 ? 'Subtitle' : 'Other'}</td>
<td>{streamLine(s)}</td>
<td>{s.selected ? 'Selected' : s.default ? 'Default' : ''}</td>
</tr>
))}
</tbody>
</table>
</div>
))}
</section>
))}
<div className="info-grid footer">
<div>
<span>Library</span>
<b>{item.librarySectionTitle || '—'}</b>
</div>
<div>
<span>Added</span>
<b>{date(item.addedAt)}</b>
</div>
<div>
<span>Updated</span>
<b>{date(item.updatedAt)}</b>
</div>
<div>
<span>Plex ID</span>
<b>{item.id}</b>
</div>
{item.guids.length > 0 && (
<div style={{ gridColumn: '1 / -1' }}>
<span>External IDs</span>
<b>{item.guids.join(' · ')}</b>
</div>
)}
</div>
</div>
</Dialog>
);
}