From 49a10a3865c7f762773fece7cd94f070caacd5d7 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Wed, 17 Sep 2025 08:34:55 +0100 Subject: [PATCH 1/4] Change fallback base URL to 'https://stirling.com' --- frontend/src/constants/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/constants/app.ts b/frontend/src/constants/app.ts index 0abebc54b..3b8b765df 100644 --- a/frontend/src/constants/app.ts +++ b/frontend/src/constants/app.ts @@ -3,5 +3,5 @@ import { useAppConfig } from '../hooks/useAppConfig'; // Get base URL from app config with fallback export const getBaseUrl = (): string => { const { config } = useAppConfig(); - return config?.baseUrl || 'https://demo.stirlingpdf.com'; -}; \ No newline at end of file + return config?.baseUrl || 'https://stirling.com'; +}; From 6a94e10e30362e9112184e8854872c6bbfd26b4f Mon Sep 17 00:00:00 2001 From: James Brunton Date: Wed, 17 Sep 2025 11:43:06 +0100 Subject: [PATCH 2/4] Delete Claude local settings (#4455) # Description of Changes Delete Claude local settings, which shouldn't really be in the repo. Note that this is already in the `.gitignore` file, so there's no need to change that as well. --- .claude/settings.local.json | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 877d932ef..000000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(chmod:*)", - "Bash(mkdir:*)", - "Bash(./gradlew:*)", - "Bash(grep:*)", - "Bash(cat:*)", - "Bash(find:*)", - "Bash(npm test)", - "Bash(npm test:*)", - "Bash(ls:*)", - "Bash(npx tsc:*)", - "Bash(node:*)", - "Bash(npm run dev:*)", - "Bash(sed:*)", - "Bash(npm run typecheck:*)" - ], - "deny": [], - "defaultMode": "acceptEdits" - } -} \ No newline at end of file From b51c2e42a633a8103e34dff76e390bd8a8c4cab7 Mon Sep 17 00:00:00 2001 From: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com> Date: Wed, 17 Sep 2025 11:53:04 +0100 Subject: [PATCH 3/4] Removed optionality for 'onDownloadFile', removed fallback in fileEditorThumbnail. (#4456) Removed optionality for 'onDownloadFile', removed fallback in fileEditorThumbnail. Co-authored-by: Connor Yoh --- .../src/components/fileEditor/FileEditor.tsx | 12 ++++++- .../fileEditor/FileEditorThumbnail.tsx | 35 +++---------------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/fileEditor/FileEditor.tsx b/frontend/src/components/fileEditor/FileEditor.tsx index 93cb4e6a0..f03404eac 100644 --- a/frontend/src/components/fileEditor/FileEditor.tsx +++ b/frontend/src/components/fileEditor/FileEditor.tsx @@ -11,6 +11,8 @@ import FileEditorThumbnail from './FileEditorThumbnail'; import FilePickerModal from '../shared/FilePickerModal'; import SkeletonLoader from '../shared/SkeletonLoader'; import { FileId, StirlingFile } from '../../types/fileContext'; +import { downloadBlob } from '../../utils/downloadUtils'; + interface FileEditorProps { onOpenPageEditor?: () => void; @@ -278,7 +280,6 @@ const FileEditor = ({ const handleDeleteFile = useCallback((fileId: FileId) => { const record = activeStirlingFileStubs.find(r => r.id === fileId); const file = record ? selectors.getFile(record.id) : null; - if (record && file) { // Remove file from context but keep in storage (close, don't delete) const contextFileId = record.id; @@ -290,6 +291,14 @@ const FileEditor = ({ } }, [activeStirlingFileStubs, selectors, removeFiles, setSelectedFiles, selectedFileIds]); + const handleDownloadFile = useCallback((fileId: FileId) => { + const record = activeStirlingFileStubs.find(r => r.id === fileId); + const file = record ? selectors.getFile(record.id) : null; + if (record && file) { + downloadBlob(file, file.name); + } + }, [activeStirlingFileStubs, selectors, setStatus]); + const handleViewFile = useCallback((fileId: FileId) => { const record = activeStirlingFileStubs.find(r => r.id === fileId); if (record) { @@ -401,6 +410,7 @@ const FileEditor = ({ onViewFile={handleViewFile} onSetStatus={setStatus} onReorderFiles={handleReorderFiles} + onDownloadFile={handleDownloadFile} toolMode={toolMode} isSupported={isFileSupported(record.name)} /> diff --git a/frontend/src/components/fileEditor/FileEditorThumbnail.tsx b/frontend/src/components/fileEditor/FileEditorThumbnail.tsx index 2a927d012..f28713c73 100644 --- a/frontend/src/components/fileEditor/FileEditorThumbnail.tsx +++ b/frontend/src/components/fileEditor/FileEditorThumbnail.tsx @@ -13,6 +13,7 @@ import { StirlingFileStub } from '../../types/fileContext'; import styles from './FileEditor.module.css'; import { useFileContext } from '../../contexts/FileContext'; import { FileId } from '../../types/file'; +import { formatFileSize } from '../../utils/fileUtils'; import ToolChain from '../shared/ToolChain'; @@ -28,7 +29,7 @@ interface FileEditorThumbnailProps { onViewFile: (fileId: FileId) => void; onSetStatus: (status: string) => void; onReorderFiles?: (sourceFileId: FileId, targetFileId: FileId, selectedFileIds: FileId[]) => void; - onDownloadFile?: (fileId: FileId) => void; + onDownloadFile: (fileId: FileId) => void; toolMode?: boolean; isSupported?: boolean; } @@ -61,29 +62,6 @@ const FileEditorThumbnail = ({ const pageCount = file.processedFile?.totalPages || 0; - const downloadSelectedFile = useCallback(() => { - // Prefer parent-provided handler if available - if (typeof onDownloadFile === 'function') { - onDownloadFile(file.id); - return; - } - - // Fallback: attempt to download using the File object if provided - const maybeFile = (file as unknown as { file?: File }).file; - if (maybeFile instanceof File) { - const link = document.createElement('a'); - link.href = URL.createObjectURL(maybeFile); - link.download = maybeFile.name || file.name || 'download'; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - URL.revokeObjectURL(link.href); - return; - } - - // If we can't find a way to download, surface a status message - onSetStatus?.(typeof t === 'function' ? t('downloadUnavailable', 'Download unavailable for this item') : 'Download unavailable for this item'); - }, [file, onDownloadFile, onSetStatus, t]); const handleRef = useRef(null); // ---- Selection ---- @@ -91,12 +69,7 @@ const FileEditorThumbnail = ({ // ---- Meta formatting ---- const prettySize = useMemo(() => { - const bytes = file.size ?? 0; - if (bytes === 0) return '0 B'; - const k = 1024; - const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; - const i = Math.floor(Math.log(bytes) / Math.log(k)); - return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`; + return formatFileSize(file.size); }, [file.size]); const extUpper = useMemo(() => { @@ -305,7 +278,7 @@ const FileEditorThumbnail = ({