/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
For commercial licensing, please contact support@quantumnous.com
*/
import { ListFilter as ActionListFilter } from '@/components/common/icons/ActionIcons';
import React, { useEffect, useRef } from 'react';
import { Button } from 'antd';
import { useTranslation } from 'react-i18next';
import { SkillCardSkeleton } from './SkillCard';
const SKELETON_COUNT = 8;
/**
* 原型 .sm-catalog:结果栏(全部技能 · N 个技能 + 页面已有操作)、提示区、独立滚动的卡片列表、
* 加载骨架(Ant Design Card loading)、空态与分页。数据、计数与分页条件均由页面传入。
*/
const SkillCatalog = ({
total,
scope = 'all',
selectedTagCount = 0,
showTotal = true,
extra = null,
notice = null,
loading = false,
empty = false,
onReset,
pagination = null,
children,
scrollResetKey,
selectedTags,
mineCount = 0,
filtersOpen = false,
onToggleFilters,
}) => {
const { t } = useTranslation();
const listRef = useRef(null);
// Reset creates a fresh tag array even when no filters are active.
useEffect(() => {
if (listRef.current) listRef.current.scrollTop = 0;
}, [scrollResetKey, selectedTags]);
const noOwnedSkills = scope === 'mine' && mineCount === 0;
let body = null;
if (loading) {
body = (