중간 수정. 피드백 디테일보기 해결
This commit is contained in:
@@ -19,6 +19,8 @@ interface DynamicFormProps {
|
||||
onSubmit: (formData: Record<string, unknown>) => Promise<void>;
|
||||
initialData?: Record<string, unknown>;
|
||||
submitButtonText?: string;
|
||||
onCancel?: () => void;
|
||||
cancelButtonText?: string;
|
||||
}
|
||||
|
||||
export function DynamicForm({
|
||||
@@ -26,6 +28,8 @@ export function DynamicForm({
|
||||
onSubmit,
|
||||
initialData = EMPTY_INITIAL_DATA, // 기본값으로 상수 사용
|
||||
submitButtonText = "제출",
|
||||
onCancel,
|
||||
cancelButtonText = "취소",
|
||||
}: DynamicFormProps) {
|
||||
const [formData, setFormData] =
|
||||
useState<Record<string, unknown>>(initialData);
|
||||
@@ -107,9 +111,16 @@ export function DynamicForm({
|
||||
{renderField(field)}
|
||||
</div>
|
||||
))}
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
{isSubmitting ? "전송 중..." : submitButtonText}
|
||||
</Button>
|
||||
<div className="flex justify-between">
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
{isSubmitting ? "전송 중..." : submitButtonText}
|
||||
</Button>
|
||||
{onCancel && (
|
||||
<Button type="button" variant="outline" onClick={onCancel}>
|
||||
{cancelButtonText}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@ import { useState, useEffect, useMemo } from "react";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import { DynamicForm } from "@/components/DynamicForm";
|
||||
import { useSyncChannelId } from "@/hooks/useSyncChannelId";
|
||||
import { getFeedbackById, updateFeedback } from "@/services/feedback";
|
||||
import {
|
||||
getFeedbackById,
|
||||
updateFeedback,
|
||||
getFeedbackFields,
|
||||
} from "@/services/feedback";
|
||||
import { ErrorDisplay } from "@/components/ErrorDisplay";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
@@ -147,6 +151,9 @@ export function FeedbackDetailPage() {
|
||||
initialData={initialData}
|
||||
onSubmit={handleSubmit}
|
||||
submitButtonText="수정하기"
|
||||
onCancel={() =>
|
||||
navigate(`/projects/${projectId}/channels/${channelId}/feedbacks`)
|
||||
}
|
||||
/>
|
||||
{successMessage && (
|
||||
<div className="mt-4 p-3 bg-green-100 text-green-800 rounded-md">
|
||||
|
||||
Reference in New Issue
Block a user