fix(categories): align taxonomy moderation
This commit is contained in:
+14
-14
@@ -50,7 +50,7 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example all
|
||||
* @example active
|
||||
* @enum {string|null}
|
||||
*/
|
||||
state?: "active" | "archived" | "trashed" | "all" | null;
|
||||
@@ -539,7 +539,7 @@ export interface paths {
|
||||
*/
|
||||
language_code?: string;
|
||||
/**
|
||||
* @example published
|
||||
* @example draft
|
||||
* @enum {string}
|
||||
*/
|
||||
status?: "draft" | "awaiting_publish" | "published";
|
||||
@@ -4371,7 +4371,7 @@ export interface paths {
|
||||
/** @example architecto */
|
||||
status?: string | null;
|
||||
/**
|
||||
* @example manual_selection
|
||||
* @example instant_accept
|
||||
* @enum {string|null}
|
||||
*/
|
||||
dispatch_mode?: "instant_accept" | "quote" | "scheduled_booking" | "manual_selection" | null;
|
||||
@@ -4685,7 +4685,7 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example taken_by_other
|
||||
* @example ignored
|
||||
* @enum {string|null}
|
||||
*/
|
||||
status?: "sent" | "delivered" | "viewed" | "accepted" | "rejected" | "ignored" | "expired" | "taken_by_other" | null;
|
||||
@@ -4879,7 +4879,7 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example consumed
|
||||
* @example created
|
||||
* @enum {string|null}
|
||||
*/
|
||||
status?: "created" | "confirmed" | "started" | "consumed" | "paid" | "fulfilled" | "canceled" | null;
|
||||
@@ -5163,13 +5163,13 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example busy
|
||||
* @example offline
|
||||
* @enum {string|null}
|
||||
*/
|
||||
status?: "offline" | "online" | "inactive" | "busy" | null;
|
||||
/** @example true */
|
||||
/** @example false */
|
||||
is_disabled?: boolean | null;
|
||||
/** @example true */
|
||||
/** @example false */
|
||||
is_verified?: boolean | null;
|
||||
/**
|
||||
* @description Must be at least 1.
|
||||
@@ -5448,12 +5448,12 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example friends
|
||||
* @example public
|
||||
* @enum {string|null}
|
||||
*/
|
||||
visibility?: "public" | "friends" | "private" | null;
|
||||
/**
|
||||
* @example visible
|
||||
* @example all
|
||||
* @enum {string|null}
|
||||
*/
|
||||
status?: "blocked" | "visible" | "all" | null;
|
||||
@@ -5779,7 +5779,7 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example pending
|
||||
* @example blocked
|
||||
* @enum {string|null}
|
||||
*/
|
||||
status?: "pending" | "blocked" | "all" | null;
|
||||
@@ -7664,7 +7664,7 @@ export interface paths {
|
||||
* @example b
|
||||
*/
|
||||
q?: string | null;
|
||||
/** @example false */
|
||||
/** @example true */
|
||||
status?: boolean | null;
|
||||
/** @example true */
|
||||
is_robot?: boolean | null;
|
||||
@@ -10107,11 +10107,11 @@ export interface paths {
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @example android
|
||||
* @example web
|
||||
* @enum {string|null}
|
||||
*/
|
||||
platform?: "ios" | "android" | "web" | "desktop" | null;
|
||||
/** @example true */
|
||||
/** @example false */
|
||||
is_online?: boolean | null;
|
||||
/**
|
||||
* @description Must be at least 1.
|
||||
|
||||
+2
-2
@@ -204,8 +204,8 @@ export interface Category {
|
||||
sort_order: number
|
||||
is_active: boolean
|
||||
visibility?: string
|
||||
approval_status?: 'pending' | 'approved' | 'rejected' | string
|
||||
source?: string
|
||||
approval_status?: 'pending' | 'approved' | 'rejected' | 'merged'
|
||||
source?: 'platform' | 'admin' | 'user'
|
||||
created_by_uid?: string | null
|
||||
approved_by_uid?: string | null
|
||||
approved_at?: string | null
|
||||
|
||||
@@ -70,7 +70,7 @@ export function CategoryFormDialog({ open, onOpenChange, category, parent }: Cat
|
||||
const mutation = useMutation({
|
||||
mutationFn: (values: FormValues) => {
|
||||
const translations: NonNullable<CategoryPayload['translations']> = [
|
||||
{ locale: 'zh-CN', name: values.name_zh, description: values.description_zh || null },
|
||||
{ locale: 'zh-Hans', name: values.name_zh, description: values.description_zh || null },
|
||||
]
|
||||
if (values.name_en) {
|
||||
translations.push({
|
||||
|
||||
@@ -141,7 +141,7 @@ function TreeNode({
|
||||
{!node.is_active && <Badge variant="secondary">未启用</Badge>}
|
||||
{node.approval_status === 'pending' && <Badge variant="outline">待审核</Badge>}
|
||||
<span className="ml-auto hidden items-center gap-1 group-hover:flex">
|
||||
{canCreate && (
|
||||
{canCreate && node.level < 3 && (
|
||||
<Button variant="ghost" size="icon-sm" onClick={() => onCreateChild(node)} aria-label="新建子分类">
|
||||
<Plus className="size-4" />
|
||||
</Button>
|
||||
|
||||
@@ -154,7 +154,15 @@ function MergeDialog({
|
||||
enabled: source !== null,
|
||||
})
|
||||
|
||||
const options = flattenTree(tree.data?.data ?? []).filter((c) => c.id !== source?.id)
|
||||
const options = flattenTree(tree.data?.data ?? []).filter(
|
||||
(category) =>
|
||||
category.id !== source?.id &&
|
||||
category.level === source?.level &&
|
||||
category.parent_id === source?.parent_id &&
|
||||
category.is_active &&
|
||||
category.visibility === 'public' &&
|
||||
category.approval_status === 'approved',
|
||||
)
|
||||
|
||||
const submit = async () => {
|
||||
if (!source || !targetId) return
|
||||
|
||||
Reference in New Issue
Block a user