style: biome format browse/ensurePath changes

This commit is contained in:
noelorin 2026-09-25 04:36:10 +08:00
parent 5a291a9127
commit 99fd2a58e7
6 changed files with 6 additions and 14 deletions

View File

@ -22,10 +22,7 @@ function BrowseInner(props: { locale: Locale }) {
const [path, setPath] = useState("/"); const [path, setPath] = useState("/");
const [crumbs, setCrumbs] = useState<string[]>([]); const [crumbs, setCrumbs] = useState<string[]>([]);
const dir = trpc.media.mountListDir.useQuery( const dir = trpc.media.mountListDir.useQuery({ mountId, path }, { enabled: Boolean(mountId) });
{ mountId, path },
{ enabled: Boolean(mountId) },
);
const scan = trpc.media.libraryScan.useMutation(); const scan = trpc.media.libraryScan.useMutation();
const ensure = trpc.media.libraryEnsurePath.useMutation(); const ensure = trpc.media.libraryEnsurePath.useMutation();
@ -107,9 +104,7 @@ function BrowseInner(props: { locale: Locale }) {
{t(locale, "browse.scanDone", { count: scan.data.scanned })} {t(locale, "browse.scanDone", { count: scan.data.scanned })}
</p> </p>
)} )}
{scan.isError && ( {scan.isError && <p className="text-sm text-red-600">{scan.error.message}</p>}
<p className="text-sm text-red-600">{scan.error.message}</p>
)}
<div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground"> <div className="flex flex-wrap items-center gap-2 text-sm text-muted-foreground">
<button type="button" onClick={goRoot}> <button type="button" onClick={goRoot}>
{t(locale, "browse.root")} {t(locale, "browse.root")}
@ -141,7 +136,10 @@ function BrowseInner(props: { locale: Locale }) {
{(dir.data?.entries ?? []).map((e) => { {(dir.data?.entries ?? []).map((e) => {
const isVideo = e.type === "file" && VIDEO_RE.test(e.basename); const isVideo = e.type === "file" && VIDEO_RE.test(e.basename);
return ( return (
<li key={e.filename} className="flex items-center justify-between gap-3 p-3 text-sm"> <li
key={e.filename}
className="flex items-center justify-between gap-3 p-3 text-sm"
>
{e.type === "directory" ? ( {e.type === "directory" ? (
<button <button
type="button" type="button"
@ -195,4 +193,3 @@ export function BrowseBody(props: { locale: Locale }) {
</QueryClientProvider> </QueryClientProvider>
); );
} }

View File

@ -134,4 +134,3 @@ export const en: Record<MessageKey, string> = {
"error.internal.desc": "error.internal.desc":
"The server hit an unexpected error. Retry later and report the path if it persists.", "The server hit an unexpected error. Retry later and report the path if it persists.",
}; };

View File

@ -136,4 +136,3 @@ export const zhCN = {
export type MessageKey = keyof typeof zhCN; export type MessageKey = keyof typeof zhCN;
export type Messages = Record<MessageKey, string>; export type Messages = Record<MessageKey, string>;

View File

@ -88,4 +88,3 @@ export const mediaRouter = t.router({
.input(danmakuSchemas.settings) .input(danmakuSchemas.settings)
.mutation(({ input }) => input), .mutation(({ input }) => input),
}); });

View File

@ -124,4 +124,3 @@ export const libraryService = {
return item; return item;
}, },
}; };

View File

@ -99,4 +99,3 @@ export type DanmakuFetchOutput = {
xml: string; xml: string;
message?: string; message?: string;
}; };