From a62723722285648a5d2a0650c02f323f9f5cdc97 Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sat, 21 Nov 2026 18:26:23 +0000 Subject: [PATCH 1/7] Market filter tweaks: filter buttons ordering + Hortus default --- .../vendors/components/locationfilter.tsx | 111 ++++++++++-------- src/cosm/vendors/vendorlist.tsx | 32 ++--- 2 files changed, 79 insertions(+), 64 deletions(-) diff --git a/src/cosm/vendors/components/locationfilter.tsx b/src/cosm/vendors/components/locationfilter.tsx index fa8c6f6..95e4ac4 100644 --- a/src/cosm/vendors/components/locationfilter.tsx +++ b/src/cosm/vendors/components/locationfilter.tsx @@ -1,14 +1,16 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useMemo, useState } from "react"; import { alpha, Autocomplete, Box, + createFilterOptions, TextField, Typography, useTheme, type SxProps, type Theme, } from "@mui/material"; +import { RotateCcw } from "lucide-react"; import { formatLocation as formatLocationName, useLocationFormatVersion, @@ -35,6 +37,9 @@ const formatLocation = (option: LocationOption) => option.id === NOT_HORTUS_LOCATION ? option.name || option.id : formatLocationName(option.name, option.id); +const filterOptions = createFilterOptions({ + stringify: formatLocation, +}); const LocationFilter = ({ locations, @@ -51,68 +56,78 @@ const LocationFilter = ({ }) => { const theme = useTheme(); const locationFormatVersion = useLocationFormatVersion(); - const [inputValue, setInputValue] = useState(""); + const [inputValue, setInputValue] = useState(null); + const [open, setOpen] = useState(false); const options = useMemo(() => { - const sortedLocations = [...locations].sort((a, b) => { - if (a.id === HORTUS_LOCATION_CODE) return -1; - if (b.id === HORTUS_LOCATION_CODE) return 1; - return formatLocation(a).localeCompare(formatLocation(b)); - }); - const hortus = sortedLocations.find( + const hortus = locations.find( (location) => location.id === HORTUS_LOCATION_CODE, ); + const otherLocations = locations + .filter((location) => location.id !== HORTUS_LOCATION_CODE) + .sort((a, b) => formatLocation(a).localeCompare(formatLocation(b))); return hortus - ? [ - ALL_LOCATIONS, - hortus, - NOT_HORTUS, - ...sortedLocations.filter((location) => location !== hortus), - ] - : [ALL_LOCATIONS, ...sortedLocations]; + ? [hortus, NOT_HORTUS, ALL_LOCATIONS, ...otherLocations] + : [ALL_LOCATIONS, ...otherLocations]; }, [locationFormatVersion, locations]); - - useEffect(() => { - setInputValue( - value - ? formatLocation( - options.find((option) => option.id === value) || { id: value }, - ) - : "", - ); - }, [options, value]); + const selectedOption = + value === null + ? ALL_LOCATIONS + : options.find((option) => option.id === value) || null; + const selectedLabel = selectedOption + ? formatLocation(selectedOption) + : value || ""; + const canClear = value !== HORTUS_LOCATION_CODE; return ( size="small" + clearIcon={} options={options} - value={ - value ? options.find((option) => option.id === value) || null : null + open={open} + onOpen={() => setOpen(true)} + onClose={() => setOpen(false)} + filterOptions={(locations, state) => + state.inputValue === selectedLabel + ? locations + : filterOptions(locations, state) } - onChange={(_event, option) => { + value={selectedOption} + onChange={(event, option) => { + // MUI also reports erased text as a clear change; only the button resets. + if (!option && event.type !== "click") return; + if (!option) setOpen(false); const nextValue = - option?.id === ALL_LOCATIONS.id ? null : option?.id || null; - setInputValue(nextValue ? formatLocation(option!) : ""); + option?.id === ALL_LOCATIONS.id + ? null + : option?.id || HORTUS_LOCATION_CODE; + setInputValue(null); onChange(nextValue); }} - inputValue={inputValue} + inputValue={inputValue ?? selectedLabel} onInputChange={(_event, nextInputValue, reason) => { - if (reason === "input") setInputValue(nextInputValue); + if (reason !== "input") return; + setInputValue(nextInputValue); }} + onBlur={() => setInputValue(null)} getOptionLabel={formatLocation} isOptionEqualToValue={(option, selected) => option.id === selected.id} - renderOption={(props, option) => ( - - {formatLocation(option)} - - )} + renderOption={(props, option) => { + const { key, ...optionProps } = props; + return ( + + {formatLocation(option)} + + ); + }} slotProps={{ paper: { sx: { @@ -125,8 +140,8 @@ const LocationFilter = ({ sx={[ { "& .MuiAutocomplete-clearIndicator": { - visibility: value ? "visible" : "hidden", - opacity: value ? 1 : 0, + visibility: canClear ? "visible" : "hidden", + opacity: canClear ? 1 : 0, }, "& .MuiOutlinedInput-root": { height: 40, @@ -146,7 +161,7 @@ const LocationFilter = ({ ...(Array.isArray(sx) ? sx : sx ? [sx] : []), ]} renderInput={(params) => ( - + )} /> ); diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index 952dc81..fb99678 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -1597,20 +1597,20 @@ const VendorsList = ({ }} > - Grid + Table - Table + Grid @@ -1649,16 +1649,6 @@ const VendorsList = ({ }, }} > - - - All - - + + + All + + From 266f234b32e8e3daa7bd21e246d9e65172b46cc5 Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sat, 21 Nov 2026 18:34:07 +0000 Subject: [PATCH 2/7] Location icon component, red for non-HRT --- src/cosm/vendors/components/locationicon.tsx | 20 ++++++++++ src/cosm/vendors/shoppinglistmodal.tsx | 41 +++----------------- src/cosm/vendors/vendorlist.tsx | 27 ++----------- 3 files changed, 29 insertions(+), 59 deletions(-) create mode 100644 src/cosm/vendors/components/locationicon.tsx diff --git a/src/cosm/vendors/components/locationicon.tsx b/src/cosm/vendors/components/locationicon.tsx new file mode 100644 index 0000000..5d5fcf6 --- /dev/null +++ b/src/cosm/vendors/components/locationicon.tsx @@ -0,0 +1,20 @@ +import { useTheme } from "@mui/material"; +import { Globe, Warehouse } from "lucide-react"; + +const LocationIcon = ({ locationCode }: { locationCode?: string }) => { + const theme = useTheme(); + + return locationCode === "HRT" ? ( + + ) : ( + + ); +}; + +export default LocationIcon; diff --git a/src/cosm/vendors/shoppinglistmodal.tsx b/src/cosm/vendors/shoppinglistmodal.tsx index 2d0ac7a..da747bc 100644 --- a/src/cosm/vendors/shoppinglistmodal.tsx +++ b/src/cosm/vendors/shoppinglistmodal.tsx @@ -35,8 +35,6 @@ import { ArrowUp, ArrowDown, Store, - Warehouse, - Globe, FileUp, } from "lucide-react"; import { ContentCopy } from "@mui/icons-material"; @@ -58,6 +56,7 @@ import LocationFilter, { import InlineConfirmButton from "../components/inlineconfirmbutton"; import { Modal } from "./modal"; import VendorLastActiveIndicator from "./components/vendorlastactiveindicator"; +import LocationIcon from "./components/locationicon"; import { useGlobalData } from "../../context/globaldatacontext"; import { formatLocation as formatLocationLabel, @@ -388,17 +387,7 @@ const VendorPrioritySelector: React.FC<{ {location ? ( <> - {location.location_code === "HRT" ? ( - - ) : ( - - )}{" "} + {" "} {formatLocationLabel( location.location_name || location.location_code || @@ -730,17 +719,9 @@ const CompactListItem: React.FC<{ key={location.label} sx={{ whiteSpace: "nowrap" }} > - {location.isHortus ? ( - - ) : ( - - )}{" "} + {" "} {location.label} , " ", @@ -1059,17 +1040,7 @@ const OrderSummaryPanel: React.FC<{ mb: 0.75, }} > - {location?.location_code === "HRT" ? ( - - ) : ( - - )} + {formatLocationLabel(locationName, locationCode)} diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index fb99678..c39c1c9 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -29,8 +29,6 @@ import { import { Search, MapPin, - Warehouse, - Globe, Minus, Square, SquareCheck, @@ -52,6 +50,7 @@ import { } from "./utils/formatlocation"; import { pickPrice } from "./utils/pickprice"; import VendorLastActiveIndicator from "./components/vendorlastactiveindicator"; +import LocationIcon from "./components/locationicon"; import LocationFilter, { ALL_LOCATIONS_ID, HORTUS_LOCATION_CODE, @@ -634,17 +633,7 @@ const VendorCard = React.memo( gap: 0.5, }} > - {l.location_code === "HRT" ? ( - - ) : ( - - )} + ( - {row.locCode === "HRT" ? ( - - ) : ( - - )} + {row.locCode === HORTUS_LOCATION_CODE From 2ef2e4d406ec5b9a219f21bafeec9f5bd051539e Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sun, 22 Nov 2026 10:51:59 +0000 Subject: [PATCH 3/7] Toggle components and consistent styles --- src/components/common/customtogglebutton.tsx | 37 ++++++++ src/components/common/customtogglegroup.tsx | 33 +++++++ src/cosm/vendors/vendorlist.tsx | 91 ++------------------ 3 files changed, 78 insertions(+), 83 deletions(-) create mode 100644 src/components/common/customtogglebutton.tsx create mode 100644 src/components/common/customtogglegroup.tsx diff --git a/src/components/common/customtogglebutton.tsx b/src/components/common/customtogglebutton.tsx new file mode 100644 index 0000000..0735636 --- /dev/null +++ b/src/components/common/customtogglebutton.tsx @@ -0,0 +1,37 @@ +import { alpha, ToggleButton, type ToggleButtonProps } from "@mui/material"; +import type { SxProps, Theme } from "@mui/material/styles"; +import { Square, SquareCheckBig } from "lucide-react"; + +const customToggleButtonSx: SxProps = (theme) => ({ + height: 40, + px: 2, + textTransform: "none", + gap: 0.5, + whiteSpace: "nowrap", + backgroundColor: "transparent", + color: theme.palette.common.white, + "&.Mui-selected": { + backgroundColor: alpha(theme.palette.primary.main, 0.5), + }, + "&:hover": { + backgroundColor: alpha(theme.palette.common.white, 0.25), + }, +}); + +const CustomToggleButton = ({ + children, + selected = false, + sx, + ...props +}: ToggleButtonProps) => ( + + {selected ? ( + + ) : ( + + )} + {children} + +); + +export default CustomToggleButton; diff --git a/src/components/common/customtogglegroup.tsx b/src/components/common/customtogglegroup.tsx new file mode 100644 index 0000000..1578a54 --- /dev/null +++ b/src/components/common/customtogglegroup.tsx @@ -0,0 +1,33 @@ +import { + alpha, + ToggleButtonGroup, + type ToggleButtonGroupProps, +} from "@mui/material"; +import type { SxProps, Theme } from "@mui/material/styles"; + +const customToggleGroupSx: SxProps = (theme) => ({ + height: 40, + borderRadius: "12px", + "& .MuiToggleButtonGroup-grouped": { + px: 2, + textTransform: "none", + backgroundColor: "transparent", + color: theme.palette.common.white, + "&.Mui-selected": { + backgroundColor: alpha(theme.palette.primary.main, 0.5), + }, + "&:hover": { + backgroundColor: alpha(theme.palette.common.white, 0.25), + }, + }, +}); + +const CustomToggleGroup = ({ + size = "small", + sx, + ...props +}: ToggleButtonGroupProps) => ( + +); + +export default CustomToggleGroup; diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index c39c1c9..e4764f3 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -6,6 +6,8 @@ import React, { useCallback, } from "react"; import { API_BASE_URL } from "../../config/api"; +import CustomToggleGroup from "../../components/common/customtogglegroup"; +import CustomToggleButton from "../../components/common/customtogglebutton"; import { Masonry } from "@mui/lab"; import { DataGrid, type GridColDef } from "@mui/x-data-grid"; import { @@ -15,7 +17,6 @@ import { TextField, InputAdornment, ToggleButton, - ToggleButtonGroup, Card, CardContent, Divider, @@ -30,8 +31,6 @@ import { Search, MapPin, Minus, - Square, - SquareCheck, Target, X, } from "lucide-react"; @@ -1541,7 +1540,7 @@ const VendorsList = ({ display: "flex", }} > - { @@ -1549,52 +1548,24 @@ const VendorsList = ({ handleViewModeChange(newValue); } }} - size="small" aria-label="Vendor view mode" - sx={{ - height: 40, - borderRadius: "12px", - "& .MuiToggleButtonGroup-grouped": { - "&:hover": { - background: alpha(theme.palette.primary.main, 0.5), - }, - "&.Mui-selected": { - background: alpha( - theme.palette.background.default, - 0.8, - ), - color: theme.palette.primary.light, - pointerEvents: "none", - "&:hover": { - background: alpha( - theme.palette.background.default, - 0.9, - ), - }, - }, - }, - }} > Table Grid - + - { if (newValue) setOrderTypeFilter(newValue); }} - size="small" aria-label="Order type filter" - sx={{ - height: 40, - borderRadius: "12px", - "& .MuiToggleButtonGroup-grouped": { - "&:hover": { - background: alpha(theme.palette.primary.main, 0.5), - }, - "&.Mui-selected": { - background: alpha( - theme.palette.background.default, - 0.8, - ), - color: theme.palette.primary.light, - "&:hover": { - background: alpha( - theme.palette.background.default, - 1, - ), - }, - }, - }, - }} > Ask @@ -1641,9 +1587,7 @@ const VendorsList = ({ Bid @@ -1651,14 +1595,12 @@ const VendorsList = ({ All - + - setHideUnavailable((prev) => !prev)} aria-label="Hide Unavailable" - sx={{ - height: 40, - px: 1.5, - textTransform: "none", - gap: 0.5, - whiteSpace: "nowrap", - "&.Mui-selected": { - color: theme.palette.primary.light, - backgroundColor: "transparent", - "&:hover": { backgroundColor: "transparent" }, - }, - }} > - {hideUnavailable ? ( - - ) : ( - - )} Hide Unavailable - + From bcc128f2a59f9c72f1c528a1594064cf8dca137a Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sun, 22 Nov 2026 16:11:24 +0000 Subject: [PATCH 4/7] Toggle button custom colors --- src/components/common/customtogglebutton.tsx | 59 ++++++++++----- src/components/common/customtogglegroup.tsx | 14 ++-- src/cosm/vendors/vendorlist.tsx | 80 ++++++++++---------- 3 files changed, 87 insertions(+), 66 deletions(-) diff --git a/src/components/common/customtogglebutton.tsx b/src/components/common/customtogglebutton.tsx index 0735636..4990cee 100644 --- a/src/components/common/customtogglebutton.tsx +++ b/src/components/common/customtogglebutton.tsx @@ -1,37 +1,60 @@ -import { alpha, ToggleButton, type ToggleButtonProps } from "@mui/material"; +import { alpha, ToggleButton, Tooltip, type ToggleButtonProps } from "@mui/material"; import type { SxProps, Theme } from "@mui/material/styles"; import { Square, SquareCheckBig } from "lucide-react"; +import type { ReactNode } from "react"; -const customToggleButtonSx: SxProps = (theme) => ({ +type CustomToggleButtonProps = ToggleButtonProps & { + activeColor?: string; + showIcon?: boolean; + tooltip?: ReactNode; +}; + +const customToggleButtonSx = (activeColor?: string): SxProps => (theme) => ({ height: 40, px: 2, textTransform: "none", gap: 0.5, whiteSpace: "nowrap", backgroundColor: "transparent", - color: theme.palette.common.white, - "&.Mui-selected": { - backgroundColor: alpha(theme.palette.primary.main, 0.5), + "& [data-toggle-icon='checked']": { + display: "none", + }, + "&.Mui-selected [data-toggle-icon='checked']": { + display: "inline-flex", }, - "&:hover": { - backgroundColor: alpha(theme.palette.common.white, 0.25), + "&.Mui-selected [data-toggle-icon='unchecked']": { + display: "none", + }, + "&&.Mui-selected": { + backgroundColor: alpha(activeColor ?? theme.palette.primary.main, 0.5), }, }); const CustomToggleButton = ({ children, - selected = false, + activeColor, + showIcon = true, sx, + tooltip, ...props -}: ToggleButtonProps) => ( - - {selected ? ( - - ) : ( - - )} - {children} - -); +}: CustomToggleButtonProps) => { + const button = ( + + {showIcon && ( + <> + + + + )} + {children} + + ); + + return tooltip ? {button} : button; +}; export default CustomToggleButton; diff --git a/src/components/common/customtogglegroup.tsx b/src/components/common/customtogglegroup.tsx index 1578a54..6e22ccc 100644 --- a/src/components/common/customtogglegroup.tsx +++ b/src/components/common/customtogglegroup.tsx @@ -11,14 +11,6 @@ const customToggleGroupSx: SxProps = (theme) => ({ "& .MuiToggleButtonGroup-grouped": { px: 2, textTransform: "none", - backgroundColor: "transparent", - color: theme.palette.common.white, - "&.Mui-selected": { - backgroundColor: alpha(theme.palette.primary.main, 0.5), - }, - "&:hover": { - backgroundColor: alpha(theme.palette.common.white, 0.25), - }, }, }); @@ -27,7 +19,11 @@ const CustomToggleGroup = ({ sx, ...props }: ToggleButtonGroupProps) => ( - + ); export default CustomToggleGroup; diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index e4764f3..c922416 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -16,7 +16,6 @@ import { Chip, TextField, InputAdornment, - ToggleButton, Card, CardContent, Divider, @@ -1550,18 +1549,20 @@ const VendorsList = ({ }} aria-label="Vendor view mode" > - Table - - + Grid - + @@ -1576,30 +1577,32 @@ const VendorsList = ({ }} aria-label="Order type filter" > - - - Ask - - - - - Bid - - - - - All - - + + Ask + + + Bid + + + All + @@ -1707,16 +1710,15 @@ const VendorsList = ({ /> - - setHideUnavailable((prev) => !prev)} - aria-label="Hide Unavailable" - > - Hide Unavailable - - + setHideUnavailable((prev) => !prev)} + tooltip="Hide materials if vendor has/wants 0" + aria-label="Hide Unavailable" + > + Hide Unavailable + From f4d7d5c7df926b99ba635fa76eed2a713cf0829e Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sun, 22 Nov 2026 16:59:08 +0000 Subject: [PATCH 5/7] Side color hints --- src/cosm/vendors/vendorlist.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index c922416..4f183e2 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -526,6 +526,12 @@ const VendorCard = React.memo( className={isUnavailable ? "unavailable-order" : undefined} sx={{ p: 0, + backgroundColor: alpha( + isBuying + ? theme.palette.info.light + : theme.palette.warning.light, + 0.06, + ), borderBottom: index === sortedList.length - 1 ? "none" @@ -535,10 +541,6 @@ const VendorCard = React.memo( display: "flex", flexDirection: "column", gap: 0.5, - cursor: "default", - "&:hover": { - backgroundColor: alpha(theme.palette.primary.main, 0.2), - }, }} > {/* Main Row: Ticker, Price */} @@ -1375,18 +1377,23 @@ const VendorsList = ({ disableRowSelectionOnClick localeText={{ noRowsLabel: "No results" }} getRowClassName={({ row }) => - row.quantity === 0 ? "unavailable-order" : "" + `${row.orderType === "sell" ? "ask-order" : "bid-order"}${ + row.quantity === 0 ? " unavailable-order" : "" + }` } sx={{ border: "none", "& .MuiDataGrid-row": { borderBottom: `1px solid ${alpha(theme.palette.divider, 0.05)}`, - "&:hover": { - backgroundColor: alpha(theme.palette.primary.main, 0.2), - }, display: "flex", alignItems: "center", }, + "& .MuiDataGrid-row.ask-order": { + backgroundColor: alpha(theme.palette.warning.light, 0.05), + }, + "& .MuiDataGrid-row.bid-order": { + backgroundColor: alpha(theme.palette.info.light, 0.05), + }, "& .MuiDataGrid-cell": { borderBottom: "none", display: "flex", From b09f96c764ed550e2ad1ed1d5217aa015e6726ae Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sun, 22 Nov 2026 16:59:59 +0000 Subject: [PATCH 6/7] en-US spellings --- src/cosm/vendors/vendorlist.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index 4f183e2..ce7d0b0 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -276,15 +276,15 @@ const PriceComparisonBadge = ({ const ChipSmall = ({ text, - colour, + color, tooltip, }: { text: string; - colour?: string; + color?: string; tooltip?: React.ReactNode; }) => { const theme = useTheme(); - const badgeColour = colour ?? theme.palette.primary.light; + const badgeColor = color ?? theme.palette.primary.light; const badge = ( { return ( ); @@ -343,7 +343,7 @@ const ChipBid = () => { return ( ); From e9166ded8b6e4a4ec3eacc4611f1319c4d68d467 Mon Sep 17 00:00:00 2001 From: Lumivient Date: Sun, 22 Nov 2026 17:00:55 +0000 Subject: [PATCH 7/7] fmt --- src/components/common/customtogglebutton.tsx | 49 +++++++++++-------- src/components/common/customtogglegroup.tsx | 6 +-- .../vendors/components/locationfilter.tsx | 5 +- src/cosm/vendors/components/locationicon.tsx | 10 +--- src/cosm/vendors/vendorlist.tsx | 12 ++--- .../corporation/corporationoverview.tsx | 6 +-- 6 files changed, 41 insertions(+), 47 deletions(-) diff --git a/src/components/common/customtogglebutton.tsx b/src/components/common/customtogglebutton.tsx index 4990cee..6c217cf 100644 --- a/src/components/common/customtogglebutton.tsx +++ b/src/components/common/customtogglebutton.tsx @@ -1,4 +1,9 @@ -import { alpha, ToggleButton, Tooltip, type ToggleButtonProps } from "@mui/material"; +import { + alpha, + ToggleButton, + Tooltip, + type ToggleButtonProps, +} from "@mui/material"; import type { SxProps, Theme } from "@mui/material/styles"; import { Square, SquareCheckBig } from "lucide-react"; import type { ReactNode } from "react"; @@ -9,26 +14,28 @@ type CustomToggleButtonProps = ToggleButtonProps & { tooltip?: ReactNode; }; -const customToggleButtonSx = (activeColor?: string): SxProps => (theme) => ({ - height: 40, - px: 2, - textTransform: "none", - gap: 0.5, - whiteSpace: "nowrap", - backgroundColor: "transparent", - "& [data-toggle-icon='checked']": { - display: "none", - }, - "&.Mui-selected [data-toggle-icon='checked']": { - display: "inline-flex", - }, - "&.Mui-selected [data-toggle-icon='unchecked']": { - display: "none", - }, - "&&.Mui-selected": { - backgroundColor: alpha(activeColor ?? theme.palette.primary.main, 0.5), - }, -}); +const customToggleButtonSx = + (activeColor?: string): SxProps => + (theme) => ({ + height: 40, + px: 2, + textTransform: "none", + gap: 0.5, + whiteSpace: "nowrap", + backgroundColor: "transparent", + "& [data-toggle-icon='checked']": { + display: "none", + }, + "&.Mui-selected [data-toggle-icon='checked']": { + display: "inline-flex", + }, + "&.Mui-selected [data-toggle-icon='unchecked']": { + display: "none", + }, + "&&.Mui-selected": { + backgroundColor: alpha(activeColor ?? theme.palette.primary.main, 0.5), + }, + }); const CustomToggleButton = ({ children, diff --git a/src/components/common/customtogglegroup.tsx b/src/components/common/customtogglegroup.tsx index 6e22ccc..eff42a7 100644 --- a/src/components/common/customtogglegroup.tsx +++ b/src/components/common/customtogglegroup.tsx @@ -19,11 +19,7 @@ const CustomToggleGroup = ({ sx, ...props }: ToggleButtonGroupProps) => ( - + ); export default CustomToggleGroup; diff --git a/src/cosm/vendors/components/locationfilter.tsx b/src/cosm/vendors/components/locationfilter.tsx index 95e4ac4..207ca93 100644 --- a/src/cosm/vendors/components/locationfilter.tsx +++ b/src/cosm/vendors/components/locationfilter.tsx @@ -120,7 +120,10 @@ const LocationFilter = ({ {...optionProps} sx={ option.id === ALL_LOCATIONS_ID - ? { borderBottom: `1px solid ${theme.palette.divider}`, mb: 0.5 } + ? { + borderBottom: `1px solid ${theme.palette.divider}`, + mb: 0.5, + } : undefined } > diff --git a/src/cosm/vendors/components/locationicon.tsx b/src/cosm/vendors/components/locationicon.tsx index 5d5fcf6..d86e9bb 100644 --- a/src/cosm/vendors/components/locationicon.tsx +++ b/src/cosm/vendors/components/locationicon.tsx @@ -5,15 +5,9 @@ const LocationIcon = ({ locationCode }: { locationCode?: string }) => { const theme = useTheme(); return locationCode === "HRT" ? ( - + ) : ( - + ); }; diff --git a/src/cosm/vendors/vendorlist.tsx b/src/cosm/vendors/vendorlist.tsx index ce7d0b0..b63244c 100644 --- a/src/cosm/vendors/vendorlist.tsx +++ b/src/cosm/vendors/vendorlist.tsx @@ -26,13 +26,7 @@ import { Button, alpha, } from "@mui/material"; -import { - Search, - MapPin, - Minus, - Target, - X, -} from "lucide-react"; +import { Search, MapPin, Minus, Target, X } from "lucide-react"; import CenterFocusStrongIcon from "@mui/icons-material/CenterFocusStrong"; import VendorCreationModal from "./createvendorstoremodal"; import EditVendorStoreModal from "./editvendorstoremodal"; @@ -633,7 +627,9 @@ const VendorCard = React.memo( gap: 0.5, }} > - + { fuelConfigs.forEach((cfg) => { const activeFuelConsumers: ProducerConsumerItem[] = fuelData - .consumers! - .filter((c) => cfg.getMemberTotal(c) > 0) + .consumers!.filter((c) => cfg.getMemberTotal(c) > 0) .map((c) => ({ player: c.player_name, loc: "Fleet", @@ -368,8 +367,7 @@ export const CorporationOverview: React.FC = () => { 0, ); item.consumptionTotal = nonFleetCons + fleetCons; - item.consumptionAccurate = - (item.consumptionAccurate || 0) + fleetCons; + item.consumptionAccurate = (item.consumptionAccurate || 0) + fleetCons; item.consumption = item.consumptionTotal; item.net = (item.productionTotal || 0) - item.consumptionTotal; });