공지사항 삭제등록 등11
This commit is contained in:
@@ -8,6 +8,7 @@ import BackArrowSvg from "@/app/svgs/backarrow";
|
||||
import { type Notice } from "@/app/admin/notices/mockData";
|
||||
import apiService from "@/app/lib/apiService";
|
||||
import NoticeValidationModal from "@/app/admin/notices/NoticeValidationModal";
|
||||
import NoticeCancelModal from "@/app/admin/notices/NoticeCancelModal";
|
||||
|
||||
export default function AdminNoticesPage() {
|
||||
const router = useRouter();
|
||||
@@ -20,6 +21,7 @@ export default function AdminNoticesPage() {
|
||||
const [fileKey, setFileKey] = useState<string | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isValidationModalOpen, setIsValidationModalOpen] = useState(false);
|
||||
const [isCancelModalOpen, setIsCancelModalOpen] = useState(false);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
// 날짜를 yyyy-mm-dd 형식으로 포맷팅
|
||||
@@ -223,13 +225,16 @@ export default function AdminNoticesPage() {
|
||||
|
||||
const handleCancel = () => {
|
||||
if (title.trim() || content.trim() || attachedFile || fileKey) {
|
||||
if (confirm('작성 중인 내용이 있습니다. 정말 취소하시겠습니까?')) {
|
||||
handleBack();
|
||||
}
|
||||
setIsCancelModalOpen(true);
|
||||
} else {
|
||||
handleBack();
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancelConfirm = () => {
|
||||
setIsCancelModalOpen(false);
|
||||
handleBack();
|
||||
};
|
||||
|
||||
const ITEMS_PER_PAGE = 10;
|
||||
const sortedNotices = useMemo(() => {
|
||||
@@ -252,6 +257,11 @@ export default function AdminNoticesPage() {
|
||||
open={isValidationModalOpen}
|
||||
onClose={() => setIsValidationModalOpen(false)}
|
||||
/>
|
||||
<NoticeCancelModal
|
||||
open={isCancelModalOpen}
|
||||
onClose={() => setIsCancelModalOpen(false)}
|
||||
onConfirm={handleCancelConfirm}
|
||||
/>
|
||||
<div className="min-h-screen flex flex-col bg-white">
|
||||
{/* 메인 레이아웃 */}
|
||||
<div className="flex flex-1 min-h-0 justify-center">
|
||||
@@ -357,13 +367,13 @@ export default function AdminNoticesPage() {
|
||||
accept="*/*"
|
||||
/>
|
||||
</div>
|
||||
<div className="h-16 w-full rounded-[8px] border border-[#dee1e6] bg-gray-50 flex items-center justify-center">
|
||||
<div className="h-16 w-full rounded-[8px] border border-[#dee1e6] bg-gray-50 flex items-center px-4">
|
||||
{attachedFile ? (
|
||||
<p className="text-[14px] font-normal leading-[1.5] text-[#1b2027]">
|
||||
{attachedFile.name}
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-[14px] font-normal leading-[1.5] text-[#8c95a1] text-center">
|
||||
<p className="text-[14px] font-normal leading-[1.5] text-[#8c95a1] text-center w-full">
|
||||
파일을 첨부해주세요.
|
||||
</p>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user