Merge branch 'main' into add_telegram

This commit is contained in:
Ludy 2025-12-09 15:06:18 +01:00 committed by GitHub
commit 41590483dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 50 additions and 24 deletions

View File

@ -2,23 +2,44 @@ import React from 'react';
import { Box, Group, Stack } from '@mantine/core';
interface SkeletonLoaderProps {
type: 'pageGrid' | 'fileGrid' | 'controls' | 'viewer';
type: 'pageGrid' | 'fileGrid' | 'controls' | 'viewer' | 'block';
count?: number;
animated?: boolean;
width?: number | string;
height?: number | string;
radius?: number | string;
}
const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
type,
count = 8,
animated = true
const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
type,
count = 8,
animated = true,
width,
height,
radius = 8,
}) => {
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 = () => (
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))',
gap: '1rem'
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(180px, 1fr))',
gap: '1rem'
}}>
{Array.from({ length: count }).map((_, i) => (
<Box
@ -26,7 +47,7 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
w="100%"
h={240}
bg="gray.1"
style={{
style={{
borderRadius: '8px',
...animationStyle,
animationDelay: animated ? `${i * 0.1}s` : undefined
@ -37,10 +58,10 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
);
const renderFileGridSkeleton = () => (
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
gap: '1rem'
<div style={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
gap: '1rem'
}}>
{Array.from({ length: count }).map((_, i) => (
<Box
@ -48,7 +69,7 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
w="100%"
h={280}
bg="gray.1"
style={{
style={{
borderRadius: '8px',
...animationStyle,
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 }} />
</Group>
{/* Main content skeleton */}
<Box
flex={1}
bg="gray.1"
style={{
<Box
flex={1}
bg="gray.1"
style={{
borderRadius: '8px',
...animationStyle
}}
...animationStyle
}}
/>
</Stack>
);
switch (type) {
case 'block':
return renderBlock();
case 'pageGrid':
return renderPageGridSkeleton();
case 'fileGrid':
@ -101,4 +124,4 @@ const SkeletonLoader: React.FC<SkeletonLoaderProps> = ({
}
};
export default SkeletonLoader;
export default SkeletonLoader;

View File

@ -0,0 +1 @@
export const devApiLink = "https://registry.scalar.com/@stirlingpdf/apis/stirling-pdf-processing-api/";

View File

@ -1,4 +1,5 @@
import React, { createContext, useContext, useCallback, useRef } from 'react';
import { BASE_PATH } from '@app/constants/app';
import { useFileHandler } from '@app/hooks/useFileHandler';
import { useFilesModalContext } from '@app/contexts/FilesModalContext';
import { useNavigationActions } from '@app/contexts/NavigationContext';
@ -110,7 +111,7 @@ export const TourOrchestrationProvider: React.FC<{ children: React.ReactNode }>
const loadSampleFile = useCallback(async () => {
try {
const response = await fetch('samples/Sample.pdf');
const response = await fetch(`${BASE_PATH}/samples/Sample.pdf`);
const blob = await response.blob();
const file = new File([blob], 'Sample.pdf', { type: 'application/pdf' });

View File

@ -1,6 +1,7 @@
import { useMemo } from "react";
import LocalIcon from "@app/components/shared/LocalIcon";
import { useTranslation } from "react-i18next";
import { devApiLink } from "@app/constants/links";
import SplitPdfPanel from "@app/tools/Split";
import CompressPdfPanel from "@app/tools/Compress";
import OCRPanel from "@app/tools/OCR";
@ -784,7 +785,7 @@ export function useTranslatedToolCatalog(): TranslatedToolCatalog {
description: t("home.devApi.desc", "Link to API documentation"),
categoryId: ToolCategoryId.ADVANCED_TOOLS,
subcategoryId: SubcategoryId.DEVELOPER_TOOLS,
link: "https://stirlingpdf.io/swagger-ui/5.21.0/index.html",
link: devApiLink,
synonyms: getSynonyms(t, "devApi"),
supportsAutomate: false,
automationSettings: null