Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/boxwise/boxtribute into g…
Browse files Browse the repository at this point in the history
…raphql-with-gql.tada
  • Loading branch information
fhenrich33 committed Dec 3, 2024
2 parents 5398fcd c450a58 commit 08b642f
Show file tree
Hide file tree
Showing 15 changed files with 8,988 additions and 4,799 deletions.
2 changes: 1 addition & 1 deletion back/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 9,6 @@ pytest-clarity==1.0.1
mypy==1.13.0
types-Flask-Cors==5.0.0.20240902
types-peewee==3.17.8.20241117
types-setuptools==75.5.0.20241122
types-setuptools==75.6.0.20241126
types-PyMySQL==1.1.0.20241103
flake8-bugbear==24.10.31
4 changes: 2 additions & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@
"@fortawesome/fontawesome-svg-core": "6.7.1",
"@fortawesome/free-solid-svg-icons": "^6.7.1",
"@fortawesome/react-fontawesome": "^0.2.2",
"@sentry/react": "^8.41.0",
"@sentry/react": "^8.42.0",
"@zxing/browser": "^0.1.5",
"@zxing/library": "^0.21.3",
"chakra-react-select": "4.9.2",
Expand All @@ -24,7 24,7 @@
"devDependencies": {
"@chakra-ui/storybook-addon": "^5.2.5",
"@graphql-codegen/typescript": "^4.1.1",
"@sentry/types": "^8.41.0",
"@sentry/types": "^8.42.0",
"@storybook/addon-actions": "^8.4.6",
"@storybook/addon-essentials": "^8.4.6",
"@storybook/addon-interactions": "^8.4.6",
Expand Down
1 change: 0 additions & 1 deletion front/src/components/HeaderMenu/BaseSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 20,6 @@ import { useBaseIdParam } from "hooks/useBaseIdParam";
function BaseSwitcher({ isOpen, onClose }: { isOpen: boolean; onClose: () => void }) {
const navigate = useNavigate();
const { pathname } = useLocation();
console.log(useLocation());
const { baseId: currentBaseId } = useBaseIdParam();
const { globalPreferences } = useContext(GlobalPreferencesContext);
const currentOrganisationBases = globalPreferences.availableBases?.filter(
Expand Down
15 changes: 5 additions & 10 deletions front/src/components/HeaderMenu/MenuDesktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,6 @@ import {
AccordionButton,
AccordionPanel,
Flex,
Box,
useDisclosure,
useMediaQuery,
} from "@chakra-ui/react";
Expand Down Expand Up @@ -35,21 34,17 @@ function MenuDesktop({ menuItemsGroups }: IHeaderMenuProps) {
return (
<>
<BaseSwitcher isOpen={isOpen} onClose={onClose} />
<Box h={20} w={256} />
<Flex
id="desktop-nav"
as="nav"
flexDirection="column"
h={"100%"}
w={256}
minW={256}
gap={16}
pt={6}
position={"fixed"}
left={0}
top={0}
zIndex={3}
boxShadow="base"
bg={"white"}
bg="white"
pos="sticky"
top="0"
>
<BoxtributeLogo alignSelf="center" w={156} backgroundSize="contain" />
<Accordion allowMultiple={allowMultipleAccordionsOpen} defaultIndex={expandedMenuIndex()}>
Expand Down Expand Up @@ -86,7 81,7 @@ function MenuDesktop({ menuItemsGroups }: IHeaderMenuProps) {
cursor: currentOrganisationHasMoreThanOneBaseAvailable ? "pointer" : "inherit",
}}
>
<MenuIcon icon="Base" /> You are in: {baseName}
<MenuIcon icon={"Base" as Icon} /> You are in: {baseName}
</AccordionButton>
</AccordionItem>
<AccordionItem>
Expand Down
20 changes: 15 additions & 5 deletions front/src/components/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 15,23 @@ import { DESKTOP_OR_TABLET_SCREEN_MEDIA_QUERY } from "./HeaderMenu/consts";
function Layout() {
const [isLargeScreen] = useMediaQuery(DESKTOP_OR_TABLET_SCREEN_MEDIA_QUERY);

if (isLargeScreen)
return (
<Container m="inherit" p="inherit" maxWidth="inherit">
<Flex direction="row" height="100vh" overflowY="scroll">
<HeaderMenuContainer />
<Box flex={1} mt={8} mx={4}>
<Outlet />
</Box>
</Flex>
</Container>
);

return (
<Container maxWidth="container.xl">
<Flex direction={isLargeScreen ? "row" : "column"} height="100vh">
<Box flex="none">
<HeaderMenuContainer />
</Box>
<Box flex={1} minHeight="0" mt={isLargeScreen ? 8 : "inherit"}>
<Flex direction="column" height="100vh">
<HeaderMenuContainer />
<Box flex={1} minHeight="0">
<Outlet />
</Box>
</Flex>
Expand Down
6 changes: 4 additions & 2 deletions front/src/components/QrReader/components/QrReaderMultiBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 17,9 @@ import {
import { Select } from "chakra-react-select";
import { IDropdownOption } from "components/Form/SelectField";
import { ShipmentIcon } from "components/Icon/Transfer/ShipmentIcon";
import { FaWarehouse, FaTags } from "react-icons/fa";
import { FaTags } from "react-icons/fa";
import { FaCartFlatbed } from "react-icons/fa6";

import { useReactiveVar } from "@apollo/client";
import { qrReaderOverlayVar } from "queries/cache";
import { colorIsBright } from "utils/helpers";
Expand Down Expand Up @@ -134,7 136,7 @@ function QrReaderMultiBox({
<Stack direction="column">
<Radio value="moveBox" data-testid="MoveBox">
<Stack direction="row" alignItems="center" spacing={2}>
<Icon as={FaWarehouse} boxSize={6} />
<Icon as={FaCartFlatbed} boxSize={6} />
<Text>Move to Location</Text>
</Stack>
</Radio>
Expand Down
2 changes: 1 addition & 1 deletion front/src/hooks/useErrorHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 18,7 @@ export const useErrorHandling = () => {
toast({
duration: 5000,
isClosable: true,
position: "bottom",
position: "top-right",
variant: "subtle",
status: "error",
title: "Error",
Expand Down
14 changes: 4 additions & 10 deletions front/src/hooks/useNotification.ts
Original file line number Diff line number Diff line change
@@ -1,29 1,23 @@
import { ToastPosition, useMediaQuery, useToast } from "@chakra-ui/react";
import { useState, useEffect, useCallback } from "react";
import { useToast } from "@chakra-ui/react";
import { useCallback } from "react";
import { INotificationProps } from "./hooks";

export const useNotification = (toastName?: string) => {
const toast = useToast();
const [isSmallScreen] = useMediaQuery("(max-width: 1070px)");
const [position, setPosition] = useState<ToastPosition>("bottom");

useEffect(() => {
setPosition(isSmallScreen ? "bottom" : "top");
}, [isSmallScreen]);

const createToast = useCallback(
({ message, type, ...props }: INotificationProps) =>
toast({
id: toastName,
duration: 5000,
isClosable: true,
position,
position: "top-right",
variant: "subtle",
status: type,
description: message,
...props,
}),
[toast, position, toastName],
[toast, toastName],
);

return !toastName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 45,7 @@ const CreateDistributionSpotView = () => {
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});

const onSubmitNewDitroSpot = (distroSpot: CreateDistributionSpotFormData) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 180,15 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
title: `Successfully updated packing list entry`,
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
});
Expand All @@ -211,13 213,15 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
title: "Successfully removed entry",
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
})
Expand All @@ -232,6 236,7 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
});
},
Expand Down Expand Up @@ -260,13 265,15 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
title: "Successfully removed entries. ",
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
})
Expand All @@ -281,6 288,7 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
});
},
Expand Down Expand Up @@ -328,13 336,15 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
title: "Successfully updated the Products for the Packing List.",
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
})
Expand All @@ -349,6 359,7 @@ const DistroEventDetailsForPlanningStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 85,7 @@ const PackingListEntry = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
Expand All @@ -93,6 94,7 @@ const PackingListEntry = ({
status: "success",
duration: 2000,
isClosable: true,
position: "top-right",
});
}
})
Expand All @@ -104,6 106,7 @@ const PackingListEntry = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
});
},
Expand Down Expand Up @@ -144,6 147,7 @@ const PackingListEntry = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
} else {
toast({
Expand All @@ -152,6 156,7 @@ const PackingListEntry = ({
status: "success",
duration: 2000,
isClosable: true,
position: "top-right",
});
}
})
Expand All @@ -163,6 168,7 @@ const PackingListEntry = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 64,7 @@ const DistroEventDetailsForPackingStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
};

