diff --git a/src/components/PatternCanvas.tsx b/src/components/PatternCanvas.tsx
index 028354e..4bdbf01 100644
--- a/src/components/PatternCanvas.tsx
+++ b/src/components/PatternCanvas.tsx
@@ -1,7 +1,7 @@
import { useEffect, useRef, useState, useCallback } from 'react';
import { Stage, Layer, Group } from 'react-konva';
import Konva from 'konva';
-import { PlusIcon, MinusIcon, ArrowPathIcon } from '@heroicons/react/24/solid';
+import { PlusIcon, MinusIcon, ArrowPathIcon, LockClosedIcon } from '@heroicons/react/24/solid';
import type { PesPatternData } from '../utils/pystitchConverter';
import type { SewingProgress, MachineInfo } from '../types/machine';
import { calculateInitialScale } from '../utils/konvaRenderers';
@@ -13,9 +13,10 @@ interface PatternCanvasProps {
machineInfo: MachineInfo | null;
initialPatternOffset?: { x: number; y: number };
onPatternOffsetChange?: (offsetX: number, offsetY: number) => void;
+ patternUploaded?: boolean;
}
-export function PatternCanvas({ pesData, sewingProgress, machineInfo, initialPatternOffset, onPatternOffsetChange }: PatternCanvasProps) {
+export function PatternCanvas({ pesData, sewingProgress, machineInfo, initialPatternOffset, onPatternOffsetChange, patternUploaded = false }: PatternCanvasProps) {
const containerRef = useRef
(null);
const stageRef = useRef(null);
@@ -169,7 +170,7 @@ export function PatternCanvas({ pesData, sewingProgress, machineInfo, initialPat
}, [onPatternOffsetChange]);
return (
-
+
Pattern Preview
{containerSize.width > 0 && (
@@ -219,17 +220,17 @@ export function PatternCanvas({ pesData, sewingProgress, machineInfo, initialPat
{pesData && (
{
const stage = e.target.getStage();
- if (stage) stage.container().style.cursor = 'move';
+ if (stage && !patternUploaded) stage.container().style.cursor = 'move';
}}
onMouseLeave={(e) => {
const stage = e.target.getStage();
- if (stage) stage.container().style.cursor = 'grab';
+ if (stage && !patternUploaded) stage.container().style.cursor = 'grab';
}}
>
{/* Pattern Offset Indicator */}
-
-
Pattern Position:
+
+
+
Pattern Position:
+ {patternUploaded && (
+
+
+ LOCKED
+
+ )}
+
X: {(patternOffset.x / 10).toFixed(1)}mm, Y: {(patternOffset.y / 10).toFixed(1)}mm
- Drag pattern to move • Drag background to pan
+ {patternUploaded ? 'Pattern locked • Drag background to pan' : 'Drag pattern to move • Drag background to pan'}
diff --git a/src/components/ProgressMonitor.tsx b/src/components/ProgressMonitor.tsx
index aa5a2c2..0f6c12f 100644
--- a/src/components/ProgressMonitor.tsx
+++ b/src/components/ProgressMonitor.tsx
@@ -110,7 +110,7 @@ export function ProgressMonitor({
};
return (
-
+
Sewing Progress
@@ -258,12 +258,12 @@ export function ProgressMonitor({
return (
+ );
+}
+
+export function PatternCanvasSkeleton() {
+ return (
+
+ );
+}
+
+export function PatternInfoSkeleton() {
+ return (
+
+
+
+ {[1, 2, 3, 4].map((i) => (
+
+
+
+
+ ))}
+
+
+ );
+}
+
+export function MachineConnectionSkeleton() {
+ return (
+
+ );
+}
diff --git a/src/hooks/useBrotherMachine.ts b/src/hooks/useBrotherMachine.ts
index b518b23..9456752 100644
--- a/src/hooks/useBrotherMachine.ts
+++ b/src/hooks/useBrotherMachine.ts
@@ -277,10 +277,30 @@ export function useBrotherMachine() {
try {
setError(null);
+
+ // Delete pattern from cache to prevent auto-resume
+ try {
+ const machineUuid = await service.getPatternUUID();
+ if (machineUuid) {
+ const uuidStr = uuidToString(machineUuid);
+ PatternCacheService.deletePattern(uuidStr);
+ console.log("[Cache] Deleted pattern with UUID:", uuidStr);
+ }
+ } catch (err) {
+ console.warn("[Cache] Failed to get UUID for cache deletion:", err);
+ }
+
await service.deletePattern();
+
+ // Clear machine-related state but keep pattern data in UI for re-editing
setPatternInfo(null);
setSewingProgress(null);
setUploadProgress(0); // Reset upload progress to allow new uploads
+ setResumeAvailable(false);
+ setResumeFileName(null);
+ // NOTE: We intentionally DON'T clear setResumedPattern(null)
+ // so the pattern remains visible in the canvas for re-editing
+
await refreshStatus();
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to delete pattern");
@@ -314,7 +334,7 @@ export function useBrotherMachine() {
const interval = setInterval(async () => {
await refreshStatus();
- // Also refresh progress during sewing
+ // Refresh progress during sewing
if (machineStatus === MachineStatus.SEWING) {
await refreshProgress();
}