Fixed number of meshes displayed in Assets page and Assets Selector Page + Fixed Refresh Assets page from Desktop App
This commit is contained in:
parent
9c17e86a98
commit
27645c4e0f
5 changed files with 33 additions and 11 deletions
|
|
@ -7955,7 +7955,11 @@ async function migrateWikiIfNeeded() {
|
|||
if (HAS_DIST) {
|
||||
app.use((req, res, next) => {
|
||||
if (req.method !== 'GET') return next();
|
||||
if (/^\/(api|assets|wiki-media|mcp)(\/|$)/.test(req.path)) return next();
|
||||
if (/^\/(api|wiki-media|mcp)(\/|$)/.test(req.path)) return next();
|
||||
// `/assets/<file>` is a stored asset file (served above, or a genuine 404) —
|
||||
// never the SPA. But bare `/assets` and `/assets/` ARE the Assets Library
|
||||
// client route, so they must fall through to index.html on a full reload.
|
||||
if (/^\/assets\/.+/.test(req.path)) return next();
|
||||
res.sendFile(path.join(DIST_DIR, 'index.html'));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -222,8 +222,11 @@
|
|||
display: block;
|
||||
}
|
||||
|
||||
/* Mesh thumbnails are square renders (often transparent-backed); the preview
|
||||
box is 16:10, so `cover` would crop a tall subject and look zoomed in.
|
||||
`contain` shows the whole render, centered over the card background. */
|
||||
.asset-selector-preview--mesh .asset-selector-image {
|
||||
object-fit: cover;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.asset-selector-mesh-placeholder {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ function getAssetPreviewUrl(filename) {
|
|||
}
|
||||
|
||||
const ASSETS_PER_PAGE = 20;
|
||||
// Meshes show 3 per row, so 21 (7 full rows) paginates more cleanly than 20.
|
||||
const MESHES_PER_PAGE = 21;
|
||||
|
||||
export default function AssetSelectorModal({ assetType, onSelect, onClose, showEdits = false }) {
|
||||
const { getLibraryAssets, projects } = useProjects();
|
||||
|
|
@ -137,11 +139,12 @@ export default function AssetSelectorModal({ assetType, onSelect, onClose, showE
|
|||
setCurrentPage(1);
|
||||
}, [normalizedSearch, projectFilter]);
|
||||
|
||||
const totalPages = Math.max(1, Math.ceil(filteredAssets.length / ASSETS_PER_PAGE));
|
||||
const pageStart = (currentPage - 1) * ASSETS_PER_PAGE;
|
||||
const paginatedAssets = filteredAssets.slice(pageStart, pageStart + ASSETS_PER_PAGE);
|
||||
const assetsPerPage = validType === 'mesh' ? MESHES_PER_PAGE : ASSETS_PER_PAGE;
|
||||
const totalPages = Math.max(1, Math.ceil(filteredAssets.length / assetsPerPage));
|
||||
const pageStart = (currentPage - 1) * assetsPerPage;
|
||||
const paginatedAssets = filteredAssets.slice(pageStart, pageStart + assetsPerPage);
|
||||
const pageRangeStart = filteredAssets.length === 0 ? 0 : pageStart + 1;
|
||||
const pageRangeEnd = Math.min(pageStart + ASSETS_PER_PAGE, filteredAssets.length);
|
||||
const pageRangeEnd = Math.min(pageStart + assetsPerPage, filteredAssets.length);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentPage > totalPages) {
|
||||
|
|
@ -294,7 +297,7 @@ export default function AssetSelectorModal({ assetType, onSelect, onClose, showE
|
|||
})}
|
||||
</div>
|
||||
|
||||
{filteredAssets.length > ASSETS_PER_PAGE && (
|
||||
{filteredAssets.length > assetsPerPage && (
|
||||
<div className="asset-selector-pagination">
|
||||
<div className="asset-selector-pagination-summary">
|
||||
Showing {pageRangeStart}-{pageRangeEnd} of {filteredAssets.length}
|
||||
|
|
|
|||
|
|
@ -690,6 +690,14 @@
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
/* Mesh thumbnails are square renders (often with a transparent background); the
|
||||
preview box is 16:10, so `cover` would crop a tall subject (head/feet) and
|
||||
look zoomed in. `contain` shows the whole render, letterboxed over the card's
|
||||
gradient background. */
|
||||
.asset-card__preview--mesh-thumbnail .asset-card__image {
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.asset-card__mesh-icon {
|
||||
font-size: 2.75rem;
|
||||
color: var(--secondary);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ import { downloadShareableWorkflow, isShareableWorkflow } from '../utils/workflo
|
|||
import './AssetsPage.css'
|
||||
|
||||
const ASSETS_PER_PAGE = 20
|
||||
// The mesh grid is 3 columns wide, so 21 (7 full rows) paginates more cleanly
|
||||
// than 20 (which leaves a ragged last row).
|
||||
const MESHES_PER_PAGE = 21
|
||||
const COMFY_VALUE_TYPES = [
|
||||
{ value: 'string', label: 'String' },
|
||||
{ value: 'number', label: 'Number' },
|
||||
|
|
@ -517,11 +520,12 @@ export default function AssetsPage() {
|
|||
}
|
||||
const groupedAssets = buildGroupedAssets()
|
||||
|
||||
const totalPages = Math.max(1, Math.ceil(activeAssets.length / ASSETS_PER_PAGE))
|
||||
const pageStart = (currentPage - 1) * ASSETS_PER_PAGE
|
||||
const paginatedAssets = activeAssets.slice(pageStart, pageStart + ASSETS_PER_PAGE)
|
||||
const assetsPerPage = activeSection === 'meshes' ? MESHES_PER_PAGE : ASSETS_PER_PAGE
|
||||
const totalPages = Math.max(1, Math.ceil(activeAssets.length / assetsPerPage))
|
||||
const pageStart = (currentPage - 1) * assetsPerPage
|
||||
const paginatedAssets = activeAssets.slice(pageStart, pageStart + assetsPerPage)
|
||||
const pageRangeStart = activeAssets.length === 0 ? 0 : pageStart + 1
|
||||
const pageRangeEnd = Math.min(pageStart + ASSETS_PER_PAGE, activeAssets.length)
|
||||
const pageRangeEnd = Math.min(pageStart + assetsPerPage, activeAssets.length)
|
||||
|
||||
useEffect(() => {
|
||||
if (currentPage > totalPages) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue