feat(vehicles): add 'static' and 'drone' vehicle categories
This commit is contained in:
parent
adbfcb0fd7
commit
1fdb6bf872
9 changed files with 44851 additions and 3 deletions
|
|
@ -5,7 +5,15 @@ import type { Vehicle } from "@/payload-types";
|
|||
import { VehicleCard } from "@/components/frontend/logistics/VehicleCard";
|
||||
import { VehicleFilters } from "@/components/frontend/logistics/VehicleFilters";
|
||||
|
||||
const categories = ["civilian", "utility", "transport", "weaponized", "military"];
|
||||
const categories = [
|
||||
"civilian",
|
||||
"utility",
|
||||
"transport",
|
||||
"drone",
|
||||
"weaponized",
|
||||
"static",
|
||||
"military",
|
||||
];
|
||||
|
||||
export function VehiclesList({ vehicles }: { vehicles: Vehicle[] }) {
|
||||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ const categoryColors: Record<string, string> = {
|
|||
civilian: "bg-muted text-muted-foreground",
|
||||
utility: "bg-blue-500/20 text-blue-400",
|
||||
transport: "bg-green-500/20 text-green-400",
|
||||
drone: "bg-violet-500/20 text-violet-400",
|
||||
weaponized: "bg-red-500/20 text-red-400",
|
||||
static: "bg-slate-500/20 text-slate-400",
|
||||
military: "bg-amber-500/20 text-amber-400",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -109,10 +109,18 @@ export const Vehicles: CollectionConfig = {
|
|||
label: "Transport",
|
||||
value: "transport",
|
||||
},
|
||||
{
|
||||
label: "Drone",
|
||||
value: "drone",
|
||||
},
|
||||
{
|
||||
label: "Weaponized",
|
||||
value: "weaponized",
|
||||
},
|
||||
{
|
||||
label: "Static",
|
||||
value: "static",
|
||||
},
|
||||
{
|
||||
label: "Military",
|
||||
value: "military",
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ const categoryColors: Record<string, string> = {
|
|||
civilian: "bg-stone-500/20 text-stone-400",
|
||||
utility: "bg-emerald-500/20 text-emerald-400",
|
||||
transport: "bg-blue-500/20 text-blue-400",
|
||||
drone: "bg-violet-500/20 text-violet-400",
|
||||
weaponized: "bg-red-500/20 text-red-400",
|
||||
static: "bg-slate-500/20 text-slate-400",
|
||||
military: "bg-amber-500/20 text-amber-400",
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +59,9 @@ const categoryLabels: Record<string, string> = {
|
|||
civilian: "Civilian",
|
||||
utility: "Utility",
|
||||
transport: "Transport",
|
||||
drone: "Drone",
|
||||
weaponized: "Weaponized",
|
||||
static: "Static",
|
||||
military: "Military",
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ const categoryLabels: Record<string, string> = {
|
|||
civilian: "Civilian",
|
||||
utility: "Utility",
|
||||
transport: "Transport",
|
||||
drone: "Drone",
|
||||
weaponized: "Weaponized",
|
||||
static: "Static",
|
||||
military: "Military",
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,15 @@
|
|||
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||
|
||||
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TYPE "public"."enum_vehicles_category" ADD VALUE 'drone' BEFORE 'weaponized';
|
||||
ALTER TYPE "public"."enum_vehicles_category" ADD VALUE 'static' BEFORE 'military';`)
|
||||
}
|
||||
|
||||
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||
await db.execute(sql`
|
||||
ALTER TABLE "vehicles_category" ALTER COLUMN "value" SET DATA TYPE text;
|
||||
DROP TYPE "public"."enum_vehicles_category";
|
||||
CREATE TYPE "public"."enum_vehicles_category" AS ENUM('civilian', 'utility', 'transport', 'weaponized', 'military');
|
||||
ALTER TABLE "vehicles_category" ALTER COLUMN "value" SET DATA TYPE "public"."enum_vehicles_category" USING "value"::"public"."enum_vehicles_category";`)
|
||||
}
|
||||
|
|
@ -148,6 +148,7 @@ import * as migration_20261020_191433_add_interior_module_effect_types from './2
|
|||
import * as migration_20261020_200000_add_interior_asset_outputs_flag from './20261020_200000_add_interior_asset_outputs_flag';
|
||||
import * as migration_20261020_201242_add_room_fixture_blocks_station from './20261020_201242_add_room_fixture_blocks_station';
|
||||
import * as migration_20261022_170228_add_vehicle_mod_field from './20261022_170228_add_vehicle_mod_field';
|
||||
import * as migration_20261026_073228_add_vehicle_category_static_and_drone from './20261026_073228_add_vehicle_category_static_and_drone';
|
||||
|
||||
export const migrations = [
|
||||
{
|
||||
|
|
@ -898,6 +899,11 @@ export const migrations = [
|
|||
{
|
||||
up: migration_20261022_170228_add_vehicle_mod_field.up,
|
||||
down: migration_20261022_170228_add_vehicle_mod_field.down,
|
||||
name: '20261022_170228_add_vehicle_mod_field'
|
||||
name: '20261022_170228_add_vehicle_mod_field',
|
||||
},
|
||||
{
|
||||
up: migration_20261026_073228_add_vehicle_category_static_and_drone.up,
|
||||
down: migration_20261026_073228_add_vehicle_category_static_and_drone.down,
|
||||
name: '20261026_073228_add_vehicle_category_static_and_drone'
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2421,7 +2421,7 @@ export interface Vehicle {
|
|||
[k: string]: unknown;
|
||||
} | null;
|
||||
image?: (number | null) | Media;
|
||||
category?: ('civilian' | 'utility' | 'transport' | 'weaponized' | 'military')[] | null;
|
||||
category?: ('civilian' | 'utility' | 'transport' | 'drone' | 'weaponized' | 'static' | 'military')[] | null;
|
||||
/**
|
||||
* Fuel configuration for this vehicle. Defines what fuel type it uses, how much it can hold, and how fast it consumes fuel.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue