mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-01-14 20:11:17 +01:00
Backport fixes from SaaS (#5187)
# Description of Changes - Add new skeleton loader style type (block - nothing's currently using it but it might as well be available) - Make Dev API overridable (and set to the new docs that actually work while Swagger docs don't work properly)
This commit is contained in:
parent
fa4d2bc09a
commit
c980ee10c0
@ -2,23 +2,44 @@ import React from 'react';
|
|||||||
import { Box, Group, Stack } from '@mantine/core';
|
import { Box, Group, Stack } from '@mantine/core';
|
||||||
|
|
||||||
interface SkeletonLoaderProps {
|
interface SkeletonLoaderProps {
|
||||||
type: 'pageGrid' | 'fileGrid' | 'controls' | 'viewer';
|
type: 'pageGrid' | 'fileGrid' | 'controls' | 'viewer' | 'block';
|
||||||
count?: number;
|
count?: number;
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
|
width?: number | string;
|
||||||
|
height?: number | string;
|
||||||
|
radius?: number | string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
||||||
type,
|
type,
|
||||||
count = 8,
|
count = 8,
|
||||||
animated = true
|
animated = true,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
radius = 8,
|
||||||
}) => {
|
}) => {
|
||||||
const animationStyle = animated ? { animation: 'pulse 2s infinite' } : {};
|
const animationStyle = animated ? { animation: 'pulse 2s infinite' } : {};
|
||||||
|
|
||||||
|
// Generic block skeleton for inline text/inputs/etc.
|
||||||
|
const renderBlock = () => (
|
||||||
|
<Box
|
||||||
|
w={typeof width === 'number' ? `${width}px` : width}
|
||||||
|
h={typeof height === 'number' ? `${height}px` : height}
|
||||||
|
bg="gray.1"
|
||||||
|
style={{
|
||||||
|
borderRadius: radius,
|
||||||
|
display: 'inline-block',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
...animationStyle
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
const renderPageGridSkeleton = () => (
|
const renderPageGridSkeleton = () => (
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))',
|
gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))',
|
||||||
gap: '1rem'
|
gap: '1rem'
|
||||||
}}>
|
}}>
|
||||||
{Array.from({ length: count }).map((_, i) => (
|
{Array.from({ length: count }).map((_, i) => (
|
||||||
<Box
|
<Box
|
||||||
@ -26,7 +47,7 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
|||||||
w="100%"
|
w="100%"
|
||||||
h={240}
|
h={240}
|
||||||
bg="gray.1"
|
bg="gray.1"
|
||||||
style={{
|
style={{
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
...animationStyle,
|
...animationStyle,
|
||||||
animationDelay: animated ? `${i * 0.1}s` : undefined
|
animationDelay: animated ? `${i * 0.1}s` : undefined
|
||||||
@ -37,10 +58,10 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const renderFileGridSkeleton = () => (
|
const renderFileGridSkeleton = () => (
|
||||||
<div style={{
|
<div style={{
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
|
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
|
||||||
gap: '1rem'
|
gap: '1rem'
|
||||||
}}>
|
}}>
|
||||||
{Array.from({ length: count }).map((_, i) => (
|
{Array.from({ length: count }).map((_, i) => (
|
||||||
<Box
|
<Box
|
||||||
@ -48,7 +69,7 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
|||||||
w="100%"
|
w="100%"
|
||||||
h={280}
|
h={280}
|
||||||
bg="gray.1"
|
bg="gray.1"
|
||||||
style={{
|
style={{
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
...animationStyle,
|
...animationStyle,
|
||||||
animationDelay: animated ? `${i * 0.1}s` : undefined
|
animationDelay: animated ? `${i * 0.1}s` : undefined
|
||||||
@ -76,18 +97,20 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
|||||||
<Box w={40} h={40} bg="gray.1" style={{ borderRadius: 4, ...animationStyle }} />
|
<Box w={40} h={40} bg="gray.1" style={{ borderRadius: 4, ...animationStyle }} />
|
||||||
</Group>
|
</Group>
|
||||||
{/* Main content skeleton */}
|
{/* Main content skeleton */}
|
||||||
<Box
|
<Box
|
||||||
flex={1}
|
flex={1}
|
||||||
bg="gray.1"
|
bg="gray.1"
|
||||||
style={{
|
style={{
|
||||||
borderRadius: '8px',
|
borderRadius: '8px',
|
||||||
...animationStyle
|
...animationStyle
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
);
|
);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
case 'block':
|
||||||
|
return renderBlock();
|
||||||
case 'pageGrid':
|
case 'pageGrid':
|
||||||
return renderPageGridSkeleton();
|
return renderPageGridSkeleton();
|
||||||
case 'fileGrid':
|
case 'fileGrid':
|
||||||
@ -101,4 +124,4 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SkeletonLoader;
|
export default SkeletonLoader;
|
||||||
|
|||||||
1
frontend/src/core/constants/links.ts
Normal file
1
frontend/src/core/constants/links.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const devApiLink = "https://registry.scalar.com/@stirlingpdf/apis/stirling-pdf-processing-api/";
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import LocalIcon from "@app/components/shared/LocalIcon";
|
import LocalIcon from "@app/components/shared/LocalIcon";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { devApiLink } from "@app/constants/links";
|
||||||
import SplitPdfPanel from "@app/tools/Split";
|
import SplitPdfPanel from "@app/tools/Split";
|
||||||
import CompressPdfPanel from "@app/tools/Compress";
|
import CompressPdfPanel from "@app/tools/Compress";
|
||||||
import OCRPanel from "@app/tools/OCR";
|
import OCRPanel from "@app/tools/OCR";
|
||||||
@ -784,7 +785,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog {
|
|||||||
description: t("home.devApi.desc", "Link to API documentation"),
|
description: t("home.devApi.desc", "Link to API documentation"),
|
||||||
categoryId: ToolCategoryId.ADVANCED_TOOLS,
|
categoryId: ToolCategoryId.ADVANCED_TOOLS,
|
||||||
subcategoryId: SubcategoryId.DEVELOPER_TOOLS,
|
subcategoryId: SubcategoryId.DEVELOPER_TOOLS,
|
||||||
link: "https://stirlingpdf.io/swagger-ui/5.21.0/index.html",
|
link: devApiLink,
|
||||||
synonyms: getSynonyms(t, "devApi"),
|
synonyms: getSynonyms(t, "devApi"),
|
||||||
supportsAutomate: false,
|
supportsAutomate: false,
|
||||||
automationSettings: null
|
automationSettings: null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user