Compare commits
7
Commits
fc128b7178
...
4d57184b73
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d57184b73 | ||
|
|
d555ac366f | ||
|
|
918f8651dd | ||
|
|
4b039c9b79 | ||
|
|
809fca6f29 | ||
|
|
0025313c4d | ||
|
|
6b1ed5aa1a |
No files matched your search
@@ -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
@@ -32,6 +32,8 @@ export interface ThemeSearchMatch {
|
|||||||
score: number;
|
score: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ThemeReviewStatus = 'pending' | 'approved' | 'rejected';
|
||||||
|
|
||||||
export interface CommunityTheme {
|
export interface CommunityTheme {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -45,6 +47,11 @@ export interface CommunityTheme {
|
|||||||
likeCount: number;
|
likeCount: number;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
allowForking: boolean;
|
allowForking: boolean;
|
||||||
|
reviewStatus: ThemeReviewStatus;
|
||||||
|
reviewNote: string | null;
|
||||||
|
reviewedAt: string | null;
|
||||||
|
reviewedBy: number | null;
|
||||||
|
reviewedByName: string | null;
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
updatedAt: string;
|
updatedAt: string;
|
||||||
author: CommunityThemeAuthor;
|
author: CommunityThemeAuthor;
|
||||||
@@ -834,7 +841,7 @@ export async function publishThemeToWorkshop(options: {
|
|||||||
const completeData = (await completeRes.json()) as Record<string, unknown> & {
|
const completeData = (await completeRes.json()) as Record<string, unknown> & {
|
||||||
themeId?: unknown;
|
themeId?: unknown;
|
||||||
};
|
};
|
||||||
onProgress('Theme published successfully!', 100);
|
onProgress('Upload complete', 100);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
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/.
|
* Download, extract, and register a community theme into ~/.ezpplauncher/themes/.
|
||||||
*/
|
*/
|
||||||
@@ -863,19 +952,27 @@ export async function downloadAndInstallCommunityTheme(
|
|||||||
|
|
||||||
reportProgress('Downloading theme package...', 10);
|
reportProgress('Downloading theme package...', 10);
|
||||||
|
|
||||||
const unlistenDownload = await listen<{ received: number; total: number; progress: number }>(
|
// Progress events are global, so ignore those belonging to other themes that are
|
||||||
'download_progress',
|
// downloading at the same time.
|
||||||
(event) => {
|
const unlistenDownload = await listen<{
|
||||||
reportProgress('Downloading theme package...', Math.round(10 + event.payload.progress * 50));
|
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 }>(
|
const unlistenExtract = await listen<{
|
||||||
'extract_progress',
|
theme_name: string;
|
||||||
(event) => {
|
extracted: number;
|
||||||
reportProgress('Extracting theme files...', Math.round(60 + event.payload.progress * 38));
|
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 {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
const NOTIFICATION_TYPE_LABELS: Record<string, string> = {
|
const NOTIFICATION_TYPE_LABELS: Record<string, string> = {
|
||||||
theme_hidden: 'Theme hidden',
|
theme_hidden: 'Theme hidden',
|
||||||
theme_restored: 'Theme restored',
|
theme_restored: 'Theme restored',
|
||||||
|
theme_approved: 'Theme approved',
|
||||||
|
theme_rejected: 'Theme needs changes',
|
||||||
theme_taken_down: 'Theme taken down',
|
theme_taken_down: 'Theme taken down',
|
||||||
report_resolved: 'Report resolved',
|
report_resolved: 'Report resolved',
|
||||||
report_dismissed: 'Report dismissed',
|
report_dismissed: 'Report dismissed',
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import DefaultThemePreview from '$assets/default_preview.png';
|
import DefaultThemePreview from '$assets/default_preview.png';
|
||||||
|
import { activeThemeDownloads, themeDownloadProgress } from '$lib/communityThemeDownloads';
|
||||||
import {
|
import {
|
||||||
fetchCommunityTags,
|
fetchCommunityTags,
|
||||||
fetchCommunityThemes,
|
fetchCommunityThemes,
|
||||||
@@ -15,6 +16,8 @@
|
|||||||
setCommunityThemeTags,
|
setCommunityThemeTags,
|
||||||
reportCommunityTheme,
|
reportCommunityTheme,
|
||||||
fetchThemeReports,
|
fetchThemeReports,
|
||||||
|
fetchThemeReviewQueue,
|
||||||
|
reviewCommunityTheme,
|
||||||
resolveThemeReport,
|
resolveThemeReport,
|
||||||
bulkResolveThemeReports,
|
bulkResolveThemeReports,
|
||||||
downloadThemeReportsCsv,
|
downloadThemeReportsCsv,
|
||||||
@@ -117,8 +120,6 @@
|
|||||||
let error = $state<string | null>(null);
|
let error = $state<string | null>(null);
|
||||||
let latestRequestId = 0;
|
let latestRequestId = 0;
|
||||||
|
|
||||||
let downloadingId = $state<string | null>(null);
|
|
||||||
let downloadProgress = $state(0);
|
|
||||||
let forkingId = $state<string | null>(null);
|
let forkingId = $state<string | null>(null);
|
||||||
let deletingId = $state<string | null>(null);
|
let deletingId = $state<string | null>(null);
|
||||||
let moderatingId = $state<string | null>(null);
|
let moderatingId = $state<string | null>(null);
|
||||||
@@ -147,12 +148,19 @@
|
|||||||
let moderationEventActor = $state('');
|
let moderationEventActor = $state('');
|
||||||
let moderationEventsPage = $state(1);
|
let moderationEventsPage = $state(1);
|
||||||
let moderationEventsTotalPages = $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 selectedReportIds = $state<number[]>([]);
|
||||||
let reportActionId = $state<number | null>(null);
|
let reportActionId = $state<number | null>(null);
|
||||||
let bulkAction = $state<'hide' | 'resolved' | 'dismissed' | null>(null);
|
let bulkAction = $state<'hide' | 'resolved' | 'dismissed' | null>(null);
|
||||||
let exportingReports = $state(false);
|
let exportingReports = $state(false);
|
||||||
let exportingEvents = $state(false);
|
let exportingEvents = $state(false);
|
||||||
let quarantineId = $state<string | null>(null);
|
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 tagEditorTarget = $state<CommunityTheme | null>(null);
|
||||||
let tagEditorTags = $state<string[]>([]);
|
let tagEditorTags = $state<string[]>([]);
|
||||||
@@ -194,6 +202,13 @@
|
|||||||
{ id: 'broken', label: 'Broken / unusable' },
|
{ id: 'broken', label: 'Broken / unusable' },
|
||||||
{ id: 'other', label: 'Other' },
|
{ 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 }> = [
|
const REPORT_STATUS_OPTIONS: Array<{ id: ThemeReportStatus | 'all'; label: string }> = [
|
||||||
{ id: 'open', label: 'Open reports' },
|
{ id: 'open', label: 'Open reports' },
|
||||||
{ id: 'resolved', label: 'Resolved reports' },
|
{ id: 'resolved', label: 'Resolved reports' },
|
||||||
@@ -211,6 +226,8 @@
|
|||||||
report_dismissed: 'Report dismissed',
|
report_dismissed: 'Report dismissed',
|
||||||
quarantine: 'Taken down',
|
quarantine: 'Taken down',
|
||||||
quarantine_restore: 'Takedown lifted',
|
quarantine_restore: 'Takedown lifted',
|
||||||
|
review_approved: 'Theme approved',
|
||||||
|
review_rejected: 'Theme rejected',
|
||||||
};
|
};
|
||||||
const AUDIT_ACTIONS = [
|
const AUDIT_ACTIONS = [
|
||||||
{ id: 'all', label: 'All actions' },
|
{ id: 'all', label: 'All actions' },
|
||||||
@@ -221,6 +238,8 @@
|
|||||||
{ id: 'report', label: 'Reported' },
|
{ id: 'report', label: 'Reported' },
|
||||||
{ id: 'report_resolved', label: 'Report resolved' },
|
{ id: 'report_resolved', label: 'Report resolved' },
|
||||||
{ id: 'report_dismissed', label: 'Report dismissed' },
|
{ id: 'report_dismissed', label: 'Report dismissed' },
|
||||||
|
{ id: 'review_approved', label: 'Theme approved' },
|
||||||
|
{ id: 'review_rejected', label: 'Theme rejected' },
|
||||||
{ id: 'delete', label: 'Trashed' },
|
{ id: 'delete', label: 'Trashed' },
|
||||||
{ id: 'restore_deleted', label: 'Restored from trash' },
|
{ id: 'restore_deleted', label: 'Restored from trash' },
|
||||||
{ id: 'delete_permanent', label: 'Permanently deleted' },
|
{ id: 'delete_permanent', label: 'Permanently deleted' },
|
||||||
@@ -405,34 +424,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDownloadAndApply(theme: CommunityTheme) {
|
async function handleDownloadTheme(theme: CommunityTheme) {
|
||||||
if (downloadingId || theme.deletedAt) return;
|
if (theme.deletedAt || activeThemeDownloads.has(theme.id)) return;
|
||||||
|
|
||||||
downloadingId = theme.id;
|
activeThemeDownloads.add(theme.id);
|
||||||
downloadProgress = 10;
|
themeDownloadProgress.set(theme.id, 10);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
|
await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
|
||||||
downloadProgress = progress;
|
themeDownloadProgress.set(theme.id, progress);
|
||||||
});
|
});
|
||||||
|
|
||||||
sileo.success({
|
sileo.success({
|
||||||
title: 'Theme Installed',
|
title: 'Theme downloaded',
|
||||||
description: `"${theme.name}" has been installed to your library.`,
|
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) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
sileo.error({
|
sileo.error({
|
||||||
@@ -440,8 +446,8 @@
|
|||||||
description: err instanceof Error ? err.message : String(err),
|
description: err instanceof Error ? err.message : String(err),
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
downloadingId = null;
|
activeThemeDownloads.delete(theme.id);
|
||||||
downloadProgress = 0;
|
themeDownloadProgress.delete(theme.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +456,7 @@
|
|||||||
const installed =
|
const installed =
|
||||||
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
||||||
if (!installed) {
|
if (!installed) {
|
||||||
await handleDownloadAndApply(theme);
|
await handleDownloadTheme(theme);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,17 +468,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleEditTheme(theme: CommunityTheme) {
|
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 =
|
let installed =
|
||||||
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
||||||
|
|
||||||
if (!installed) {
|
if (!installed) {
|
||||||
downloadingId = theme.id;
|
activeThemeDownloads.add(theme.id);
|
||||||
downloadProgress = 10;
|
themeDownloadProgress.set(theme.id, 10);
|
||||||
try {
|
try {
|
||||||
await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
|
await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
|
||||||
downloadProgress = progress;
|
themeDownloadProgress.set(theme.id, progress);
|
||||||
});
|
});
|
||||||
installed = $custom_themes.find(
|
installed = $custom_themes.find(
|
||||||
(candidate) => candidate.folder_name.toLowerCase() === theme.id.toLowerCase()
|
(candidate) => candidate.folder_name.toLowerCase() === theme.id.toLowerCase()
|
||||||
@@ -484,8 +497,8 @@
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
downloadingId = null;
|
activeThemeDownloads.delete(theme.id);
|
||||||
downloadProgress = 0;
|
themeDownloadProgress.delete(theme.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,7 +508,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleRefreshOwnedTheme(theme: CommunityTheme) {
|
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 =
|
const installed =
|
||||||
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
localThemeMap.get(theme.id.toLowerCase()) || localThemeMap.get(theme.name.toLowerCase());
|
||||||
@@ -513,11 +533,11 @@
|
|||||||
);
|
);
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
|
|
||||||
downloadingId = theme.id;
|
activeThemeDownloads.add(theme.id);
|
||||||
downloadProgress = 10;
|
themeDownloadProgress.set(theme.id, 10);
|
||||||
try {
|
try {
|
||||||
const res = await downloadAndInstallCommunityTheme(theme, (msg, progress) => {
|
const res = await downloadAndInstallCommunityTheme(theme, (_status, progress) => {
|
||||||
downloadProgress = progress;
|
themeDownloadProgress.set(theme.id, progress);
|
||||||
});
|
});
|
||||||
const refreshed = $custom_themes.find(
|
const refreshed = $custom_themes.find(
|
||||||
(candidate) => candidate.folder_name.toLowerCase() === res.folderName.toLowerCase()
|
(candidate) => candidate.folder_name.toLowerCase() === res.folderName.toLowerCase()
|
||||||
@@ -536,13 +556,13 @@
|
|||||||
description: err instanceof Error ? err.message : String(err),
|
description: err instanceof Error ? err.message : String(err),
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
downloadingId = null;
|
activeThemeDownloads.delete(theme.id);
|
||||||
downloadProgress = 0;
|
themeDownloadProgress.delete(theme.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleToggleVisibility(theme: CommunityTheme) {
|
async function handleToggleVisibility(theme: CommunityTheme) {
|
||||||
if (!canModerate || moderatingId || downloadingId || forkingId || deletingId) return;
|
if (!canModerate || moderatingId || forkingId || deletingId) return;
|
||||||
|
|
||||||
const hiding = !theme.isHidden;
|
const hiding = !theme.isHidden;
|
||||||
let reason: string | undefined;
|
let reason: string | undefined;
|
||||||
@@ -704,7 +724,6 @@
|
|||||||
theme.deletedAt ||
|
theme.deletedAt ||
|
||||||
theme.isHidden ||
|
theme.isHidden ||
|
||||||
theme.allowForking === false ||
|
theme.allowForking === false ||
|
||||||
downloadingId ||
|
|
||||||
forkingId ||
|
forkingId ||
|
||||||
deletingId ||
|
deletingId ||
|
||||||
moderatingId
|
moderatingId
|
||||||
@@ -735,10 +754,10 @@
|
|||||||
let installed: Theme | undefined;
|
let installed: Theme | undefined;
|
||||||
try {
|
try {
|
||||||
await loadWorkshopThemes();
|
await loadWorkshopThemes();
|
||||||
downloadingId = fork.id;
|
activeThemeDownloads.add(fork.id);
|
||||||
downloadProgress = 10;
|
themeDownloadProgress.set(fork.id, 10);
|
||||||
const res = await downloadAndInstallCommunityTheme(fork, (msg, progress) => {
|
const res = await downloadAndInstallCommunityTheme(fork, (_status, progress) => {
|
||||||
downloadProgress = progress;
|
themeDownloadProgress.set(fork.id, progress);
|
||||||
});
|
});
|
||||||
installed = $custom_themes.find(
|
installed = $custom_themes.find(
|
||||||
(candidate) => candidate.folder_name.toLowerCase() === res.folderName.toLowerCase()
|
(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.`,
|
description: `${err instanceof Error ? err.message : String(err)} You can download it from the workshop.`,
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
downloadingId = null;
|
activeThemeDownloads.delete(fork.id);
|
||||||
downloadProgress = 0;
|
themeDownloadProgress.delete(fork.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (installed) {
|
if (installed) {
|
||||||
@@ -763,7 +782,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeleteTheme(theme: CommunityTheme) {
|
async function handleDeleteTheme(theme: CommunityTheme) {
|
||||||
if (theme.deletedAt || deletingId || downloadingId || forkingId || moderatingId) return;
|
if (theme.deletedAt || deletingId || forkingId || moderatingId) return;
|
||||||
const confirmed = window.confirm(
|
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.`
|
`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) {
|
function openRestoreDialog(theme: CommunityTheme) {
|
||||||
if (restoringId || purgingId || downloadingId || forkingId || deletingId || moderatingId)
|
if (restoringId || purgingId || forkingId || deletingId || moderatingId) return;
|
||||||
return;
|
|
||||||
purgeTarget = null;
|
purgeTarget = null;
|
||||||
trashActionError = null;
|
trashActionError = null;
|
||||||
restoreTarget = theme;
|
restoreTarget = theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPermanentDeleteDialog(theme: CommunityTheme) {
|
function openPermanentDeleteDialog(theme: CommunityTheme) {
|
||||||
if (restoringId || purgingId || downloadingId || forkingId || deletingId || moderatingId)
|
if (restoringId || purgingId || forkingId || deletingId || moderatingId) return;
|
||||||
return;
|
|
||||||
restoreTarget = null;
|
restoreTarget = null;
|
||||||
trashActionError = null;
|
trashActionError = null;
|
||||||
purgeTarget = theme;
|
purgeTarget = theme;
|
||||||
@@ -932,11 +949,14 @@
|
|||||||
moderationLoading = true;
|
moderationLoading = true;
|
||||||
moderationError = null;
|
moderationError = null;
|
||||||
try {
|
try {
|
||||||
const [reportsResult, eventsResult] = await Promise.all([
|
const [reportsResult, eventsResult, reviewResult] = await Promise.all([
|
||||||
fetchThemeReports({ ...currentReportFilters(), page, limit: 50 }),
|
fetchThemeReports({ ...currentReportFilters(), page, limit: 50 }),
|
||||||
fetchModerationEvents({ ...currentEventFilters(), page: 1, limit: 50 }),
|
fetchModerationEvents({ ...currentEventFilters(), page: 1, limit: 50 }),
|
||||||
|
fetchThemeReviewQueue('pending', 1, 50),
|
||||||
]);
|
]);
|
||||||
moderationReports = reportsResult.reports;
|
moderationReports = reportsResult.reports;
|
||||||
|
reviewQueue = reviewResult.items;
|
||||||
|
reviewTotal = reviewResult.total;
|
||||||
moderationTotal = reportsResult.total;
|
moderationTotal = reportsResult.total;
|
||||||
moderationPage = reportsResult.page;
|
moderationPage = reportsResult.page;
|
||||||
moderationTotalPages = reportsResult.totalPages;
|
moderationTotalPages = reportsResult.totalPages;
|
||||||
@@ -963,6 +983,41 @@
|
|||||||
void loadModerationPanel(1);
|
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() {
|
function handleAuditFilterChange() {
|
||||||
moderationEventsPage = 1;
|
moderationEventsPage = 1;
|
||||||
selectedReportIds = [];
|
selectedReportIds = [];
|
||||||
@@ -1011,38 +1066,46 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleToggleQuarantine(theme: CommunityTheme) {
|
function handleToggleQuarantine(theme: CommunityTheme) {
|
||||||
if (!canModerate || quarantineId) return;
|
if (!canModerate || quarantineId) return;
|
||||||
const takingDown = !theme.isQuarantined;
|
quarantineTarget = theme;
|
||||||
const reason = takingDown
|
quarantineAction = theme.isQuarantined ? 'lift' : 'take_down';
|
||||||
? window.prompt(
|
quarantineReason = '';
|
||||||
`Take down "${theme.name}"?\n\nReason shown to the owner and stored in the audit log:`,
|
quarantineError = null;
|
||||||
theme.quarantineReason || ''
|
}
|
||||||
)
|
|
||||||
: window.prompt(
|
function closeQuarantineDialog() {
|
||||||
`Lift the takedown on "${theme.name}"?\n\nOptional note for the audit log:`,
|
if (quarantineId) return;
|
||||||
''
|
quarantineTarget = null;
|
||||||
);
|
quarantineReason = '';
|
||||||
if (reason === null) return;
|
quarantineError = null;
|
||||||
if (takingDown && reason.trim().length < 3) {
|
}
|
||||||
sileo.error({ title: 'A takedown reason is required' });
|
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
quarantineId = theme.id;
|
quarantineId = theme.id;
|
||||||
|
quarantineError = null;
|
||||||
try {
|
try {
|
||||||
await setCommunityThemeQuarantine(theme.id, takingDown, reason.trim() || undefined);
|
await setCommunityThemeQuarantine(theme.id, takingDown, reason || undefined);
|
||||||
sileo.success({
|
sileo.success({
|
||||||
title: takingDown ? 'Theme taken down' : 'Takedown lifted',
|
title: takingDown ? 'Theme taken down' : 'Takedown lifted',
|
||||||
description: `"${theme.name}" was updated.`,
|
description: `"${theme.name}" was updated.`,
|
||||||
});
|
});
|
||||||
|
quarantineTarget = null;
|
||||||
|
quarantineReason = '';
|
||||||
await loadWorkshopThemes();
|
await loadWorkshopThemes();
|
||||||
if (showModerationPanel) await loadModerationPanel(moderationPage);
|
if (showModerationPanel) await loadModerationPanel(moderationPage);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sileo.error({
|
quarantineError = err instanceof Error ? err.message : String(err);
|
||||||
title: 'Could not update takedown',
|
|
||||||
description: err instanceof Error ? err.message : String(err),
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
quarantineId = null;
|
quarantineId = null;
|
||||||
}
|
}
|
||||||
@@ -1436,17 +1499,26 @@
|
|||||||
|
|
||||||
<!-- Controls Right: Sort, Search, Moderation, Trash & Refresh -->
|
<!-- Controls Right: Sort, Search, Moderation, Trash & Refresh -->
|
||||||
<div class="flex shrink-0 items-center gap-2">
|
<div class="flex shrink-0 items-center gap-2">
|
||||||
<select
|
<Select.Root
|
||||||
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"
|
type="single"
|
||||||
value={selectedSort}
|
value={selectedSort}
|
||||||
onchange={(e) => handleSortChange(parseWorkshopSort(e.currentTarget.value))}
|
onValueChange={(value) => {
|
||||||
|
if (!value) return;
|
||||||
|
handleSortChange(parseWorkshopSort(value));
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value="relevance">Best match</option>
|
<Select.Trigger
|
||||||
<option value="popular">Most Popular</option>
|
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"
|
||||||
<option value="recent">Most Recent</option>
|
aria-label="Sort themes"
|
||||||
<option value="likes">Most Liked</option>
|
>
|
||||||
<option value="downloads">Most Downloaded</option>
|
{SORT_OPTIONS.find((option) => option.id === selectedSort)?.label ?? 'Best match'}
|
||||||
</select>
|
</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">
|
<div class="relative w-48">
|
||||||
<Search
|
<Search
|
||||||
@@ -1567,7 +1639,8 @@
|
|||||||
{@const isActive = Boolean(
|
{@const isActive = Boolean(
|
||||||
localTheme && $active_custom_theme?.folder_name === localTheme.folder_name
|
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 isDeleted = Boolean(theme.deletedAt)}
|
||||||
{@const hasUpdate = Boolean(
|
{@const hasUpdate = Boolean(
|
||||||
!isDeleted && localTheme && localTheme.version !== theme.version
|
!isDeleted && localTheme && localTheme.version !== theme.version
|
||||||
@@ -1629,6 +1702,37 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</WorkshopTooltip>
|
</WorkshopTooltip>
|
||||||
{/if}
|
{/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}
|
{#if theme.isHidden}
|
||||||
<WorkshopTooltip
|
<WorkshopTooltip
|
||||||
content={`${theme.hiddenReason || 'Hidden by a moderator'}${
|
content={`${theme.hiddenReason || 'Hidden by a moderator'}${
|
||||||
@@ -1899,12 +2003,12 @@
|
|||||||
{#if isDownloading}
|
{#if isDownloading}
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<span class="text-[10px] text-primary tabular-nums"
|
<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-1.5 w-16 overflow-hidden rounded-full bg-theme-800">
|
||||||
<div
|
<div
|
||||||
class="h-full bg-primary transition-all duration-200"
|
class="h-full bg-primary transition-all duration-200"
|
||||||
style="width: {downloadProgress}%"
|
style="width: {downloadPercent}%"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1981,7 +2085,7 @@
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
class="h-7 gap-1 text-xs bg-cyan-600 hover:bg-cyan-500 text-white font-medium"
|
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" />
|
<Download class="size-3" />
|
||||||
Update
|
Update
|
||||||
@@ -1999,10 +2103,10 @@
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
class="h-7 gap-1 text-xs"
|
class="h-7 gap-1 text-xs"
|
||||||
onclick={() => handleDownloadAndApply(theme)}
|
onclick={() => handleDownloadTheme(theme)}
|
||||||
>
|
>
|
||||||
<Download class="size-3" />
|
<Download class="size-3" />
|
||||||
Download & Apply
|
Download
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -2158,7 +2262,7 @@
|
|||||||
Moderation
|
Moderation
|
||||||
</Dialog.Title>
|
</Dialog.Title>
|
||||||
<Dialog.Description class="mt-1 text-[11px] text-muted-foreground">
|
<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>
|
</Dialog.Description>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
@@ -2372,6 +2476,76 @@
|
|||||||
<LoaderCircle class="size-4 animate-spin text-primary" /> Loading moderation data...
|
<LoaderCircle class="size-4 animate-spin text-primary" /> Loading moderation data...
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{: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>
|
<section>
|
||||||
<h3
|
<h3
|
||||||
class="flex items-center gap-2 text-[11px] font-semibold tracking-wide text-white/80 uppercase"
|
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
|
{announcementMessage.trim().length}/1000 · minimum 10
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</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"
|
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
|
||||||
>Audience</span
|
>Audience</span
|
||||||
>
|
>
|
||||||
<select
|
<Select.Root
|
||||||
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"
|
type="single"
|
||||||
bind:value={announcementAudience}
|
value={announcementAudience}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
if (!value) return;
|
||||||
|
announcementAudience = value as 'all' | 'staff';
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value="all">Everyone</option>
|
<Select.Trigger
|
||||||
<option value="staff">Staff only</option>
|
class="h-8 border-theme-800 bg-theme-900/60 text-[11px] text-white"
|
||||||
</select>
|
aria-label="Announcement audience"
|
||||||
</label>
|
>
|
||||||
|
{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}
|
{#if announcementError}
|
||||||
<p
|
<p
|
||||||
class="rounded-lg border border-red-900/40 bg-red-950/20 p-2.5 text-[11px] text-red-300"
|
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>
|
</div>
|
||||||
{/if}
|
{/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}
|
{#if reportTarget}
|
||||||
<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
|
<div class="fixed inset-0 z-50 flex items-center justify-center p-4">
|
||||||
<button
|
<button
|
||||||
@@ -3052,19 +3341,32 @@
|
|||||||
</WorkshopTooltip>
|
</WorkshopTooltip>
|
||||||
</div>
|
</div>
|
||||||
<div class="space-y-3 p-4">
|
<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"
|
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
|
||||||
>Category</span
|
>Category</span
|
||||||
>
|
>
|
||||||
<select
|
<Select.Root
|
||||||
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"
|
type="single"
|
||||||
bind:value={reportCategory}
|
value={reportCategory}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
if (!value) return;
|
||||||
|
reportCategory = value as ThemeReportCategory;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{#each REPORT_CATEGORIES as category (category.id)}
|
<Select.Trigger
|
||||||
<option value={category.id}>{category.label}</option>
|
class="h-8 border-theme-800 bg-theme-900/60 text-[11px] text-white"
|
||||||
{/each}
|
aria-label="Report category"
|
||||||
</select>
|
>
|
||||||
</label>
|
{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">
|
<label class="block space-y-1.5">
|
||||||
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
|
<span class="text-[10px] font-semibold tracking-wide text-white/70 uppercase"
|
||||||
>Details</span
|
>Details</span
|
||||||
|
|||||||
@@ -3404,6 +3404,7 @@
|
|||||||
if (!savedFolder) return;
|
if (!savedFolder) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const firstPublish = !definition.workshopId;
|
||||||
publishing = true;
|
publishing = true;
|
||||||
publishProgress = 5;
|
publishProgress = 5;
|
||||||
publishStatusMessage = 'Packaging theme archive...';
|
publishStatusMessage = 'Packaging theme archive...';
|
||||||
@@ -3452,8 +3453,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
sileo.success({
|
sileo.success({
|
||||||
title: 'Published to Workshop!',
|
title: firstPublish ? 'Submitted for review' : 'Workshop update submitted',
|
||||||
description: `"${definition.name}" is now live in the Community Themes Workshop.`,
|
description: firstPublish
|
||||||
|
? `"${definition.name}" will be listed once a moderator approves it.`
|
||||||
|
: `"${definition.name}" was updated in the Community Workshop.`,
|
||||||
});
|
});
|
||||||
|
|
||||||
publishModalOpen = false;
|
publishModalOpen = false;
|
||||||
|
|||||||
@@ -3135,7 +3135,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<p class="mt-0.5 truncate text-[11px] text-muted-foreground">
|
<p class="mt-0.5 truncate text-[11px] text-muted-foreground">
|
||||||
{activeSettings.description}
|
{#if $reduceAnimations}
|
||||||
|
{activeSettings.description}
|
||||||
|
{:else}
|
||||||
|
<TextMorph text={activeSettings.description} />
|
||||||
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in new issue
Block a user