Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
d75501860d
|
|||
|
ff886d3002
|
@ -165,9 +165,7 @@ type Filters = {
|
|||||||
name: string;
|
name: string;
|
||||||
slug: string;
|
slug: string;
|
||||||
published: TriState;
|
published: TriState;
|
||||||
nsfw: TriState;
|
|
||||||
needsWork: TriState;
|
needsWork: TriState;
|
||||||
albumIds: string[];
|
|
||||||
categoryIds: string[];
|
categoryIds: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -182,9 +180,7 @@ export function ArtworksTable() {
|
|||||||
name: "",
|
name: "",
|
||||||
slug: "",
|
slug: "",
|
||||||
published: "any",
|
published: "any",
|
||||||
nsfw: "any",
|
|
||||||
needsWork: "any",
|
needsWork: "any",
|
||||||
albumIds: [],
|
|
||||||
categoryIds: [],
|
categoryIds: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -194,9 +190,6 @@ export function ArtworksTable() {
|
|||||||
const [rows, setRows] = useState<ArtworkTableRow[]>([]);
|
const [rows, setRows] = useState<ArtworkTableRow[]>([]);
|
||||||
const [total, setTotal] = useState(0);
|
const [total, setTotal] = useState(0);
|
||||||
|
|
||||||
const [albumOptions, setAlbumOptions] = useState<
|
|
||||||
{ id: string; name: string }[]
|
|
||||||
>([]);
|
|
||||||
const [categoryOptions, setCategoryOptions] = useState<
|
const [categoryOptions, setCategoryOptions] = useState<
|
||||||
{ id: string; name: string }[]
|
{ id: string; name: string }[]
|
||||||
>([]);
|
>([]);
|
||||||
@ -214,7 +207,6 @@ export function ArtworksTable() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
startTransition(async () => {
|
startTransition(async () => {
|
||||||
const res = await getArtworkFilterOptions();
|
const res = await getArtworkFilterOptions();
|
||||||
setAlbumOptions(res.albums);
|
|
||||||
setCategoryOptions(res.categories);
|
setCategoryOptions(res.categories);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
@ -308,33 +300,6 @@ export function ArtworksTable() {
|
|||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: "gallery",
|
|
||||||
header: "Gallery",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<span className="text-sm text-foreground/80">
|
|
||||||
{row.original.gallery?.name ?? "—"}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
enableSorting: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "albums",
|
|
||||||
header: ({ column }) => <SortHeader title="Albums #" column={column} />,
|
|
||||||
accessorKey: "albumsCount",
|
|
||||||
cell: ({ row }) => (
|
|
||||||
<div className="space-y-1">
|
|
||||||
<div className="text-sm font-medium tabular-nums">
|
|
||||||
{row.original.albumsCount}
|
|
||||||
</div>
|
|
||||||
{row.original.albums.length ? (
|
|
||||||
<Chips items={row.original.albums} />
|
|
||||||
) : (
|
|
||||||
<span className="text-xs text-muted-foreground">—</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "categories",
|
id: "categories",
|
||||||
header: ({ column }) => (
|
header: ({ column }) => (
|
||||||
@ -454,7 +419,6 @@ export function ArtworksTable() {
|
|||||||
slug: debouncedSlug || undefined,
|
slug: debouncedSlug || undefined,
|
||||||
published: filters.published,
|
published: filters.published,
|
||||||
needsWork: filters.needsWork,
|
needsWork: filters.needsWork,
|
||||||
albumIds: filters.albumIds.length ? filters.albumIds : undefined,
|
|
||||||
categoryIds: filters.categoryIds.length
|
categoryIds: filters.categoryIds.length
|
||||||
? filters.categoryIds
|
? filters.categoryIds
|
||||||
: undefined,
|
: undefined,
|
||||||
@ -472,7 +436,6 @@ export function ArtworksTable() {
|
|||||||
debouncedSlug,
|
debouncedSlug,
|
||||||
filters.published,
|
filters.published,
|
||||||
filters.needsWork,
|
filters.needsWork,
|
||||||
filters.albumIds,
|
|
||||||
filters.categoryIds,
|
filters.categoryIds,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -548,16 +511,6 @@ export function ArtworksTable() {
|
|||||||
setPageIndex(0);
|
setPageIndex(0);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
) : colId === "albums" ? (
|
|
||||||
<MultiSelectFilter
|
|
||||||
placeholder="Albums…"
|
|
||||||
options={albumOptions}
|
|
||||||
value={filters.albumIds}
|
|
||||||
onChange={(next) => {
|
|
||||||
setFilters((f) => ({ ...f, albumIds: next }));
|
|
||||||
setPageIndex(0);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
) : colId === "categories" ? (
|
) : colId === "categories" ? (
|
||||||
<MultiSelectFilter
|
<MultiSelectFilter
|
||||||
placeholder="Categories…"
|
placeholder="Categories…"
|
||||||
@ -721,9 +674,6 @@ export function ArtworksTable() {
|
|||||||
slug: debouncedSlug || undefined,
|
slug: debouncedSlug || undefined,
|
||||||
published: filters.published,
|
published: filters.published,
|
||||||
needsWork: filters.needsWork,
|
needsWork: filters.needsWork,
|
||||||
albumIds: filters.albumIds.length
|
|
||||||
? filters.albumIds
|
|
||||||
: undefined,
|
|
||||||
categoryIds: filters.categoryIds.length
|
categoryIds: filters.categoryIds.length
|
||||||
? filters.categoryIds
|
? filters.categoryIds
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
@ -37,7 +37,7 @@ type RequestShapeSerializable = Omit<
|
|||||||
RequestShape,
|
RequestShape,
|
||||||
"createdAt" | "updatedAt" | "files" | "status"
|
"createdAt" | "updatedAt" | "files" | "status"
|
||||||
> & {
|
> & {
|
||||||
status: CommissionStatus;
|
status: CommissionStatus | string;
|
||||||
createdAt: string | Date;
|
createdAt: string | Date;
|
||||||
updatedAt: string | Date;
|
updatedAt: string | Date;
|
||||||
files: Array<Omit<RequestShape["files"][number], "createdAt"> & { createdAt: string | Date }>;
|
files: Array<Omit<RequestShape["files"][number], "createdAt"> & { createdAt: string | Date }>;
|
||||||
|
|||||||
Reference in New Issue
Block a user