From 9f7af2e945c2d9f7ce73c9a0287d1d346f6cc5de Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Fri, 24 Oct 2025 19:45:29 +0900 Subject: (김준회) 돌체: 리비전 R00 입력가능하도록 변경, dialog 외부클릭 종료기능 제거하고 투명도조절기능 추가 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ship-vendor-document/revision-validation.tsx | 24 +++--- components/ui/dialog.tsx | 98 +++++++++++++++++----- 2 files changed, 89 insertions(+), 33 deletions(-) (limited to 'components') diff --git a/components/ship-vendor-document/revision-validation.tsx b/components/ship-vendor-document/revision-validation.tsx index 4ff621a0..96067400 100644 --- a/components/ship-vendor-document/revision-validation.tsx +++ b/components/ship-vendor-document/revision-validation.tsx @@ -11,7 +11,7 @@ export const MAX_FILE_SIZE = 1024 * 1024 * 1024 // 1GB export const validateB3Revision = (value: string) => { // B3 리비전 패턴: 단일 알파벳(A-Z) 또는 R01-R99 const alphabetPattern = /^[A-Z]$/ - const numericPattern = /^R(0[1-9]|[1-9][0-9])$/ + const numericPattern = /^R(0[0-9]|[1-9][0-9])$/ return alphabetPattern.test(value) || numericPattern.test(value) } @@ -19,7 +19,7 @@ export const validateB3Revision = (value: string) => { // B4 리비전 검증 함수 export const validateB4Revision = (value: string) => { // B4 리비전 패턴: R01-R99 - const numericPattern = /^R(0[1-9]|[1-9][0-9])$/ + const numericPattern = /^R(0[0-9]|[1-9][0-9])$/ return numericPattern.test(value) } @@ -46,14 +46,14 @@ export const createEditRevisionSchema = (drawingKind: string) => { .max(3, "Revision must be 3 characters or less") .refine( validateB3Revision, - "Invalid format. Use A-Z or R01-R99" + "Invalid format. Use A-Z or R00-R99" ) : z.string() .min(1, "Please enter a revision") .max(3, "Revision must be 3 characters or less") .refine( validateB4Revision, - "Invalid format. Use R01-R99" + "Invalid format. Use R00-R99" ) // B3인 경우에만 usageType 필드 추가 @@ -93,14 +93,14 @@ export const createUploadRevisionSchema = (drawingKind: string) => { .max(3, "Revision must be 3 characters or less") .refine( validateB3Revision, - "Invalid format. Use A-Z or R01-R99" + "Invalid format. Use A-Z or R00-R99" ) : z.string() .min(1, "Please enter a revision") .max(3, "Revision must be 3 characters or less") .refine( validateB4Revision, - "Invalid format. Use R01-R99" + "Invalid format. Use R00-R99" ) // B3인 경우에만 usageType 필드 추가 @@ -172,18 +172,18 @@ export const getUsageTypeOptions = (usage: string) => { export const getRevisionGuide = (drawingKind: string) => { if (drawingKind === 'B3') { return { - placeholder: "e.g., A, B, C or R01, R02", - helpText: "Use single letter (A-Z) or R01-R99 format", + placeholder: "e.g., A, B, C or R00, R01 ...", + helpText: "Use single letter (A-Z) or R00-R99 format", examples: [ "A, B, C, ... Z (alphabetic revisions)", - "R01, R02, ... R99 (numeric revisions)" + "R00, R01, ... R99 (numeric revisions)" ] } } return { - placeholder: "e.g., R01, R02, R03", - helpText: "Enter in R01, R02, R03... format", - examples: ["R01, R02, R03, ... R99"] + placeholder: "e.g., R00, R01, R02, R03", + helpText: "Enter in R00, R01, R02, R03... format", + examples: ["R00, R01, R02, R03, ... R99"] } } diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx index 1647513e..975f3a39 100644 --- a/components/ui/dialog.tsx +++ b/components/ui/dialog.tsx @@ -2,10 +2,11 @@ import * as React from "react" import * as DialogPrimitive from "@radix-ui/react-dialog" -import { X } from "lucide-react" +import { X, Minus, Plus } from "lucide-react" import { cn } from "@/lib/utils" + const Dialog = DialogPrimitive.Root const DialogTrigger = DialogPrimitive.Trigger @@ -31,26 +32,81 @@ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName const DialogContent = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - - - {children} - - - Close - - - -)) + React.ComponentPropsWithoutRef & { + opacityControl?: boolean + } +>(({ className, children, opacityControl = true, ...props }, ref) => { + const [opacity, setOpacity] = React.useState(1) + + const increaseOpacity = () => setOpacity(prev => Math.min(1, prev + 0.1)) + const decreaseOpacity = () => setOpacity(prev => Math.max(0.1, prev - 0.1)) + + return ( + + + e.preventDefault()} // 바깥 클릭으로 닫히는 기능 제거 + {...props} + > +
+ {/* 고정 헤더 영역 */} +
+ {/* 왼쪽: 빈 공간 */} +
+ {/* 드래그 기능 제거됨 */} +
+ + {/* 중앙: 투명도 조절 */} +
+ {opacityControl && ( +
+ + + {Math.round(opacity * 100)}% + + +
+ )} +
+ + {/* 오른쪽: 닫기 버튼 */} +
+ + + Close + +
+
+ + {/* 스크롤 가능한 컨텐츠 영역 */} +
+ {children} +
+
+
+
+ ) +}) DialogContent.displayName = DialogPrimitive.Content.displayName const DialogHeader = ({ -- cgit v1.2.3