Loading frontend/src/components/AddPart/AddProcessor.tsx +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ export function AddProcessor() { const [manufacturer, setManufacturer] = useState<Manufacturer>(); const [socket, setSocket] = useState<Socket>(); const [integratedGraphics, setIntegratedGraphics] = useState<IntegratedGraphics>(); useState<IntegratedGraphics | null>(); const { register, handleSubmit, getValues } = useForm<Processor>(); const { Loading @@ -50,7 +50,7 @@ export function AddProcessor() { price: getValues('price'), manufacturerId: manufacturer.id, socketId: socket.id, integratedGraphicsId: integratedGraphics.id, integratedGraphicsId: integratedGraphics?.id ?? null, image: stored[0].filename, }; mutate(processor); Loading frontend/src/components/AddPart/PartAttributes/IntegratedGraphicsAttr.tsx +9 −4 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ import { useQuery } from 'react-query'; import { readManyIntegratedGraphics } from '../../../services/integratedGraphicsApi'; interface IntegratedGraphicsProps { integratedGraphic: IntegratedGraphics; setIntegratedGraphic: (data: IntegratedGraphics) => void; integratedGraphic: IntegratedGraphics | null; setIntegratedGraphic: (data: IntegratedGraphics | null) => void; } export function IntegratedGraphicsAttr({ Loading @@ -22,9 +22,13 @@ export function IntegratedGraphicsAttr({ queryFn: async () => readManyIntegratedGraphics(), }); const handleIntegratedGraphicsChange = ( event: SelectChangeEvent<IntegratedGraphics> event: SelectChangeEvent<IntegratedGraphics | string> ) => { if (event.target.value === 'None') { setIntegratedGraphic(null); } else { setIntegratedGraphic(event.target.value as IntegratedGraphics); } }; return ( <div className="formAdd__item"> Loading @@ -35,6 +39,7 @@ export function IntegratedGraphicsAttr({ autoWidth onChange={handleIntegratedGraphicsChange} > <MenuItem value={'None'}>None</MenuItem> {integratedGraphics?.map((i) => ( <MenuItem key={i.id} value={i}> {i.name} Loading frontend/src/state/selectors.ts +2 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import { } from './atoms'; const isEmptyOrHas = <T extends { id: string }>(set: T[], value: T) => set.length === 0 || set.find((x) => x?.id === value?.id); set.length === 0 || set.findIndex((x) => x?.id === value?.id) !== -1; export const filteredProcessorsSelector = selector({ key: 'filteredProcessorsSelector', Loading @@ -31,6 +31,7 @@ export const filteredProcessorsSelector = selector({ const sortName = get(sortNameAtom); const sortPrice = get(sortPriceAtom); console.log(processorFilters); return processors .filter((processor) => { if ( Loading Loading
frontend/src/components/AddPart/AddProcessor.tsx +2 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ export function AddProcessor() { const [manufacturer, setManufacturer] = useState<Manufacturer>(); const [socket, setSocket] = useState<Socket>(); const [integratedGraphics, setIntegratedGraphics] = useState<IntegratedGraphics>(); useState<IntegratedGraphics | null>(); const { register, handleSubmit, getValues } = useForm<Processor>(); const { Loading @@ -50,7 +50,7 @@ export function AddProcessor() { price: getValues('price'), manufacturerId: manufacturer.id, socketId: socket.id, integratedGraphicsId: integratedGraphics.id, integratedGraphicsId: integratedGraphics?.id ?? null, image: stored[0].filename, }; mutate(processor); Loading
frontend/src/components/AddPart/PartAttributes/IntegratedGraphicsAttr.tsx +9 −4 Original line number Diff line number Diff line Loading @@ -9,8 +9,8 @@ import { useQuery } from 'react-query'; import { readManyIntegratedGraphics } from '../../../services/integratedGraphicsApi'; interface IntegratedGraphicsProps { integratedGraphic: IntegratedGraphics; setIntegratedGraphic: (data: IntegratedGraphics) => void; integratedGraphic: IntegratedGraphics | null; setIntegratedGraphic: (data: IntegratedGraphics | null) => void; } export function IntegratedGraphicsAttr({ Loading @@ -22,9 +22,13 @@ export function IntegratedGraphicsAttr({ queryFn: async () => readManyIntegratedGraphics(), }); const handleIntegratedGraphicsChange = ( event: SelectChangeEvent<IntegratedGraphics> event: SelectChangeEvent<IntegratedGraphics | string> ) => { if (event.target.value === 'None') { setIntegratedGraphic(null); } else { setIntegratedGraphic(event.target.value as IntegratedGraphics); } }; return ( <div className="formAdd__item"> Loading @@ -35,6 +39,7 @@ export function IntegratedGraphicsAttr({ autoWidth onChange={handleIntegratedGraphicsChange} > <MenuItem value={'None'}>None</MenuItem> {integratedGraphics?.map((i) => ( <MenuItem key={i.id} value={i}> {i.name} Loading
frontend/src/state/selectors.ts +2 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import { } from './atoms'; const isEmptyOrHas = <T extends { id: string }>(set: T[], value: T) => set.length === 0 || set.find((x) => x?.id === value?.id); set.length === 0 || set.findIndex((x) => x?.id === value?.id) !== -1; export const filteredProcessorsSelector = selector({ key: 'filteredProcessorsSelector', Loading @@ -31,6 +31,7 @@ export const filteredProcessorsSelector = selector({ const sortName = get(sortNameAtom); const sortPrice = get(sortPriceAtom); console.log(processorFilters); return processors .filter((processor) => { if ( Loading