fixed an vault edit error.
This commit is contained in:
@@ -83,9 +83,9 @@ const CALIBERS_BY_PLATFORM: Record<
|
|||||||
type CaliberOption = string | "";
|
type CaliberOption = string | "";
|
||||||
|
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
// Other controlled fields (optional scaffolding)
|
// Build Class (controlled list)
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
const PURPOSE_OPTIONS = [
|
const BUILD_CLASS_OPTIONS = [
|
||||||
"Home Defense",
|
"Home Defense",
|
||||||
"Duty / Patrol",
|
"Duty / Patrol",
|
||||||
"Training",
|
"Training",
|
||||||
@@ -94,7 +94,7 @@ const PURPOSE_OPTIONS = [
|
|||||||
"Range / Fun",
|
"Range / Fun",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
type PurposeOption = (typeof PURPOSE_OPTIONS)[number] | "";
|
type BuildClassOption = (typeof BUILD_CLASS_OPTIONS)[number] | "";
|
||||||
|
|
||||||
function fmt(d?: string | null) {
|
function fmt(d?: string | null) {
|
||||||
if (!d) return "—";
|
if (!d) return "—";
|
||||||
@@ -133,7 +133,7 @@ export default function EditBuildPage() {
|
|||||||
|
|
||||||
platform: PlatformOption;
|
platform: PlatformOption;
|
||||||
caliber: CaliberOption;
|
caliber: CaliberOption;
|
||||||
purpose: PurposeOption;
|
buildClass: BuildClassOption;
|
||||||
|
|
||||||
tagsText: string; // comma-separated for MVP
|
tagsText: string; // comma-separated for MVP
|
||||||
coverImageUrl: string;
|
coverImageUrl: string;
|
||||||
@@ -201,9 +201,11 @@ export default function EditBuildPage() {
|
|||||||
platform: normalizedPlatform,
|
platform: normalizedPlatform,
|
||||||
caliber: normalizedCaliber,
|
caliber: normalizedCaliber,
|
||||||
|
|
||||||
purpose: (PURPOSE_OPTIONS.includes((dto.buildClass ?? "") as any)
|
buildClass: (BUILD_CLASS_OPTIONS.includes(
|
||||||
|
(dto.buildClass ?? "") as any
|
||||||
|
)
|
||||||
? (dto.buildClass as any)
|
? (dto.buildClass as any)
|
||||||
: "") as PurposeOption,
|
: "") as BuildClassOption,
|
||||||
|
|
||||||
tagsText: Array.isArray(dto.tags) ? dto.tags.join(", ") : "",
|
tagsText: Array.isArray(dto.tags) ? dto.tags.join(", ") : "",
|
||||||
coverImageUrl: dto.coverImageUrl ?? "",
|
coverImageUrl: dto.coverImageUrl ?? "",
|
||||||
@@ -265,7 +267,7 @@ export default function EditBuildPage() {
|
|||||||
isPublic: !!profile.isPublic,
|
isPublic: !!profile.isPublic,
|
||||||
|
|
||||||
// Backend expects buildClass (not purpose)
|
// Backend expects buildClass (not purpose)
|
||||||
buildClass: profile.purpose || null,
|
buildClass: profile.buildClass || null,
|
||||||
|
|
||||||
caliber: profile.caliber || null,
|
caliber: profile.caliber || null,
|
||||||
coverImageUrl: profile.coverImageUrl?.trim() || null,
|
coverImageUrl: profile.coverImageUrl?.trim() || null,
|
||||||
@@ -454,24 +456,29 @@ export default function EditBuildPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Purpose */}
|
{/* Build Class */}
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-xs font-medium text-white/70">
|
<label className="block text-xs font-medium text-white/70">
|
||||||
Purpose
|
Build Class
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={profile.purpose}
|
value={profile.buildClass}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setProfile((p) =>
|
setProfile((p) =>
|
||||||
p ? { ...p, purpose: e.target.value as PurposeOption } : p
|
p
|
||||||
|
? {
|
||||||
|
...p,
|
||||||
|
buildClass: e.target.value as BuildClassOption,
|
||||||
|
}
|
||||||
|
: p
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
className="mt-1 w-full rounded-md border border-white/10 bg-black/30 px-3 py-2 text-sm text-white outline-none focus:ring-1 focus:ring-amber-400/60"
|
className="mt-1 w-full rounded-md border border-white/10 bg-black/30 px-3 py-2 text-sm text-white outline-none focus:ring-1 focus:ring-amber-400/60"
|
||||||
>
|
>
|
||||||
<option value="">Select…</option>
|
<option value="">Select…</option>
|
||||||
{PURPOSE_OPTIONS.map((p) => (
|
{BUILD_CLASS_OPTIONS.map((c) => (
|
||||||
<option key={p} value={p}>
|
<option key={c} value={c}>
|
||||||
{p}
|
{c}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
@@ -602,7 +609,7 @@ export default function EditBuildPage() {
|
|||||||
{profile.caliber || "—"}
|
{profile.caliber || "—"}
|
||||||
</span>
|
</span>
|
||||||
<span className="rounded-full border border-white/10 bg-white/5 px-2 py-1">
|
<span className="rounded-full border border-white/10 bg-white/5 px-2 py-1">
|
||||||
{profile.purpose || "—"}
|
{profile.buildClass || "—"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Generated
+9
@@ -1012,6 +1012,7 @@
|
|||||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"acorn": "bin/acorn"
|
"acorn": "bin/acorn"
|
||||||
},
|
},
|
||||||
@@ -1452,6 +1453,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.8.25",
|
"baseline-browser-mapping": "^2.8.25",
|
||||||
"caniuse-lite": "^1.0.30001754",
|
"caniuse-lite": "^1.0.30001754",
|
||||||
@@ -2134,6 +2136,7 @@
|
|||||||
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
@@ -2302,6 +2305,7 @@
|
|||||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rtsao/scc": "^1.1.0",
|
"@rtsao/scc": "^1.1.0",
|
||||||
"array-includes": "^3.1.9",
|
"array-includes": "^3.1.9",
|
||||||
@@ -4531,6 +4535,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.7",
|
"nanoid": "^3.3.7",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
@@ -4780,6 +4785,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
|
||||||
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
"integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0"
|
"loose-envify": "^1.1.0"
|
||||||
},
|
},
|
||||||
@@ -4792,6 +4798,7 @@
|
|||||||
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
|
||||||
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
"integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"loose-envify": "^1.1.0",
|
"loose-envify": "^1.1.0",
|
||||||
"scheduler": "^0.23.2"
|
"scheduler": "^0.23.2"
|
||||||
@@ -5796,6 +5803,7 @@
|
|||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -5965,6 +5973,7 @@
|
|||||||
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
"integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
|
|||||||
Reference in New Issue
Block a user