Compare commits

..
7 Commits
Author SHA1 Message Date
HorizonCode 4d57184b73 feat(settings): animate the active settings description
The selected settings description now morphs between values with TextMorph unless reduced motion is enabled.
2026-11-03 19:26:52 +01:00
HorizonCode d555ac366f refactor(workshop): use the shared select component for theme filters
The sort, announcement audience and report category controls were still native select elements. They now use the same shadcn-svelte Select as the moderation filters for consistent styling and keyboard behavior.
2026-11-03 19:18:31 +01:00
HorizonCode 918f8651dd fix(workshop): make the takedown action work inside the desktop webview
The action used window.prompt, which returns null in the Tauri webview, so the handler aborted before calling the API. Takedown and lift now use an in-app dialog with a required reason, inline errors and a loading state.
2026-11-03 19:07:22 +01:00
HorizonCode 4b039c9b79 fix(workshop): keep download progress across tab switches
The workshop is unmounted when the Installed tab is opened, so its local download state was discarded and returning to the Community tab showed no progress even though the install was still running. Active downloads and percentages now live in a shared module that outlives the component, and in-flight downloads keep updating it.
2026-11-03 19:03:58 +01:00
HorizonCode 809fca6f29 feat(workshop): add the pre-publication review queue
New themes are submitted for review instead of appearing live, so the workshop now surfaces pending and rejected badges on the creator's own cards and adds a Review queue to the moderation panel with approve and reject actions. Publishing reports that the theme is awaiting review, and approval/rejection notifications are labelled.
2026-11-03 19:01:29 +01:00
HorizonCode 0025313c4d fix(workshop): allow concurrent downloads and stop auto-applying
Downloads shared a single active-id guard, so a second theme could not start until the first finished, and completing one immediately applied it over the current theme. Each download now tracks its own progress, runs concurrently, and only adds the theme to the library. The batch-selection bar and checkboxes are removed in favour of the independent buttons.
2026-11-03 18:48:52 +01:00
HorizonCode 6b1ed5aa1a feat(workshop): download multiple selected themes in one batch
Only one theme could be installed at a time because a single download id
guarded every card, so users had to repeat the flow per theme. A selection
mode now adds checkboxes and a batch bar that installs the chosen themes in
sequence, with per-theme progress and a summary of failures.
2026-11-03 18:43:53 +01:00
6 changed files with 540 additions and 122 deletions

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
import { SvelteMap, SvelteSet } from 'svelte/reactivity';
/**
* Install progress lives outside the workshop component because switching to
* the Installed tab unmounts it. Keeping the state here lets the workshop show
* the current progress again when it is remounted, while the in-flight
* download keeps running.
*/
export const activeThemeDownloads = new SvelteSet<string>();
export const themeDownloadProgress = new SvelteMap<string, number>();
+110 -13
View File
@@ -32,6 +32,8 @@ export interface ThemeSearchMatch {
score: number;
}
export type ThemeReviewStatus = 'pending' | 'approved' | 'rejected';
export interface CommunityTheme {
id: string;
name: string;
@@ -45,6 +47,11 @@ export interface CommunityTheme {
likeCount: number;
tags: string[];
allowForking: boolean;
reviewStatus: ThemeReviewStatus;
reviewNote: string | null;
reviewedAt: string | null;
reviewedBy: number | null;
reviewedByName: string | null;
createdAt: string;
updatedAt: string;
author: CommunityThemeAuthor;
@@ -834,7 +841,7 @@ export async function publishThemeToWorkshop(options: {
const completeData = (await completeRes.json()) as Record<string, unknown> & {
themeId?: unknown;
};
onProgress('Theme published successfully!', 100);
onProgress('Upload complete', 100);
return {
success: true,
@@ -849,6 +856,88 @@ export async function publishThemeToWorkshop(options: {
}
}
export interface ThemeReviewQueueResponse {
items: CommunityTheme[];
total: number;
page: number;
totalPages: number;
canModerate: boolean;
}
/**
* Load the staff review queue. New themes stay out of public listings until approved.
*/
export async function fetchThemeReviewQueue(
status: ThemeReviewStatus = 'pending',
page = 1,
limit = 50
): Promise<ThemeReviewQueueResponse> {
const baseUrl = await getThemesServiceUrl();
const headers = await getAuthHeaders();
if (!headers['X-Username'] || !headers['X-Password']) {
throw new Error('Please log in to view the review queue.');
}
const url = new URL(`${baseUrl}/v1/themes/moderation/review`);
url.searchParams.set('status', status);
url.searchParams.set('page', String(page));
url.searchParams.set('limit', String(limit));
const res = await fetch(url.toString(), { headers });
if (!res.ok) {
const errorJson = (await res.json().catch(() => ({}))) as { error?: string };
throw new Error(errorJson.error || `Failed to load the review queue (HTTP ${res.status})`);
}
const data = (await res.json()) as ThemeReviewQueueResponse;
for (const item of data.items) {
if (item.previewUrl && !item.previewUrl.startsWith('http')) {
item.previewUrl = `${baseUrl}${item.previewUrl}`;
}
if (item.downloadUrl && !item.downloadUrl.startsWith('http')) {
item.downloadUrl = `${baseUrl}${item.downloadUrl}`;
}
}
return data;
}
/**
* Approve a pending theme so it becomes publicly listed, or reject it with a note.
*/
export async function reviewCommunityTheme(
themeId: string,
status: 'approved' | 'rejected',
note?: string
): Promise<CommunityTheme> {
const baseUrl = await getThemesServiceUrl();
const headers = await getAuthHeaders();
if (!headers['X-Username'] || !headers['X-Password']) {
throw new Error('Please log in to review themes.');
}
const res = await fetch(`${baseUrl}/v1/themes/${encodeURIComponent(themeId)}/review`, {
method: 'PATCH',
headers: { ...headers, 'Content-Type': 'application/json' },
body: JSON.stringify({ status, note }),
});
if (!res.ok) {
const errorJson = (await res.json().catch(() => ({}))) as { error?: string };
throw new Error(errorJson.error || `Failed to review theme (HTTP ${res.status})`);
}
const item = (await res.json()) as CommunityTheme;
if (item.previewUrl && !item.previewUrl.startsWith('http')) {
item.previewUrl = `${baseUrl}${item.previewUrl}`;
}
if (item.downloadUrl && !item.downloadUrl.startsWith('http')) {
item.downloadUrl = `${baseUrl}${item.downloadUrl}`;
}
return item;
}
/**
* Download, extract, and register a community theme into ~/.ezpplauncher/themes/.
*/
@@ -863,19 +952,27 @@ export async function downloadAndInstallCommunityTheme(
reportProgress('Downloading theme package...', 10);
const unlistenDownload = await listen<{ received: number; total: number; progress: number }>(
'download_progress',
(event) => {
reportProgress('Downloading theme package...', Math.round(10 + event.payload.progress * 50));
}
);
// Progress events are global, so ignore those belonging to other themes that are
// downloading at the same time.
const unlistenDownload = await listen<{
theme_name: string;
received: number;
total: number;
progress: number;
}>('download_progress', (event) => {
if (event.payload.theme_name !== theme.name) return;
reportProgress('Downloading theme package...', Math.round(10 + event.payload.progress * 50));
});
const unlistenExtract = await listen<{ extracted: number; total: number; progress: number }>(
'extract_progress',
(event) => {
reportProgress('Extracting theme files...', Math.round(60 + event.payload.progress * 38));
}
);
const unlistenExtract = await listen<{
theme_name: string;
extracted: number;
total: number;
progress: number;
}>('extract_progress', (event) => {
if (event.payload.theme_name !== theme.name) return;
reportProgress('Extracting theme files...', Math.round(60 + event.payload.progress * 38));
});
try {
try {
@@ -37,6 +37,8 @@
const NOTIFICATION_TYPE_LABELS: Record<string, string> = {
theme_hidden: 'Theme hidden',
theme_restored: 'Theme restored',
theme_approved: 'Theme approved',
theme_rejected: 'Theme needs changes',
theme_taken_down: 'Theme taken down',
report_resolved: 'Report resolved',
report_dismissed: 'Report dismissed',
@@ -1,5 +1,6 @@
<script lang="ts">
import DefaultThemePreview from '$assets/default_preview.png';
import { activeThemeDownloads, themeDownloadProgress } from '$lib/communityThemeDownloads';
import {
fetchCommunityTags,
fetchCommunityThemes,
@@ -15,6 +16,8 @@
setCommunityThemeTags,
reportCommunityTheme,
fetchThemeReports,
fetchThemeReviewQueue,
reviewCommunityTheme,
resolveThemeReport,
bulkResolveThemeReports,
downloadThemeReportsCsv,
@@ -117,8 +120,6 @@
let error = $state<string | null>(null);
let latestRequestId = 0;
let downloadingId = $state<string | null>(null);
let downloadProgress = $state(0);
let forkingId = $state<string | null>(null);
let deletingId = $state<string | null>(null);
let moderatingId = $state<string | null>(null);
@@ -147,12 +148,19 @@
let moderationEventActor = $state('');
let moderationEventsPage = $state(1);
let moderationEventsTotalPages = $state(1);
let reviewQueue = $state<CommunityTheme[]>([]);
let reviewTotal = $state(0);
let reviewActionId = $state<string | null>(null);
let selectedReportIds = $state<number[]>([]);
let reportActionId = $state<number | null>(null);
let bulkAction = $state<'hide' | 'resolved' | 'dismissed' | null>(null);
let exportingReports = $state(false);
let exportingEvents = $state(false);
let quarantineId = $state<string | null>(null);
let quarantineTarget = $state<CommunityTheme | null>(null);
let quarantineAction = $state<'take_down' | 'lift'>('take_down');
let quarantineReason = $state('');
let quarantineError = $state<string | null>(null);
let tagEditorTarget = $state<CommunityTheme | null>(null);
let tagEditorTags = $state<string[]>([]);
@@ -194,6 +202,13 @@
{ id: 'broken', label: 'Broken / unusable' },
{ id: 'other', label: 'Other' },
];
const SORT_OPTIONS: Array<{ id: WorkshopSort; label: string }> = [
{ id: 'relevance', label: 'Best match' },
{ id: 'popular', label: 'Most Popular' },
{ id: 'recent', label: 'Most Recent' },
{ id: 'likes', label: 'Most Liked' },
{ id: 'downloads', label: 'Most Downloaded' },
];
const REPORT_STATUS_OPTIONS: Array<{ id: ThemeReportStatus | 'all'; label: string }> = [
{ id: 'open', label: 'Open reports' },
{ id: 'resolved', label: 'Resolved reports' },
@@ -211,6 +226,8 @@
report_dismissed: 'Report dismissed',
quarantine: 'Taken down',
quarantine_restore: 'Takedown lifted',
review_approved: 'Theme approved',
review_rejected: 'Theme rejected',
};
const AUDIT_ACTIONS = [
{ id: 'all', label: 'All actions' },
@@ -221,6 +238,8 @@
{ id: 'report', label: 'Reported' },
{ id: 'report_resolved', label: 'Report resolved' },
{ id: 'report_dismissed', label: 'Report dismissed' },
{ id: 'review_approved', label: 'Theme approved' },
{ id: 'review_rejected', label: 'Theme rejected' },
{ id: 'delete', label: 'Trashed' },
{ id: 'restore_deleted', label: 'Restored from trash' },
{ id: 'delete_permanent', label: 'Permanently deleted' },
@@ -405,34 +424,21 @@
}
}
async function handleDownloadAndApply(theme: CommunityTheme) {
if (downloadingId || theme.deletedAt) return;
async function handleDownloadTheme(theme: CommunityTheme) {
if (theme.deletedAt || activeThemeDownloads.has(theme.id)) return;
downloadingId = theme.id;
downloadProgress = 10;
activeThemeDownloads.add(theme.id);
themeDownloadProgress.set(theme.id, 10);
try {
const res = await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
downloadProgress = progress;
await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
themeDownloadProgress.set(theme.id, progress);
});
sileo.success({
title: 'Theme Installed',
description: `"${theme.name}" has been installed to your library.`,
title: 'Theme downloaded',
description: `"${theme.name}" has been added to your library.`,
});
// Find locally installed theme object
const installed = $custom_themes.find(
(t) => t.folder_name.toLowerCase() === res.folderName.toLowerCase()
);
if (installed) {
if (!isThemeTrusted(installed)) {
onRequestTrust(installed);
} else {
await onApplyTheme(installed);
}
}
} catch (err) {
console.error(err);
sileo.error({
@@ -440,8 +446,8 @@
description: err instanceof Error ? err.message : String(err),
});
} finally {
downloadingId = null;
downloadProgress = 0;
activeThemeDownloads.delete(theme.id);
themeDownloadProgress.delete(theme.id);
}
}
@@ -450,7 +456,7 @@
const installed =
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
if (!installed) {
await handleDownloadAndApply(theme);
await handleDownloadTheme(theme);
return;
}
@@ -462,17 +468,24 @@
}
async function handleEditTheme(theme: CommunityTheme) {
if (theme.deletedAt || downloadingId || forkingId || deletingId || moderatingId) return;
if (
theme.deletedAt ||
activeThemeDownloads.has(theme.id) ||
forkingId ||
deletingId ||
moderatingId
)
return;
let installed =
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
if (!installed) {
downloadingId = theme.id;
downloadProgress = 10;
activeThemeDownloads.add(theme.id);
themeDownloadProgress.set(theme.id, 10);
try {
await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
downloadProgress = progress;
await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
themeDownloadProgress.set(theme.id, progress);
});
installed = $custom_themes.find(
(candidate) => candidate.folder_name.toLowerCase() === theme.id.toLowerCase()
@@ -484,8 +497,8 @@
});
return;
} finally {
downloadingId = null;
downloadProgress = 0;
activeThemeDownloads.delete(theme.id);
themeDownloadProgress.delete(theme.id);
}
}
@@ -495,7 +508,14 @@
}
async function handleRefreshOwnedTheme(theme: CommunityTheme) {
if (theme.deletedAt || downloadingId || forkingId || deletingId || moderatingId) return;
if (
theme.deletedAt ||
activeThemeDownloads.has(theme.id) ||
forkingId ||
deletingId ||
moderatingId
)
return;
const installed =
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
@@ -513,11 +533,11 @@
);
if (!confirmed) return;
downloadingId = theme.id;
downloadProgress = 10;
activeThemeDownloads.add(theme.id);
themeDownloadProgress.set(theme.id, 10);
try {
const res = await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
downloadProgress = progress;
const res = await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
themeDownloadProgress.set(theme.id, progress);
});
const refreshed = $custom_themes.find(
(candidate) => candidate.folder_name.toLowerCase() === res.folderName.toLowerCase()
@@ -536,13 +556,13 @@
description: err instanceof Error ? err.message : String(err),
});
} finally {
downloadingId = null;
downloadProgress = 0;
activeThemeDownloads.delete(theme.id);
themeDownloadProgress.delete(theme.id);
}
}
async function handleToggleVisibility(theme: CommunityTheme) {
if (!canModerate || moderatingId || downloadingId || forkingId || deletingId) return;
if (!canModerate || moderatingId || forkingId || deletingId) return;
const hiding = !theme.isHidden;
let reason: string | undefined;
@@ -704,7 +724,6 @@
theme.deletedAt ||
theme.isHidden ||
theme.allowForking === false ||
downloadingId ||
forkingId ||
deletingId ||
moderatingId
@@ -735,10 +754,10 @@
let installed: Theme | undefined;
try {
await loadWorkshopThemes();
downloadingId = fork.id;
downloadProgress = 10;
const res = await downloadAndInstallCommunityTheme(fork, (msg, progress) => {
downloadProgress = progress;
activeThemeDownloads.add(fork.id);
themeDownloadProgress.set(fork.id, 10);
const res = await downloadAndInstallCommunityTheme(fork, (_status, progress) => {
themeDownloadProgress.set(fork.id, progress);
});
installed = $custom_themes.find(
(candidate) => candidate.folder_name.toLowerCase() === res.folderName.toLowerCase()
@@ -749,8 +768,8 @@
description: `${err instanceof Error ? err.message : String(err)} You can download it from the workshop.`,
});
} finally {
downloadingId = null;
downloadProgress = 0;
activeThemeDownloads.delete(fork.id);
themeDownloadProgress.delete(fork.id);
}
if (installed) {
@@ -763,7 +782,7 @@
}
async function handleDeleteTheme(theme: CommunityTheme) {
if (theme.deletedAt || deletingId || downloadingId || forkingId || moderatingId) return;
if (theme.deletedAt || deletingId || forkingId || moderatingId) return;
const confirmed = window.confirm(
`Move "${theme.name}" to the trash?\n\nYou can restore it from the Trash view later. Installed copies stay on your computer.`
);
@@ -789,16 +808,14 @@
}
function openRestoreDialog(theme: CommunityTheme) {
if (restoringId || purgingId || downloadingId || forkingId || deletingId || moderatingId)
return;
if (restoringId || purgingId || forkingId || deletingId || moderatingId) return;
purgeTarget = null;
trashActionError = null;
restoreTarget = theme;
}
function openPermanentDeleteDialog(theme: CommunityTheme) {
if (restoringId || purgingId || downloadingId || forkingId || deletingId || moderatingId)
return;
if (restoringId || purgingId || forkingId || deletingId || moderatingId) return;
restoreTarget = null;
trashActionError = null;
purgeTarget = theme;
@@ -932,11 +949,14 @@
moderationLoading = true;
moderationError = null;
try {
const [reportsResult, eventsResult] = await Promise.all([
const [reportsResult, eventsResult, reviewResult] = await Promise.all([
fetchThemeReports({ ...currentReportFilters(), page, limit: 50 }),
fetchModerationEvents({ ...currentEventFilters(), page: 1, limit: 50 }),
fetchThemeReviewQueue('pending', 1, 50),
]);
moderationReports = reportsResult.reports;
reviewQueue = reviewResult.items;
reviewTotal = reviewResult.total;
moderationTotal = reportsResult.total;
moderationPage = reportsResult.page;
moderationTotalPages = reportsResult.totalPages;
@@ -963,6 +983,41 @@
void loadModerationPanel(1);
}
async function handleReviewTheme(theme: CommunityTheme, status: 'approved' | 'rejected') {
if (reviewActionId) return;
let note: string | undefined;
if (status === 'rejected') {
const answer = window.prompt(
`Reject "${theme.name}"? Add an optional note for the creator:`,
''
);
if (answer === null) return;
note = answer.trim() || undefined;
}
reviewActionId = theme.id;
try {
await reviewCommunityTheme(theme.id, status, note);
sileo.success({
title: status === 'approved' ? 'Theme approved' : 'Theme rejected',
description:
status === 'approved'
? `"${theme.name}" is now listed in the Community Workshop.`
: `"${theme.name}" stays hidden until the creator republishes it.`,
});
await loadModerationPanel(moderationPage);
void loadWorkshopThemes();
} catch (err) {
sileo.error({
title: 'Could not review theme',
description: err instanceof Error ? err.message : String(err),
});
} finally {
reviewActionId = null;
}
}
function handleAuditFilterChange() {
moderationEventsPage = 1;
selectedReportIds = [];
@@ -1011,38 +1066,46 @@
}
}
async function handleToggleQuarantine(theme: CommunityTheme) {
function handleToggleQuarantine(theme: CommunityTheme) {
if (!canModerate || quarantineId) return;
const takingDown = !theme.isQuarantined;
const reason = takingDown
? window.prompt(
`Take down "${theme.name}"?\n\nReason shown to the owner and stored in the audit log:`,
theme.quarantineReason || ''
)
: window.prompt(
`Lift the takedown on "${theme.name}"?\n\nOptional note for the audit log:`,
''
);
if (reason === null) return;
if (takingDown && reason.trim().length < 3) {
sileo.error({ title: 'A takedown reason is required' });
quarantineTarget = theme;
quarantineAction = theme.isQuarantined ? 'lift' : 'take_down';
quarantineReason = '';
quarantineError = null;
}
function closeQuarantineDialog() {
if (quarantineId) return;
quarantineTarget = null;
quarantineReason = '';
quarantineError = null;
}
async function confirmQuarantine() {
const theme = quarantineTarget;
if (!theme || quarantineId) return;
const takingDown = quarantineAction === 'take_down';
const reason = quarantineReason.trim();
if (takingDown && reason.length < 3) {
quarantineError = 'Please provide a reason of at least 3 characters.';
return;
}
quarantineId = theme.id;
quarantineError = null;
try {
await setCommunityThemeQuarantine(theme.id, takingDown, reason.trim() || undefined);
await setCommunityThemeQuarantine(theme.id, takingDown, reason || undefined);
sileo.success({
title: takingDown ? 'Theme taken down' : 'Takedown lifted',
description: `"${theme.name}" was updated.`,
});
quarantineTarget = null;
quarantineReason = '';
await loadWorkshopThemes();
if (showModerationPanel) await loadModerationPanel(moderationPage);
} catch (err) {
sileo.error({
title: 'Could not update takedown',
description: err instanceof Error ? err.message : String(err),
});
quarantineError = err instanceof Error ? err.message : String(err);
} finally {
quarantineId = null;
}
@@ -1436,17 +1499,26 @@
<!-- Controls Right: Sort, Search, Moderation, Trash & Refresh -->
<div class="flex shrink-0 items-center gap-2">
<select
class="h-7.5 rounded-lg border border-theme-800 bg-theme-950/80 px-2.5 text-[11px] text-muted-foreground outline-none transition-colors hover:text-white focus:border-primary/50"
<Select.Root
type="single"
value={selectedSort}
onchange={(e) => handleSortChange(parseWorkshopSort(e.currentTarget.value))}
onValueChange={(value) => {
if (!value) return;
handleSortChange(parseWorkshopSort(value));
}}
>
<option value="relevance">Best match</option>
<option value="popular">Most Popular</option>
<option value="recent">Most Recent</option>
<option value="likes">Most Liked</option>
<option value="downloads">Most Downloaded</option>
</select>
<Select.Trigger
class="h-7.5 w-36 border-theme-800 bg-theme-950/80 px-2.5 text-[11px] text-muted-foreground transition-colors hover:text-white"
aria-label="Sort themes"
>
{SORT_OPTIONS.find((option) => option.id === selectedSort)?.label ?? 'Best match'}
</Select.Trigger>
<Select.Content class="border-theme-800 bg-theme-950">
{#each SORT_OPTIONS as option (option.id)}
<Select.Item value={option.id} label={option.label} />
{/each}
</Select.Content>
</Select.Root>
<div class="relative w-48">
<Search
@@ -1567,7 +1639,8 @@
{@const isActive = Boolean(
localTheme && $active_custom_theme?.folder_name === localTheme.folder_name
)}
{@const isDownloading = downloadingId === theme.id}
{@const isDownloading = activeThemeDownloads.has(theme.id)}
{@const downloadPercent = themeDownloadProgress.get(theme.id) ?? 0}
{@const isDeleted = Boolean(theme.deletedAt)}
{@const hasUpdate = Boolean(
!isDeleted && localTheme && localTheme.version !== theme.version
@@ -1629,6 +1702,37 @@
{/snippet}
</WorkshopTooltip>
{/if}
{#if theme.reviewStatus === 'pending'}
<WorkshopTooltip
content="Waiting for staff review before it is listed publicly"
>
{#snippet trigger(props)}
<span
{...props}
tabindex="-1"
class="flex items-center gap-1 rounded-md border border-amber-500/40 bg-amber-950/85 px-1.5 py-0.5 text-[9px] font-medium text-amber-200 backdrop-blur-sm"
>
<LoaderCircle class="size-3" />
In review
</span>
{/snippet}
</WorkshopTooltip>
{:else if theme.reviewStatus === 'rejected'}
<WorkshopTooltip
content={`Not approved${theme.reviewNote ? `: ${theme.reviewNote}` : ''}`}
>
{#snippet trigger(props)}
<span
{...props}
tabindex="-1"
class="flex items-center gap-1 rounded-md border border-red-500/40 bg-red-950/85 px-1.5 py-0.5 text-[9px] font-medium text-red-200 backdrop-blur-sm"
>
<X class="size-3" />
Rejected
</span>
{/snippet}
</WorkshopTooltip>
{/if}
{#if theme.isHidden}
<WorkshopTooltip
content={`${theme.hiddenReason || 'Hidden by a moderator'}${
@@ -1899,12 +2003,12 @@
{#if isDownloading}
<div class="flex items-center gap-2">
<span class="text-[10px] text-primary tabular-nums"
>{downloadProgress}%</span
>{downloadPercent}%</span
>
<div class="h-1.5 w-16 overflow-hidden rounded-full bg-theme-800">
<div
class="h-full bg-primary transition-all duration-200"
style="width: {downloadProgress}%"
style="width: {downloadPercent}%"
></div>
</div>
</div>
@@ -1981,7 +2085,7 @@
<Button
size="sm"
class="h-7 gap-1 text-xs bg-cyan-600 hover:bg-cyan-500 text-white font-medium"
onclick={() => handleDownloadAndApply(theme)}
onclick={() => handleDownloadTheme(theme)}
>
<Download class="size-3" />
Update
@@ -1999,10 +2103,10 @@
<Button
size="sm"
class="h-7 gap-1 text-xs"
onclick={() => handleDownloadAndApply(theme)}
onclick={() => handleDownloadTheme(theme)}
>
<Download class="size-3" />
Download & Apply
Download
</Button>
{/if}
@@ -2158,7 +2262,7 @@
Moderation
</Dialog.Title>
<Dialog.Description class="mt-1 text-[11px] text-muted-foreground">
Open reports and recent staff activity.
Themes awaiting review, open reports and recent staff activity.
</Dialog.Description>
</div>
<div class="flex items-center gap-1">
@@ -2372,6 +2476,76 @@
<LoaderCircle class="size-4 animate-spin text-primary" /> Loading moderation data...
</div>
{:else}
<section>
<h3
class="flex items-center gap-2 text-[11px] font-semibold tracking-wide text-white/80 uppercase"
>
<ShieldCheck class="size-3.5 text-cyan-300" />
Review queue
<Badge
variant="secondary"
class="bg-theme-800 px-1.5 py-0.5 text-[10px] font-normal text-muted-foreground"
>
{reviewTotal}
</Badge>
</h3>
{#if reviewQueue.length === 0}
<p
class="mt-2 rounded-lg border border-theme-800/60 bg-theme-900/20 p-3 text-[11px] text-muted-foreground"
>
No themes are waiting for review.
</p>
{:else}
<div class="mt-2 space-y-2">
{#each reviewQueue as theme (theme.id)}
<div
class="flex items-start justify-between gap-3 rounded-lg border border-theme-800/70 bg-theme-900/30 p-3"
>
<div class="min-w-0">
<p class="truncate text-xs font-semibold text-white">{theme.name}</p>
<p class="mt-0.5 text-[10px] text-muted-foreground">
by {theme.author.name} · v{theme.version} ·
{formatModerationDate(theme.createdAt)}
</p>
{#if theme.description}
<p
class="mt-1 line-clamp-2 text-[10px] leading-relaxed text-muted-foreground"
>
{theme.description}
</p>
{/if}
</div>
<div class="flex shrink-0 items-center gap-1.5">
<Button
size="sm"
class="h-7 gap-1 text-xs"
onclick={() => void handleReviewTheme(theme, 'approved')}
disabled={reviewActionId === theme.id}
>
{#if reviewActionId === theme.id}
<LoaderCircle class="size-3 animate-spin" />
{:else}
<Check class="size-3" />
{/if}
Approve
</Button>
<Button
variant="ghost"
size="sm"
class="h-7 gap-1 text-xs text-red-300 hover:bg-red-500/10 hover:text-red-200"
onclick={() => void handleReviewTheme(theme, 'rejected')}
disabled={reviewActionId === theme.id}
>
<X class="size-3" />
Reject
</Button>
</div>
</div>
{/each}
</div>
{/if}
</section>
<section>
<h3
class="flex items-center gap-2 text-[11px] font-semibold tracking-wide text-white/80 uppercase"
@@ -2730,18 +2904,30 @@
{announcementMessage.trim().length}/1000 · minimum 10
</span>
</label>
<label class="block space-y-1.5">
<div class="block space-y-1.5">
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
>Audience</span
>
<select
class="h-8 w-full rounded-md border border-theme-800 bg-theme-900/60 px-2 text-[11px] text-white outline-none focus:border-primary/50"
bind:value={announcementAudience}
<Select.Root
type="single"
value={announcementAudience}
onValueChange={(value) => {
if (!value) return;
announcementAudience = value as 'all' | 'staff';
}}
>
<option value="all">Everyone</option>
<option value="staff">Staff only</option>
</select>
</label>
<Select.Trigger
class="h-8 border-theme-800 bg-theme-900/60 text-[11px] text-white"
aria-label="Announcement audience"
>
{announcementAudience === 'staff' ? 'Staff only' : 'Everyone'}
</Select.Trigger>
<Select.Content class="border-theme-800 bg-theme-950">
<Select.Item value="all" label="Everyone" />
<Select.Item value="staff" label="Staff only" />
</Select.Content>
</Select.Root>
</div>
{#if announcementError}
<p
class="rounded-lg border border-red-900/40 bg-red-950/20 p-2.5 text-[11px] text-red-300"
@@ -3006,6 +3192,109 @@
</div>
{/if}
{#if quarantineTarget}
<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
<button
type="button"
class="absolute inset-0 cursor-default bg-black/75 backdrop-blur-sm"
aria-label="Close takedown dialog"
onclick={closeQuarantineDialog}
></button>
<div
class="relative w-full max-w-md overflow-hidden rounded-xl border border-theme-800 bg-theme-950 shadow-2xl"
role="dialog"
aria-modal="true"
aria-labelledby="quarantine-theme-title"
>
<div class="flex items-start justify-between gap-3 border-b border-theme-800/70 p-4">
<div>
<h2
id="quarantine-theme-title"
class="flex items-center gap-2 text-sm font-semibold text-white"
>
<Ban class="size-4 text-red-300" />
{quarantineAction === 'take_down' ? 'Take down theme' : 'Lift takedown'}
</h2>
<p class="mt-1 pr-2 text-[11px] leading-relaxed text-muted-foreground">
{#if quarantineAction === 'take_down'}
"{quarantineTarget.name}" will disappear from public search, downloads, previews and
updates until the takedown is lifted. The owner and open reporters are notified.
{:else}
"{quarantineTarget.name}" will become publicly visible again unless it is hidden or
still awaiting review.
{/if}
</p>
</div>
<Button
variant="ghost"
size="icon"
class="size-7 shrink-0 text-muted-foreground hover:text-white"
onclick={closeQuarantineDialog}
disabled={Boolean(quarantineId)}
aria-label="Close takedown dialog"
>
<X class="size-4" />
</Button>
</div>
<div class="space-y-3 p-4">
<label class="block space-y-1.5">
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
>{quarantineAction === 'take_down' ? 'Reason' : 'Note (optional)'}</span
>
<textarea
class="min-h-24 w-full resize-y rounded-md border border-theme-800 bg-theme-900/60 p-2.5 text-[11px] leading-relaxed text-white outline-none placeholder:text-muted-foreground/60 focus:border-primary/50"
rows="4"
maxlength="500"
placeholder={quarantineAction === 'take_down'
? 'Explain why the theme is being taken down...'
: 'Optional note for the audit log...'}
bind:value={quarantineReason}
disabled={Boolean(quarantineId)}
oninput={() => (quarantineError = null)}
></textarea>
<span class="block text-right text-[9px] text-muted-foreground">
{quarantineReason.trim().length}/500
</span>
</label>
{#if quarantineError}
<p
class="rounded-lg border border-red-900/40 bg-red-950/20 p-2.5 text-[11px] text-red-300"
>
{quarantineError}
</p>
{/if}
</div>
<div class="flex items-center justify-end gap-2 border-t border-theme-800/70 p-3">
<Button
variant="ghost"
size="sm"
class="h-8 text-xs"
onclick={closeQuarantineDialog}
disabled={Boolean(quarantineId)}
>
Cancel
</Button>
<Button
variant={quarantineAction === 'take_down' ? 'destructive' : 'default'}
size="sm"
class="h-8 gap-1 text-xs"
onclick={() => void confirmQuarantine()}
disabled={Boolean(quarantineId)}
>
{#if quarantineId}
<LoaderCircle class="size-3 animate-spin" /> Updating...
{:else}
<Ban class="size-3" />
{quarantineAction === 'take_down' ? 'Take down theme' : 'Lift takedown'}
{/if}
</Button>
</div>
</div>
</div>
{/if}
{#if reportTarget}
<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
<button
@@ -3052,19 +3341,32 @@
</WorkshopTooltip>
</div>
<div class="space-y-3 p-4">
<label class="block space-y-1.5">
<div class="block space-y-1.5">
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
>Category</span
>
<select
class="h-8 w-full rounded-md border border-theme-800 bg-theme-900/60 px-2 text-[11px] text-white outline-none focus:border-primary/50"
bind:value={reportCategory}
<Select.Root
type="single"
value={reportCategory}
onValueChange={(value) => {
if (!value) return;
reportCategory = value as ThemeReportCategory;
}}
>
{#each REPORT_CATEGORIES as category (category.id)}
<option value={category.id}>{category.label}</option>
{/each}
</select>
</label>
<Select.Trigger
class="h-8 border-theme-800 bg-theme-900/60 text-[11px] text-white"
aria-label="Report category"
>
{REPORT_CATEGORIES.find((category) => category.id === reportCategory)?.label ??
'Other'}
</Select.Trigger>
<Select.Content class="border-theme-800 bg-theme-950">
{#each REPORT_CATEGORIES as category (category.id)}
<Select.Item value={category.id} label={category.label} />
{/each}
</Select.Content>
</Select.Root>
</div>
<label class="block space-y-1.5">
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
>Details</span
@@ -3404,6 +3404,7 @@
if (!savedFolder) return;
}
const firstPublish = !definition.workshopId;
publishing = true;
publishProgress = 5;
publishStatusMessage = 'Packaging theme archive...';
@@ -3452,8 +3453,10 @@
}
sileo.success({
title: 'Published to Workshop!',
description: `"${definition.name}" is now live in the Community Themes Workshop.`,
title: firstPublish ? 'Submitted for review' : 'Workshop update submitted',
description: firstPublish
? `"${definition.name}" will be listed once a moderator approves it.`
: `"${definition.name}" was updated in the Community Workshop.`,
});
publishModalOpen = false;
+5 -1
View File
@@ -3135,7 +3135,11 @@
{/if}
</div>
<p class="mt-0.5 truncate text-[11px] text-muted-foreground">
{activeSettings.description}
{#if $reduceAnimations}
{activeSettings.description}
{:else}
<TextMorph text={activeSettings.description} />
{/if}
</p>
</div>
<div