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 { VehicleCard } from "@/components/frontend/logistics/VehicleCard";
|
||||||
import { VehicleFilters } from "@/components/frontend/logistics/VehicleFilters";
|
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[] }) {
|
export function VehiclesList({ vehicles }: { vehicles: Vehicle[] }) {
|
||||||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
const [selectedCategory, setSelectedCategory] = useState<string | null>(null);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ const categoryColors: Record<string, string> = {
|
||||||
civilian: "bg-muted text-muted-foreground",
|
civilian: "bg-muted text-muted-foreground",
|
||||||
utility: "bg-blue-500/20 text-blue-400",
|
utility: "bg-blue-500/20 text-blue-400",
|
||||||
transport: "bg-green-500/20 text-green-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",
|
weaponized: "bg-red-500/20 text-red-400",
|
||||||
|
static: "bg-slate-500/20 text-slate-400",
|
||||||
military: "bg-amber-500/20 text-amber-400",
|
military: "bg-amber-500/20 text-amber-400",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,18 @@ export const Vehicles: CollectionConfig = {
|
||||||
label: "Transport",
|
label: "Transport",
|
||||||
value: "transport",
|
value: "transport",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Drone",
|
||||||
|
value: "drone",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Weaponized",
|
label: "Weaponized",
|
||||||
value: "weaponized",
|
value: "weaponized",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Static",
|
||||||
|
value: "static",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Military",
|
label: "Military",
|
||||||
value: "military",
|
value: "military",
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,9 @@ const categoryColors: Record<string, string> = {
|
||||||
civilian: "bg-stone-500/20 text-stone-400",
|
civilian: "bg-stone-500/20 text-stone-400",
|
||||||
utility: "bg-emerald-500/20 text-emerald-400",
|
utility: "bg-emerald-500/20 text-emerald-400",
|
||||||
transport: "bg-blue-500/20 text-blue-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",
|
weaponized: "bg-red-500/20 text-red-400",
|
||||||
|
static: "bg-slate-500/20 text-slate-400",
|
||||||
military: "bg-amber-500/20 text-amber-400",
|
military: "bg-amber-500/20 text-amber-400",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,7 +59,9 @@ const categoryLabels: Record<string, string> = {
|
||||||
civilian: "Civilian",
|
civilian: "Civilian",
|
||||||
utility: "Utility",
|
utility: "Utility",
|
||||||
transport: "Transport",
|
transport: "Transport",
|
||||||
|
drone: "Drone",
|
||||||
weaponized: "Weaponized",
|
weaponized: "Weaponized",
|
||||||
|
static: "Static",
|
||||||
military: "Military",
|
military: "Military",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ const categoryLabels: Record<string, string> = {
|
||||||
civilian: "Civilian",
|
civilian: "Civilian",
|
||||||
utility: "Utility",
|
utility: "Utility",
|
||||||
transport: "Transport",
|
transport: "Transport",
|
||||||
|
drone: "Drone",
|
||||||
weaponized: "Weaponized",
|
weaponized: "Weaponized",
|
||||||
|
static: "Static",
|
||||||
military: "Military",
|
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_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_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_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 = [
|
export const migrations = [
|
||||||
{
|
{
|
||||||
|
|
@ -898,6 +899,11 @@ export const migrations = [
|
||||||
{
|
{
|
||||||
up: migration_20261022_170228_add_vehicle_mod_field.up,
|
up: migration_20261022_170228_add_vehicle_mod_field.up,
|
||||||
down: migration_20261022_170228_add_vehicle_mod_field.down,
|
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;
|
[k: string]: unknown;
|
||||||
} | null;
|
} | null;
|
||||||
image?: (number | null) | Media;
|
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.
|
* 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