style: auto-fix lint and format

This commit is contained in:
ajnart authored and github-actions[bot] committed 2026-06-24 13:51:55 +00:00
1 parent 1cafb5edac
commit e37bd38f34
13 files changed
+224 -216

No files matched your search

+22 -11
View File
@@ -227,7 +227,9 @@ const CommentsSection = ({
const trimmed = editContent.trim();
if (!trimmed) return;
try {
const updated = await pb.collection("comments").update<StoreComment>(id, { content: trimmed }, { expand: "author" });
const updated = await pb
.collection("comments")
.update<StoreComment>(id, { content: trimmed }, { expand: "author" });
setRows((prev) => prev.map((c) => (c.id === id ? updated : c)));
setEditingId(null);
} catch (caught) {
@@ -329,7 +331,12 @@ const DeleteConfirmButton = ({ onConfirm }: { onConfirm: () => void }) => {
const [pending, setPending] = useState(false);
const timer = useRef<ReturnType<typeof setTimeout>>(null);
useEffect(() => () => { if (timer.current) clearTimeout(timer.current); }, []);
useEffect(
() => () => {
if (timer.current) clearTimeout(timer.current);
},
[],
);
const handleClick = () => {
if (!pending) {
@@ -345,7 +352,9 @@ const DeleteConfirmButton = ({ onConfirm }: { onConfirm: () => void }) => {
<Button
variant="outline"
size="sm"
className={cn(pending ? "border-destructive bg-destructive/10 text-destructive" : "text-destructive hover:bg-destructive/10")}
className={cn(
pending ? "border-destructive bg-destructive/10 text-destructive" : "text-destructive hover:bg-destructive/10",
)}
onClick={handleClick}
>
<IconTrash size={14} /> {pending ? "Confirm delete?" : "Delete"}
@@ -465,7 +474,11 @@ const MarketplaceDetail = ({ storeUrl }: { storeUrl: string }) => {
const isToggleOff = prev?.value === value;
const [upD, downD] = voteDelta(prev?.value, value);
setUserVote(isToggleOff ? undefined : { ...(prev ?? { id: "", submission: submission.id, user: userId }), value } as StoreVote);
setUserVote(
isToggleOff
? undefined
: ({ ...(prev ?? { id: "", submission: submission.id, user: userId }), value } as StoreVote),
);
setSubmission((s) => (s ? { ...s, upvotes: s.upvotes + upD, downvotes: s.downvotes + downD } : s));
try {
@@ -577,7 +590,9 @@ const MarketplaceDetail = ({ storeUrl }: { storeUrl: string }) => {
>
<IconArrowBigUp size={18} />
</button>
<span className={cn("min-w-6 text-center text-sm font-semibold tabular-nums", scoreClassBySign[scoreSign(score)])}>
<span
className={cn("min-w-6 text-center text-sm font-semibold tabular-nums", scoreClassBySign[scoreSign(score)])}
>
{score}
</span>
<button
@@ -614,9 +629,7 @@ const MarketplaceDetail = ({ storeUrl }: { storeUrl: string }) => {
<IconDownload size={14} /> Download
</Button>
)}
{user?.id === submission.author && (
<DeleteConfirmButton onConfirm={handleDelete} />
)}
{user?.id === submission.author && <DeleteConfirmButton onConfirm={handleDelete} />}
</div>
<div className="mt-6">
@@ -643,9 +656,7 @@ export default function MarketplaceDetailPage() {
return (
<Layout title="Workshop" description="Community custom CSS and custom widgets for Homarr">
<main className="marketplace bg-background text-foreground min-h-[80vh]">
<BrowserOnly fallback={<DetailSkeleton />}>
{() => <MarketplaceDetail storeUrl={storeUrl} />}
</BrowserOnly>
<BrowserOnly fallback={<DetailSkeleton />}>{() => <MarketplaceDetail storeUrl={storeUrl} />}</BrowserOnly>
</main>
</Layout>
);
+10 -5
View File
@@ -42,7 +42,10 @@ import { useStore } from "./useStore";
const typeDotColors: Record<SubmissionType, string> = { css: "bg-blue-500", widget: "bg-yellow-500" };
const typeLabels: Record<SubmissionType, string> = { css: "CSS", widget: "Widget" };
const typeIcons: Record<SubmissionType, React.ComponentType<{ size: number; className?: string }>> = { css: IconBrandCss3, widget: IconPuzzle };
const typeIcons: Record<SubmissionType, React.ComponentType<{ size: number; className?: string }>> = {
css: IconBrandCss3,
widget: IconPuzzle,
};
const typeBgColors: Record<SubmissionType, string> = { css: "bg-blue-500/5", widget: "bg-yellow-500/5" };
const filterActiveClass = "bg-background text-foreground shadow-sm";
const filterInactiveClass = "text-muted-foreground hover:text-foreground";
@@ -66,7 +69,6 @@ const sortOptions: { value: SortKey; label: string }[] = [
{ value: "new", label: "Newest" },
];
const relativeTime = (date: string) => {
const minutes = Math.floor((Date.now() - new Date(date).getTime()) / 60000);
if (minutes < 1) return "just now";
@@ -191,7 +193,9 @@ export const StoreApp = ({ storeUrl }: { storeUrl: string }) => {
{store.loading && (
<div className="columns-1 gap-4 lg:columns-2 xl:columns-3 2xl:columns-4 [&>*]:mb-4">
{Array.from({ length: 6 }, (_, i) => <SkeletonCard key={i} hasImage={i % 3 === 0} />)}
{Array.from({ length: 6 }, (_, i) => (
<SkeletonCard key={i} hasImage={i % 3 === 0} />
))}
</div>
)}
@@ -422,7 +426,9 @@ const SubmissionCard = ({
<button
className={cn(
"flex items-center gap-1 rounded px-1 py-0.5 text-xs transition-colors",
confirmDelete ? "bg-destructive/10 text-destructive" : "text-muted-foreground/60 hover:text-destructive",
confirmDelete
? "bg-destructive/10 text-destructive"
: "text-muted-foreground/60 hover:text-destructive",
)}
onClick={handleDelete}
aria-label="Delete"
@@ -516,4 +522,3 @@ const ScreenshotGallery = ({ urls, title }: { urls: string[]; title: string }) =
</div>
);
};
+1 -3
View File
@@ -53,9 +53,7 @@ export const useStore = (storeUrl: string) => {
setLoading(true);
setError(null);
try {
setSubmissions(
await pb.collection("marketplace").getFullList<StoreSubmission>({ sort: "-created" }),
);
setSubmissions(await pb.collection("marketplace").getFullList<StoreSubmission>({ sort: "-created" }));
await refreshVotes();
} catch (caught) {
setError(errorMessage(caught, "Failed to load the workshop"));