From 249f32a5bdd31bf3ba24f9530a934a939c2e4947 Mon Sep 17 00:00:00 2001 From: DekoKiyo Date: Sat, 21 Sep 2024 09:03:12 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=AB=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E7=94=A8=E3=82=B8=E3=82=A7=E3=83=8D=E3=83=AC=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=83=BC=E3=81=AE=E5=9F=BA=E7=A4=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PacificBankHeist/Configurations.cs | 4 +- JapaneseCallouts/Json/PacificBankHeist.json | 4 +- web/package-lock.json | 114 +++++++++++++ web/package.json | 3 + web/src/App.tsx | 10 +- web/src/components/ui/accordion.tsx | 56 +++++++ web/src/components/ui/sheet.tsx | 138 ++++++++++++++++ web/src/components/ui/toggle-group.tsx | 59 +++++++ web/src/components/ui/toggle.tsx | 43 +++++ .../generators/Callouts/PacificBankHeist.tsx | 16 -- .../generators/components/ValueAndChance.tsx | 150 ++++++++++++++++++ web/src/generators/components/Vector3.tsx | 15 ++ web/src/generators/components/Vector3H.tsx | 14 ++ .../pages/Callouts/PacificBankHeist.tsx | 77 +++++++++ .../generators/{ => pages}/Objects/Ped.tsx | 30 ++-- .../{ => pages}/Objects/Vehicle.tsx | 30 ++-- .../generators/{ => pages}/Objects/Weapon.tsx | 32 ++-- .../{ => pages}/Outfits/Outfits.tsx | 10 +- web/src/styles/globals.css | 17 ++ web/tailwind.config.js | 134 ++++++++-------- 20 files changed, 818 insertions(+), 138 deletions(-) create mode 100644 web/src/components/ui/accordion.tsx create mode 100644 web/src/components/ui/sheet.tsx create mode 100644 web/src/components/ui/toggle-group.tsx create mode 100644 web/src/components/ui/toggle.tsx delete mode 100644 web/src/generators/Callouts/PacificBankHeist.tsx create mode 100644 web/src/generators/components/ValueAndChance.tsx create mode 100644 web/src/generators/components/Vector3.tsx create mode 100644 web/src/generators/components/Vector3H.tsx create mode 100644 web/src/generators/pages/Callouts/PacificBankHeist.tsx rename web/src/generators/{ => pages}/Objects/Ped.tsx (94%) rename web/src/generators/{ => pages}/Objects/Vehicle.tsx (90%) rename web/src/generators/{ => pages}/Objects/Weapon.tsx (90%) rename web/src/generators/{ => pages}/Outfits/Outfits.tsx (99%) diff --git a/JapaneseCallouts/Callouts/PacificBankHeist/Configurations.cs b/JapaneseCallouts/Callouts/PacificBankHeist/Configurations.cs index 175bfefc..68c6180b 100644 --- a/JapaneseCallouts/Callouts/PacificBankHeist/Configurations.cs +++ b/JapaneseCallouts/Callouts/PacificBankHeist/Configurations.cs @@ -43,7 +43,7 @@ internal class Configurations : IConfig public WeaponConfig[] RobbersWeapons { get; set; } [JsonPropertyName("robbers_sub_weapons")] public WeaponConfig[] RobbersThrowableWeapons { get; set; } - [JsonPropertyName("weapon_in_riot")] + [JsonPropertyName("weapons_in_riot")] public WeaponConfig[] WeaponInRiot { get; set; } // Positions @@ -67,7 +67,7 @@ internal class Configurations : IConfig public Position[] NormalRobbersPositions { get; set; } [JsonPropertyName("robbers_negotiation_positions")] public Position[] RobbersNegotiationPositions { get; set; } - [JsonPropertyName("robbers_sneak_position")] + [JsonPropertyName("robbers_sneak_positions")] public RobbersSneakPosition[] RobbersSneakPosition { get; set; } [JsonPropertyName("robbers_in_vault_positions")] public Position[] RobbersInVaultPositions { get; set; } diff --git a/JapaneseCallouts/Json/PacificBankHeist.json b/JapaneseCallouts/Json/PacificBankHeist.json index 091e676e..cdcba00b 100644 --- a/JapaneseCallouts/Json/PacificBankHeist.json +++ b/JapaneseCallouts/Json/PacificBankHeist.json @@ -55,7 +55,7 @@ "swat_weapons": [], "robbers_weapons": [], "robbers_sub_weapons": [], - "weapon_in_riot": [], + "weapons_in_riot": [], "police_cruiser_positions": [], "police_transporter_positions": [], "riot_positions": [], @@ -66,7 +66,7 @@ "standing_officer_positions": [], "normal_robbers_positions": [], "robbers_negotiation_positions": [], - "robbers_sneak_position": [], + "robbers_sneak_positions": [], "robbers_in_vault_positions": [], "robbers_surrendering_positions": [], "firefighter_positions": [], diff --git a/web/package-lock.json b/web/package-lock.json index 66e6e534..99462e85 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "dependencies": { "@hookform/resolvers": "^3.9.0", + "@radix-ui/react-accordion": "^1.2.0", "@radix-ui/react-checkbox": "^1.1.1", "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", @@ -18,6 +19,8 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", + "@radix-ui/react-toggle": "^1.1.0", + "@radix-ui/react-toggle-group": "^1.1.0", "@types/react-router-dom": "^5.3.3", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", @@ -3004,6 +3007,36 @@ "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.1.0.tgz", "integrity": "sha512-4Z8dn6Upk0qk4P74xBhZ6Hd/w0mPEzOOLxy4xiPXOXqjF7jZS0VAKk7/x/H6FyY2zCkYJqePf1G5KmkmNJ4RBA==" }, + "node_modules/@radix-ui/react-accordion": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-accordion/-/react-accordion-1.2.0.tgz", + "integrity": "sha512-HJOzSX8dQqtsp/3jVxCU3CXEONF7/2jlGAB28oX8TTw1Dz8JYbEI1UcL8355PuLBE41/IRRMvCw7VkiK/jcUOQ==", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-collapsible": "1.1.0", + "@radix-ui/react-collection": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-arrow": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.0.tgz", @@ -3055,6 +3088,35 @@ } } }, + "node_modules/@radix-ui/react-collapsible": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collapsible/-/react-collapsible-1.1.0.tgz", + "integrity": "sha512-zQY7Epa8sTL0mq4ajSJpjgn2YmCgyrG7RsQgLp3C0LQVkG7+Tf6Pv1CeNWZLyqMjhdPkBa5Lx7wYBeSu7uCSTA==", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-id": "1.1.0", + "@radix-ui/react-presence": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-layout-effect": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-collection": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", @@ -3601,6 +3663,58 @@ } } }, + "node_modules/@radix-ui/react-toggle": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-toggle/-/react-toggle-1.1.0.tgz", + "integrity": "sha512-gwoxaKZ0oJ4vIgzsfESBuSgJNdc0rv12VhHgcqN0TEJmmZixXG/2XpsLK8kzNWYcnaoRIEEQc0bEi3dIvdUpjw==", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-toggle-group": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-toggle-group/-/react-toggle-group-1.1.0.tgz", + "integrity": "sha512-PpTJV68dZU2oqqgq75Uzto5o/XfOVgkrJ9rulVmfTKxWp3HfUjHE6CP/WLRR4AzPX9HWxw7vFow2me85Yu+Naw==", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-context": "1.1.0", + "@radix-ui/react-direction": "1.1.0", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-roving-focus": "1.1.0", + "@radix-ui/react-toggle": "1.1.0", + "@radix-ui/react-use-controllable-state": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.0.tgz", diff --git a/web/package.json b/web/package.json index 9fa20bb6..70dbcb47 100644 --- a/web/package.json +++ b/web/package.json @@ -19,6 +19,7 @@ }, "dependencies": { "@hookform/resolvers": "^3.9.0", + "@radix-ui/react-accordion": "^1.2.0", "@radix-ui/react-checkbox": "^1.1.1", "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", @@ -28,6 +29,8 @@ "@radix-ui/react-slot": "^1.1.0", "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-toast": "^1.2.1", + "@radix-ui/react-toggle": "^1.1.0", + "@radix-ui/react-toggle-group": "^1.1.0", "@types/react-router-dom": "^5.3.3", "class-variance-authority": "^0.7.0", "clsx": "^2.1.1", diff --git a/web/src/App.tsx b/web/src/App.tsx index 12965a65..2889e8f0 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -13,13 +13,13 @@ import Epic from './pages/Installation/Epic'; import Rockstar from './pages/Installation/Rockstar'; import Configurations from './pages/Configurations'; import { Callouts, CalloutsBase } from './pages/Callouts'; -import PacificBankHeistGen from './generators/Callouts/PacificBankHeist'; -import { VehicleGen } from './generators/Objects/Vehicle'; +import { PacificBankHeistGen } from './generators/pages/Callouts/PacificBankHeist'; +import { VehicleGen } from './generators/pages/Objects/Vehicle'; import { Toaster } from './components/ui/toaster'; -import { PedGen } from './generators/Objects/Ped'; -import { WeaponGen } from './generators/Objects/Weapon'; +import { PedGen } from './generators/pages/Objects/Ped'; +import { WeaponGen } from './generators/pages/Objects/Weapon'; import Generators from './pages/Generators'; -import { OutfitGen } from './generators/Outfits/Outfits'; +import { OutfitGen } from './generators/pages/Outfits/Outfits'; function App() { return ( diff --git a/web/src/components/ui/accordion.tsx b/web/src/components/ui/accordion.tsx new file mode 100644 index 00000000..bf666b8f --- /dev/null +++ b/web/src/components/ui/accordion.tsx @@ -0,0 +1,56 @@ +import * as React from "react" +import * as AccordionPrimitive from "@radix-ui/react-accordion" +import { ChevronDown } from "lucide-react" + +import { cn } from "../../lib/utils" + +const Accordion = AccordionPrimitive.Root + +const AccordionItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +AccordionItem.displayName = "AccordionItem" + +const AccordionTrigger = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + svg]:rotate-180", + className + )} + {...props} + > + {children} + + + +)) +AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName + +const AccordionContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + +
{children}
+
+)) + +AccordionContent.displayName = AccordionPrimitive.Content.displayName + +export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } diff --git a/web/src/components/ui/sheet.tsx b/web/src/components/ui/sheet.tsx new file mode 100644 index 00000000..58429f01 --- /dev/null +++ b/web/src/components/ui/sheet.tsx @@ -0,0 +1,138 @@ +import * as React from "react" +import * as SheetPrimitive from "@radix-ui/react-dialog" +import { cva, type VariantProps } from "class-variance-authority" +import { X } from "lucide-react" + +import { cn } from "../../lib/utils" + +const Sheet = SheetPrimitive.Root + +const SheetTrigger = SheetPrimitive.Trigger + +const SheetClose = SheetPrimitive.Close + +const SheetPortal = SheetPrimitive.Portal + +const SheetOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetOverlay.displayName = SheetPrimitive.Overlay.displayName + +const sheetVariants = cva( + "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", + { + variants: { + side: { + top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", + bottom: + "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", + left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", + right: + "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", + }, + }, + defaultVariants: { + side: "right", + }, + } +) + +interface SheetContentProps + extends React.ComponentPropsWithoutRef, + VariantProps {} + +const SheetContent = React.forwardRef< + React.ElementRef, + SheetContentProps +>(({ side = "right", className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +SheetContent.displayName = SheetPrimitive.Content.displayName + +const SheetHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetHeader.displayName = "SheetHeader" + +const SheetFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +SheetFooter.displayName = "SheetFooter" + +const SheetTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetTitle.displayName = SheetPrimitive.Title.displayName + +const SheetDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +SheetDescription.displayName = SheetPrimitive.Description.displayName + +export { + Sheet, + SheetPortal, + SheetOverlay, + SheetTrigger, + SheetClose, + SheetContent, + SheetHeader, + SheetFooter, + SheetTitle, + SheetDescription, +} diff --git a/web/src/components/ui/toggle-group.tsx b/web/src/components/ui/toggle-group.tsx new file mode 100644 index 00000000..b0365e7c --- /dev/null +++ b/web/src/components/ui/toggle-group.tsx @@ -0,0 +1,59 @@ +import * as React from "react" +import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group" +import { type VariantProps } from "class-variance-authority" + +import { cn } from "../../lib/utils" +import { toggleVariants } from "../../components/ui/toggle" + +const ToggleGroupContext = React.createContext< + VariantProps +>({ + size: "default", + variant: "default", +}) + +const ToggleGroup = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, variant, size, children, ...props }, ref) => ( + + + {children} + + +)) + +ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName + +const ToggleGroupItem = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, children, variant, size, ...props }, ref) => { + const context = React.useContext(ToggleGroupContext) + + return ( + + {children} + + ) +}) + +ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName + +export { ToggleGroup, ToggleGroupItem } diff --git a/web/src/components/ui/toggle.tsx b/web/src/components/ui/toggle.tsx new file mode 100644 index 00000000..436e07a8 --- /dev/null +++ b/web/src/components/ui/toggle.tsx @@ -0,0 +1,43 @@ +import * as React from "react" +import * as TogglePrimitive from "@radix-ui/react-toggle" +import { cva, type VariantProps } from "class-variance-authority" + +import { cn } from "../../lib/utils" + +const toggleVariants = cva( + "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground", + { + variants: { + variant: { + default: "bg-transparent", + outline: + "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground", + }, + size: { + default: "h-10 px-3", + sm: "h-9 px-2.5", + lg: "h-11 px-5", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +const Toggle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef & + VariantProps +>(({ className, variant, size, ...props }, ref) => ( + +)) + +Toggle.displayName = TogglePrimitive.Root.displayName + +export { Toggle, toggleVariants } diff --git a/web/src/generators/Callouts/PacificBankHeist.tsx b/web/src/generators/Callouts/PacificBankHeist.tsx deleted file mode 100644 index a981cb3f..00000000 --- a/web/src/generators/Callouts/PacificBankHeist.tsx +++ /dev/null @@ -1,16 +0,0 @@ -const PacificBankHeistGen = () => { - return ( - <> -
-

Pacific Bank Heist Generator

- -
- -
-
PREVIEW
-
- - ); -}; - -export default PacificBankHeistGen; diff --git a/web/src/generators/components/ValueAndChance.tsx b/web/src/generators/components/ValueAndChance.tsx new file mode 100644 index 00000000..37dc3370 --- /dev/null +++ b/web/src/generators/components/ValueAndChance.tsx @@ -0,0 +1,150 @@ +import { useState } from 'react'; +import { Button } from '../../components/ui/button'; +import { Input } from '../../components/ui/input'; +import { Label } from '../../components/ui/label'; +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger +} from '../../components/ui/accordion'; +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList +} from '../../components/ui/command'; +import { Popover, PopoverContent, PopoverTrigger } from '../../components/ui/popover'; +import { Check, ChevronsUpDown } from 'lucide-react'; +import { cn } from '../../lib/utils'; +import { v4 as uuidv4 } from 'uuid'; +import { ID_OUTFITS, ID_PEDS, ID_VEHICLES, ID_WEAPONS } from '../../store/keys'; +import { PedConfig } from '../pages/Objects/Ped'; +import { VehicleConfig } from '../pages/Objects/Vehicle'; +import { WeaponConfig } from '../pages/Objects/Weapon'; +import { Outfit } from '../pages/Outfits/Outfits'; + +export const ValueAndChance = (mode: 'ped' | 'vehicle' | 'weapon' | 'outfit') => { + const [values, setValues] = useState([]); + + return ( + <> +
+ + + Click here to expand the config. + {Card(mode)} + + +
+ + ); +}; + +const Card = (mode: 'ped' | 'vehicle' | 'weapon' | 'outfit') => { + const [isOpen, setOpen] = useState(false); + const [value, setValue] = useState(''); + + const presets: string[] = []; + + console.log(mode); + + switch (mode) { + case 'outfit': { + const temp: string | null = localStorage.getItem(ID_OUTFITS); + if (temp) { + const local: Outfit[] = JSON.parse(temp) as Outfit[]; + local.map((preset) => { + presets.push(preset.name); + }); + } + break; + } + case 'ped': { + const temp: string | null = localStorage.getItem(ID_PEDS); + if (temp) { + const local: PedConfig[] = JSON.parse(temp) as PedConfig[]; + local.map((preset) => { + presets.push(preset.name); + }); + } + break; + } + case 'vehicle': { + const temp: string | null = localStorage.getItem(ID_VEHICLES); + if (temp) { + const local: VehicleConfig[] = JSON.parse(temp) as VehicleConfig[]; + local.map((preset) => { + presets.push(preset.name); + }); + } + break; + } + case 'weapon': { + const temp: string | null = localStorage.getItem(ID_WEAPONS); + if (temp) { + const local: WeaponConfig[] = JSON.parse(temp) as WeaponConfig[]; + local.map((preset) => { + presets.push(preset.name); + }); + } + break; + } + } + + const id = uuidv4(); + + console.log(presets); + + return ( + <> +
+ +
+ + + + + + + + + + No preset found. + + {presets.map((preset) => ( + { + setValue(currentValue === value ? '' : currentValue); + setOpen(false); + }}> + + {preset} + + ))} + + + + + +
+
+ + ); +}; diff --git a/web/src/generators/components/Vector3.tsx b/web/src/generators/components/Vector3.tsx new file mode 100644 index 00000000..ae4695f9 --- /dev/null +++ b/web/src/generators/components/Vector3.tsx @@ -0,0 +1,15 @@ +export interface Vector3Config { + x: number; + y: number; + z: number; +} + +export const Vector3 = () => { + return ( + <> +
+ +
+ + ); +}; diff --git a/web/src/generators/components/Vector3H.tsx b/web/src/generators/components/Vector3H.tsx new file mode 100644 index 00000000..0d2795d2 --- /dev/null +++ b/web/src/generators/components/Vector3H.tsx @@ -0,0 +1,14 @@ +export interface Vector3HConfig { + x: number; + y: number; + z: number; + heading: number; +} + +export const Vector3H = () => { + return ( + <> +
+ + ); +}; diff --git a/web/src/generators/pages/Callouts/PacificBankHeist.tsx b/web/src/generators/pages/Callouts/PacificBankHeist.tsx new file mode 100644 index 00000000..4fdffc1e --- /dev/null +++ b/web/src/generators/pages/Callouts/PacificBankHeist.tsx @@ -0,0 +1,77 @@ +import { zodResolver } from '@hookform/resolvers/zod'; +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; +import { v4 as uuidv4 } from 'uuid'; + +import { Button } from '../../../components/ui/button'; +import { Input } from '../../../components/ui/input'; +import { toast } from '../../../components/ui/use-toast'; +import { useTranslation } from 'react-i18next'; +import { ID_PEDS } from '../../../store/keys'; +import { createElement, ReactElement, useEffect, useState } from 'react'; +import { Switch } from '../../../components/ui/switch'; +import { VehicleConfig } from '../Objects/Vehicle'; +import { PedConfig } from '../Objects/Ped'; +import { WeaponConfig } from '../Objects/Weapon'; +import { Vector3Config } from '../../components/Vector3'; +import { Vector3HConfig } from '../../components/Vector3H'; +import { ValueAndChance } from '../../components/ValueAndChance'; + +export interface PacificBankHeistConfig { + hostage_count: number; + wife_name: string; + police_cruisers: VehicleConfig[]; + police_transporters: VehicleConfig[]; + police_riots: VehicleConfig[]; + ambulances: VehicleConfig[]; + firetrucks: VehicleConfig[]; + + police_officers_models: PedConfig[]; + police_swat_models: PedConfig[]; + paramedic_models: PedConfig[]; + firefighter_models: PedConfig[]; + commander_models: PedConfig[]; + wife_models: PedConfig[]; + robber_models: PedConfig[]; + hostage_models: PedConfig[]; + + officer_weapons: WeaponConfig[]; + swat_weapons: WeaponConfig[]; + robbers_weapons: WeaponConfig[]; + robbers_sub_weapons: WeaponConfig[]; + weapons_in_riot: WeaponConfig[]; + + police_cruiser_positions: Vector3HConfig[]; + police_transporter_positions: Vector3HConfig[]; + riot_positions: Vector3HConfig[]; + ambulance_positions: Vector3HConfig[]; + firetruck_positions: Vector3HConfig[]; + barrier_positions: Vector3HConfig[]; + aiming_officer_positions: Vector3HConfig[]; + standing_officer_positions: Vector3HConfig[]; + normal_robbers_positions: Vector3HConfig[]; + robbers_negotiation_positions: Vector3HConfig[]; + robbers_sneak_positions: Vector3HConfig[]; + robbers_in_vault_positions: Vector3HConfig[]; + robbers_surrendering_positions: Vector3HConfig[]; + firefighter_positions: Vector3HConfig[]; + paramedic_positions: Vector3HConfig[]; + left_sitting_swat_positions: Vector3HConfig[]; + right_sitting_swat_positions: Vector3HConfig[]; + right_looking_swat_positions: Vector3HConfig[]; + hostage_positions: Vector3Config[]; + hostage_safe_position: Vector3HConfig; + commander_position: Vector3HConfig; + wife_position: Vector3HConfig; + wife_vehicle_destination: Vector3Config; +} + +export const PacificBankHeistGen = () => { + const { t } = useTranslation(); + + useEffect(() => { + // updateList(); + }, []); + + return
{ValueAndChance('vehicle')}
; +}; diff --git a/web/src/generators/Objects/Ped.tsx b/web/src/generators/pages/Objects/Ped.tsx similarity index 94% rename from web/src/generators/Objects/Ped.tsx rename to web/src/generators/pages/Objects/Ped.tsx index 5cbfe9eb..c23722de 100644 --- a/web/src/generators/Objects/Ped.tsx +++ b/web/src/generators/pages/Objects/Ped.tsx @@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form'; import { z } from 'zod'; import { v4 as uuidv4 } from 'uuid'; -import { Button } from '../../components/ui/button'; +import { Button } from '../../../components/ui/button'; import { Form, FormControl, @@ -12,15 +12,15 @@ import { FormItem, FormLabel, FormMessage -} from '../../components/ui/form'; -import { Input } from '../../components/ui/input'; -import { toast } from '../../components/ui/use-toast'; +} from '../../../components/ui/form'; +import { Input } from '../../../components/ui/input'; +import { toast } from '../../../components/ui/use-toast'; import { useTranslation } from 'react-i18next'; -import { ID_PEDS } from '../../store/keys'; +import { ID_PEDS } from '../../../store/keys'; import { createElement, ReactElement, useEffect, useState } from 'react'; -import { Switch } from '../../components/ui/switch'; +import { Switch } from '../../../components/ui/switch'; -export interface Ped { +export interface PedConfig { name: string; random_props: boolean; health: number; @@ -124,7 +124,7 @@ export const PedGen = () => { const previous: string | null = localStorage.getItem(ID_PEDS); const tempList: ReactElement[] = []; if (previous) { - const local: Ped[] = JSON.parse(previous) as Ped[]; + const local: PedConfig[] = JSON.parse(previous) as PedConfig[]; local.map((data, i) => { tempList.push( @@ -135,8 +135,8 @@ export const PedGen = () => { onClick: () => { const previous: string | null = localStorage.getItem(ID_PEDS); if (previous) { - const local: Ped[] = JSON.parse(previous) as Ped[]; - const ped: Ped | undefined = local.find((x) => x.name === data?.name); + const local: PedConfig[] = JSON.parse(previous) as PedConfig[]; + const ped: PedConfig | undefined = local.find((x) => x.name === data?.name); if (ped) { form.setValue('name', data.name); form.setValue('random_props', data.random_props); @@ -165,7 +165,7 @@ export const PedGen = () => { const onSubmit = (data: z.infer) => { const previous: string | null = localStorage.getItem(ID_PEDS); if (previous) { - const local: Ped[] = JSON.parse(previous); + const local: PedConfig[] = JSON.parse(previous); if (local.filter((ped) => ped.name == data.name).length > 0) { toast({ variant: 'destructive', @@ -193,10 +193,10 @@ export const PedGen = () => { }); }; - function onUpdate(data: Ped) { + function onUpdate(data: PedConfig) { const previous: string | null = localStorage.getItem(ID_PEDS); if (previous) { - const local: Ped[] = JSON.parse(previous); + const local: PedConfig[] = JSON.parse(previous); local[index] = data; localStorage.setItem(ID_PEDS, JSON.stringify(local)); @@ -218,7 +218,7 @@ export const PedGen = () => { function onDelete() { const previous: string | null = localStorage.getItem(ID_PEDS); if (previous) { - const local: Ped[] = JSON.parse(previous); + const local: PedConfig[] = JSON.parse(previous); const newlocal = local.filter((_, i) => i !== index); localStorage.setItem(ID_PEDS, JSON.stringify(newlocal)); @@ -392,7 +392,7 @@ export const PedGen = () => {