전체 코드, 구조 검토 - P1 코드 수정 진행
This commit is contained in:
@@ -5,13 +5,14 @@ import { useRouter } from "next/navigation";
|
||||
import { ArrowUp } from "lucide-react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ACCOUNT_TYPES } from "@/lib/constants";
|
||||
import { ACCOUNT_TYPES, ACTIVATE_STATUSES } from "@/lib/constants";
|
||||
import { formatDateTime, getAccountTypeLabel, getRequestStatusLabel } from "@/lib/utils";
|
||||
import type { MaestroDetail } from "@/lib/maestros";
|
||||
|
||||
type UpgradeRequestsSectionProps = {
|
||||
maestroID: number;
|
||||
accountType: number;
|
||||
activateStatus: number;
|
||||
totalCount: number;
|
||||
upgradeRequests: MaestroDetail["upgradeRequests"];
|
||||
};
|
||||
@@ -30,6 +31,7 @@ const selectClass =
|
||||
export function UpgradeRequestsSection({
|
||||
maestroID,
|
||||
accountType,
|
||||
activateStatus,
|
||||
totalCount,
|
||||
upgradeRequests,
|
||||
}: UpgradeRequestsSectionProps) {
|
||||
@@ -39,8 +41,10 @@ export function UpgradeRequestsSection({
|
||||
const [selectedAccountType, setSelectedAccountType] = useState<number | null>(null);
|
||||
const [errorMessage, setErrorMessage] = useState("");
|
||||
|
||||
const isTrial = activateStatus === ACTIVATE_STATUSES.TRIAL;
|
||||
const isUpgradeEnabled =
|
||||
selectedAccountType !== null && selectedAccountType > accountType;
|
||||
selectedAccountType !== null &&
|
||||
(isTrial ? selectedAccountType >= accountType : selectedAccountType > accountType);
|
||||
const isDisabled = isCreating || isPending;
|
||||
|
||||
async function handleUpgrade() {
|
||||
@@ -107,7 +111,7 @@ export function UpgradeRequestsSection({
|
||||
<option value="">요금제 선택</option>
|
||||
{upgradeOptions.map((opt) => (
|
||||
<option
|
||||
disabled={opt.value <= accountType}
|
||||
disabled={isTrial ? opt.value < accountType : opt.value <= accountType}
|
||||
key={opt.value}
|
||||
value={opt.value}
|
||||
>
|
||||
|
||||
@@ -102,6 +102,7 @@ export default async function MaestroDetailPage({
|
||||
|
||||
<UpgradeRequestsSection
|
||||
accountType={maestro.accountType}
|
||||
activateStatus={maestro.activateStatus}
|
||||
maestroID={maestroID}
|
||||
totalCount={detail.counts.upgradeRequests}
|
||||
upgradeRequests={detail.upgradeRequests}
|
||||
|
||||
Reference in New Issue
Block a user