Skip to content

Commit

Permalink
Merge pull request #114 from MediaComem/navigationAndRecos
Browse files Browse the repository at this point in the history
Clean unused split on params & remove undefined type on general params recos
  • Loading branch information
slecorne authored Dec 6, 2022
2 parents 834a11b + bf9b172 commit 8cde258
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/components/layout/ByteSimHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export default function BytesimeHeader() {
const dispatch = useDispatch();
const navigate = useNavigate();
const { search } = useLocation();
const imageParams = search.split("&")[0];
return (
<Flex
align="center"
Expand Down Expand Up @@ -52,7 +51,6 @@ export default function BytesimeHeader() {
<ButtonWithIconCustom
icon={<></>}
label={"Best practices"}
//subLabel={"Start with ByteSim"}
variant={"ghost"}
iconAfter
onClick={() => navigate(`./best-practices${search}`)}
Expand Down
3 changes: 1 addition & 2 deletions src/components/recommandations/BestPracticesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { BPTooltipContent } from "./Recommandation";
export default function BestPracticesPage() {
const navigate = useNavigate();
const { search } = useLocation();
const imageParams = search.split("&")[0];
return (
<>
<Flex direction="column" p={6}>
Expand All @@ -31,7 +30,7 @@ export default function BestPracticesPage() {
<Button
variant="outline"
colorScheme={"brand"}
onClick={() => navigate(`/figma${imageParams}`)}
onClick={() => navigate(`/figma${search}`)}
alignSelf="flex-start"
size={"sm"}
>
Expand Down
3 changes: 1 addition & 2 deletions src/components/recommandations/ExportButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useLocation, useNavigate } from "react-router-dom";

export default function ExportButton() {
const { search } = useLocation(); // keep image params
const imageParams = search.split("&")[0];
const navigate = useNavigate();
return (
<>
Expand All @@ -12,7 +11,7 @@ export default function ExportButton() {
alignSelf={"center"}
justifySelf={"flex-end"}
onClick={() => {
navigate(`/export${imageParams}`); // keep url params
navigate(`/export${search}`); // keep url params
}}
size="sm"
minWidth="min-content"
Expand Down
4 changes: 3 additions & 1 deletion src/components/recommandations/RecommandationsByZone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export default function RecommandationsByZone({
? "General Parameters"
: zoneRecommandations[0].zoneName}
</Text>
<Text as="span">{" - " + zone?.zoneType ?? "–"}</Text>
<Text as="span" hidden={zone?.zoneType === undefined}>
{" - " + zone?.zoneType ?? "–"}
</Text>
</Text>
<Text fontSize={"xs"}></Text>
{zone?.zoneType ? (
Expand Down
5 changes: 0 additions & 5 deletions src/components/recommandations/ReloadRecoButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { ReactComponent as ResetIcon } from "../../assets/ResetIcon_Active_MouseOver.svg";
import { recommandationsPopulated } from "../../features/recommandations/recommandationsSlice";
import { colorTheme } from "../../theme";
//import { useNavigate } from "react-router-dom";

export default function ReloadRecoButton() {
const dispatch = useDispatch();
Expand All @@ -18,10 +17,6 @@ export default function ReloadRecoButton() {
const reloadSimulation = React.useCallback(() => {
dispatch(recommandationsPopulated([...recosGeneric, ...recos]));
}, [dispatch, recos]);
//const currentDisplayedRecos = useAppSelector((state) => state.recommandations);
/* const newRecos = React.useEffect(() => {
if (recos.length !== currentDisplayedRecos.length) { return true }
}, [recos, currentDisplayedRecos]); */

return (
<>
Expand Down
1 change: 0 additions & 1 deletion src/features/figma/components/FetchedSVG.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ const FetchedSVG = ({
setTimeout(() => {
dispatch(zonesSetTree([newTree]));
dispatch(zonesFilterByElementId(newZones));

const newParams = search
?.replace("&new=true", "")
.replace("new=true", "");
Expand Down

0 comments on commit 8cde258

Please sign in to comment.