Expand Down Expand Up @@ -96,6 97,7 @@ const DistroEventDetailsForPackingStateContainer = ({
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
})
Expand All @@ -117,6 119,7 @@ const DistroEventDetailsForPackingStateContainer = ({
status: "error",
duration: 2000,
isClosable: true,
position: "top-right",
});
};

Expand Down Expand Up @@ -162,6 165,7 @@ const DistroEventDetailsForPackingStateContainer = ({
status: "success",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 100,7 @@ const PackingScanBoxOrFindByLabelOverlay = ({
status: "error",
isClosable: true,
duration: 2000,
position: "top-right",
});
}
},
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 57,28 @@
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@vitejs/plugin-react-swc": "^3.7.2",
"@vitest/coverage-v8": "^2.1.6",
"@vitest/ui": "^2.1.6",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-react-refresh": "^0.4.16",
"eslint-plugin-testing-library": "^7.0.0",
"jsdom": "25.0.1",
"lint-staged": "^15.2.8",
"prettier": "^3.4.1",
"tsc-files": "^1.1.4",
"typescript": "^5.7.2",
"vite": "^5.4.11",
"vite": "^6.0.2",
"vite-tsconfig-paths": "^5.1.3",
"vitest": "^2.1.6"
"vitest": "^2.1.8"
},
"lint-staged": {
"!(**/generated/*).{js,ts,tsx}": "pnpm lint:fix",
Expand Down
Loading

0 comments on commit 08b642f

Please sign in to comment.