From 2b0933db57b8d3d2f3b314d953fa637fed1dc2d7 Mon Sep 17 00:00:00 2001 From: Lumivient Date: Thu, 26 Nov 2026 11:20:25 +0000 Subject: [PATCH 01/10] Prices tab layout --- src/cosm/components/materialpickerheader.tsx | 52 +++++ src/cosm/pricelist/corppricestab.tsx | 209 ++++++++++++------- src/cosm/vendors/shoppinglistmodal.tsx | 49 +---- 3 files changed, 195 insertions(+), 115 deletions(-) create mode 100644 src/cosm/components/materialpickerheader.tsx diff --git a/src/cosm/components/materialpickerheader.tsx b/src/cosm/components/materialpickerheader.tsx new file mode 100644 index 0000000..0f5a772 --- /dev/null +++ b/src/cosm/components/materialpickerheader.tsx @@ -0,0 +1,52 @@ +import { Box, Button, IconButton, Typography } from "@mui/material"; +import { FileUp, X } from "lucide-react"; + +interface MaterialPickerHeaderProps { + title: string; + isMobile?: boolean; + onImport: () => void; + onClose?: () => void; +} + +const MaterialPickerHeader = ({ + title, + isMobile = false, + onImport, + onClose, +}: MaterialPickerHeaderProps) => ( + + + {title} + + + + {isMobile && onClose && ( + + + + )} + + +); + +export default MaterialPickerHeader; diff --git a/src/cosm/pricelist/corppricestab.tsx b/src/cosm/pricelist/corppricestab.tsx index d96bdeb..189798c 100644 --- a/src/cosm/pricelist/corppricestab.tsx +++ b/src/cosm/pricelist/corppricestab.tsx @@ -16,14 +16,17 @@ import { IconButton, Button, CircularProgress, + Drawer, Tooltip, useTheme, alpha, + useMediaQuery, } from "@mui/material"; import { Search, Trash2, PlusCircle, Copy, X } from "lucide-react"; import CenterFocusStrongIcon from "@mui/icons-material/CenterFocusStrong"; import { API_BASE_URL } from "../../config/api"; import MaterialBadge from "../components/materialbadge"; +import MaterialPickerHeader from "../components/materialpickerheader"; import InlineConfirmButton from "../components/inlineconfirmbutton"; import PriceComparisonBadge from "../vendors/components/pricecomparisonbadge"; import { Toast } from "../vendors/toast"; @@ -538,11 +541,14 @@ VirtualMaterialList.displayName = "VirtualMaterialList"; */ const CorpPricesTab: React.FC = ({ marketData }) => { const theme = useTheme(); + const isCompact = useMediaQuery(theme.breakpoints.down("md")); const { searchQuery, exactMatch, setSearchQuery, toggleExactMatch } = useMaterialSearch(); const [materials, setMaterials] = useState([]); const [loading, setLoading] = useState(true); const [copyToastOpen, setCopyToastOpen] = useState(false); + const [showMaterials, setShowMaterials] = useState(false); + const isDrawerView = isCompact || showMaterials; const deferredSearch = useDeferredValue(searchQuery); const [cart, setCart] = useState(() => { @@ -695,77 +701,70 @@ const CorpPricesTab: React.FC = ({ marketData }) => { ); - return ( + const materialSelection = ( - - - - - + {}} + onClose={() => setShowMaterials(false)} + /> + setSearchQuery(e.target.value)} size="small" slotProps={{ input: { startAdornment: ( - - - + ), endAdornment: ( - {searchQuery ? ( - - setSearchQuery("")} - > - - - - ) : null} + {searchQuery && ( + setSearchQuery("")} + > + + + )} = ({ marketData }) => { }} sx={{ "& .MuiOutlinedInput-root": { - height: 40, - bgcolor: alpha(theme.palette.background.default, 0.5), - backdropFilter: "blur(5px)", + bgcolor: "rgba(0,0,0,0.15)", borderRadius: "12px", - "& fieldset": { - borderColor: alpha(theme.palette.common.white, 0.1), - }, - "&:hover fieldset": { - borderColor: theme.palette.primary.main, - }, - "&.Mui-focused fieldset": { - borderColor: theme.palette.primary.main, - }, - color: theme.palette.text.primary, }, }} /> - - - + + + + + + + ); + + return ( + + + + {materialSelection} = ({ marketData }) => { ...panelSx, display: "flex", flexDirection: "column", - height: { xs: "40vh", md: "100%" }, + height: "100%", overflow: "hidden", }} > @@ -839,19 +847,45 @@ const CorpPricesTab: React.FC = ({ marketData }) => { flexShrink: 0, }} > - + YOUR MATERIALS - + {isCompact && ( + + )} + + + + + } @@ -980,6 +1014,31 @@ const CorpPricesTab: React.FC = ({ marketData }) => { + setShowMaterials(false)} + sx={{ zIndex: 9999 }} + slotProps={{ + paper: { + sx: { + height: "100%", + backgroundImage: "none", + borderTopLeftRadius: 16, + borderTopRightRadius: 16, + }, + }, + }} + > + {React.cloneElement(materialSelection, { + sx: { + ...materialSelection.props.sx, + display: "flex", + flex: 1, + height: "100%", + }, + })} + - - - AVAILABLE MATERIALS - - - - {isMobile && ( - - - - )} - - + setShowImport(true)} + onClose={onCloseMobile} + /> )} - + {/*