From c949f0f486f1a4498c0dd382153c86123191b0a2 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 24 Jun 2023 21:34:45 +0000 Subject: [PATCH 1/3] chore(release): 1.2.1-beta.1 [skip ci] * remote tab scroll and space fill ([98d9400](https://github.com/TouK/petasos/commit/98d940085c4257f04896316bbdfceda920587791)) --- CHANGELOG.md | 6 + package-lock.json | 4 +- package.json | 2 +- src/components/navigationBar.tsx | 3 +- src/components/topicDialog.tsx | 219 +++++++++++++------------------ 5 files changed, 102 insertions(+), 132 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cc84a0..433e5e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.2.1-beta.1](https://github.com/TouK/petasos/compare/v1.2.0...v1.2.1-beta.1) (2023-06-24) + +### Bug Fixes + +- remote tab scroll and space fill ([98d9400](https://github.com/TouK/petasos/commit/98d940085c4257f04896316bbdfceda920587791)) + # [1.2.0](https://github.com/TouK/petasos/compare/v1.1.0...v1.2.0) (2023-06-14) ### Bug Fixes diff --git a/package-lock.json b/package-lock.json index c275b8b..b58c003 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "petasos", - "version": "1.2.0", + "version": "1.2.1-beta.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "petasos", - "version": "1.2.0", + "version": "1.2.1-beta.1", "license": "ISC", "dependencies": { "@emotion/react": "11.10.4", diff --git a/package.json b/package.json index 9f2f745..f6396a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "petasos", "description": "", - "version": "1.2.0", + "version": "1.2.1-beta.1", "author": "", "dependencies": { "@emotion/react": "11.10.4", diff --git a/src/components/navigationBar.tsx b/src/components/navigationBar.tsx index fb53b37..0ceca4f 100644 --- a/src/components/navigationBar.tsx +++ b/src/components/navigationBar.tsx @@ -50,12 +50,13 @@ export const NavigationBar = observer(() => { {pathnames.map((value, index) => { const last = index === pathnames.length - 1; const to = `/${pathnames.slice(0, index + 1).join("/")}`; + return last ? ( {nameGetter(to)} ) : ( - + {nameGetter(to)} ); diff --git a/src/components/topicDialog.tsx b/src/components/topicDialog.tsx index a02f2a5..827e79e 100644 --- a/src/components/topicDialog.tsx +++ b/src/components/topicDialog.tsx @@ -1,11 +1,4 @@ -import { - Box, - Button, - FormControl, - FormControlLabel, - FormLabel, - Radio, -} from "@mui/material"; +import { Box, Button, FormControl, FormControlLabel, FormLabel, Radio } from "@mui/material"; import { Field, FormikErrors } from "formik"; import { CheckboxWithLabel, RadioGroup, TextField } from "formik-mui"; import { observer } from "mobx-react-lite"; @@ -21,130 +14,100 @@ import { GroupsFormControl } from "./groupsFormControl"; import { validateTopicForm } from "./validateTopicForm"; export const TopicDialog = observer( - ({ - initialValues, - dialog, - }: { - initialValues: () => TopicFormikValues; - dialog: Dialog<{ topic: Topic }>; - }) => { - const store = useStore(); - const { dialogs, groups, topics } = store; + ({ initialValues, dialog }: { initialValues: () => TopicFormikValues; dialog: Dialog<{ topic: Topic }> }) => { + const store = useStore(); + const { dialogs, groups, topics } = store; - const taskOnSubmit = (values) => Topic.create(values, store); + const taskOnSubmit = (values) => Topic.create(values, store); - const navigate = useNavigate(); + const navigate = useNavigate(); - const onSubmitSuccess = async ({ - group, - topic, - }: TopicFormikValues): Promise => { - await groups.fetchTask(); - await topics.fetchTask(); - const topicName = Topic.joinName(group, topic); - navigate(`/${topicName}`); - }; + const onSubmitSuccess = async ({ group, topic }: TopicFormikValues): Promise => { + await groups.fetchTask(); + await topics.fetchTask(); + const topicName = Topic.joinName(group, topic); + navigate(`${topicName}`); + }; - const basicFields = ( - errors: FormikErrors - ): JSX.Element[] => [ - !groups.areGroupsHidden && ( - - - - ) - } - /> - ), - , - , - , - ]; + const basicFields = (errors: FormikErrors): JSX.Element[] => [ + !groups.areGroupsHidden && ( + + + + ) + } + /> + ), + , + , + , + ]; - const advancedFields = (): JSX.Element[] => [ - - Acknowledgement - - } label="LEADER" /> - } label="ALL" /> - - , - , - , - , - ]; + const advancedFields = (): JSX.Element[] => [ + + Acknowledgement + + } label="LEADER" /> + } label="ALL" /> + + , + , + , + , + ]; - return ( - - advancedFields={advancedFields} - basicFields={basicFields} - dialog={dialog} - dialogTitle={"Add new topic"} - initialValues={initialValues()} - submitButtonText={"Add topic"} - onSubmitSuccess={onSubmitSuccess} - taskOnSubmit={taskOnSubmit} - validateFunc={validateTopicForm} - /> - ); - } + return ( + + advancedFields={advancedFields} + basicFields={basicFields} + dialog={dialog} + dialogTitle={"Add new topic"} + initialValues={initialValues()} + submitButtonText={"Add topic"} + onSubmitSuccess={onSubmitSuccess} + taskOnSubmit={taskOnSubmit} + validateFunc={validateTopicForm} + /> + ); + }, ); From 8168b066f0db98fb814068d768659ece00a4fe7b Mon Sep 17 00:00:00 2001 From: Bohdan Artiukhov Date: Tue, 3 Oct 2023 10:42:34 +0200 Subject: [PATCH 2/3] fix:NU-1086 update navigation --- src/components/deleteSubscriptionDialog.tsx | 2 +- src/components/deleteTopicDialog.tsx | 5 +++-- src/components/navigationBar.tsx | 20 ++++++++++++++------ src/components/subscriptionDialog.tsx | 11 +++++++++-- src/components/topicDialog.tsx | 2 +- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/components/deleteSubscriptionDialog.tsx b/src/components/deleteSubscriptionDialog.tsx index 24f1bf2..f7da91e 100644 --- a/src/components/deleteSubscriptionDialog.tsx +++ b/src/components/deleteSubscriptionDialog.tsx @@ -22,7 +22,7 @@ export const DeleteSubscriptionDialog = observer(() => { confirmText={"Delete subscription"} onSubmitSuccess={async () => { await topic.fetchSubscriptionsTask(); - navigate(`/${topic.name}`); + navigate(topic.name); }} /> ); diff --git a/src/components/deleteTopicDialog.tsx b/src/components/deleteTopicDialog.tsx index 3659c0b..ae6f87e 100644 --- a/src/components/deleteTopicDialog.tsx +++ b/src/components/deleteTopicDialog.tsx @@ -1,11 +1,12 @@ import { observer } from "mobx-react-lite"; import React from "react"; -import { useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; import { useStore } from "../store/storeProvider"; import { ConfirmDialog } from "./confirmDialog"; export const DeleteTopicDialog = observer(() => { const { dialogs, topics } = useStore(); + const { pathname } = useLocation(); const navigate = useNavigate(); const dialog = dialogs.deleteTopicDialog; const { topic } = dialog.params; @@ -22,7 +23,7 @@ export const DeleteTopicDialog = observer(() => { confirmText={"Remove topic"} onSubmitSuccess={async () => { await topics.fetchTask(); - navigate("/"); + navigate(pathname.replace(topic.name, "")); }} /> ); diff --git a/src/components/navigationBar.tsx b/src/components/navigationBar.tsx index 0ceca4f..e2f42b6 100644 --- a/src/components/navigationBar.tsx +++ b/src/components/navigationBar.tsx @@ -28,7 +28,16 @@ export const NavigationBar = observer(() => { const { pathname } = useLocation(); const rootPath = useContext(RootPath); const normalizedPathname = pathname.indexOf(rootPath) === 0 ? pathname.substring(rootPath.length) : pathname; - const pathnames = normalizedPathname.split("/").filter(Boolean); + + let pathnames; + if (pathname.includes("topics")) { + pathnames = normalizedPathname + .replace(/^\/topics[^/]*\//, "/") + .split("/") + .filter(Boolean); + } else { + pathnames = normalizedPathname.split("/").filter(Boolean); + } const homeText = groups.areGroupsHidden ? "Topics list" : "Groups and topics"; @@ -37,7 +46,6 @@ export const NavigationBar = observer(() => { topics.getTopicDisplayName?.(match?.params.topic) || , "/:topic/:subscription": (match) => match?.params.subscription, }); - return ( { {pathnames.map((value, index) => { const last = index === pathnames.length - 1; - const to = `/${pathnames.slice(0, index + 1).join("/")}`; + const to = `${pathnames.slice(0, index + 1).join("/")}`; return last ? ( - {nameGetter(to)} + {nameGetter(`/${to}`)} ) : ( - - {nameGetter(to)} + + {nameGetter(`/${to}`)} ); })} diff --git a/src/components/subscriptionDialog.tsx b/src/components/subscriptionDialog.tsx index 8d43e23..e499b0b 100644 --- a/src/components/subscriptionDialog.tsx +++ b/src/components/subscriptionDialog.tsx @@ -3,7 +3,7 @@ import { Field, FormikErrors } from "formik"; import { CheckboxWithLabel, RadioGroup, TextField } from "formik-mui"; import { observer, useObserver } from "mobx-react-lite"; import React from "react"; -import { useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; import { getSubscriptionData } from "../devData"; import { AdvancedSubscriptionFormikValues, SubscriptionFormikValues } from "../models"; import { Dialog } from "../store/dialog"; @@ -194,6 +194,7 @@ export const AddSubscriptionDialog = observer(() => { export const AddClonedSubscriptionDialog = observer(() => { const { dialogs } = useStore(); const dialog = dialogs.addClonedSubscription; + const { pathname } = useLocation(); const { topic, subscription } = dialog.params; const initialValues = (): SubscriptionFormikValues => @@ -211,7 +212,13 @@ export const AddClonedSubscriptionDialog = observer(() => { sub.assignValuesFromForm(values); await topic.postSubscriptionTask(sub); await topic.fetchSubscriptionsTask(); - navigate(`/${topic.name}/${values.name}`); + const path = getFirstPartOfPath(pathname); + navigate(`${path}/${topic.name}/${values.name}`); + }; + + const getFirstPartOfPath = (path: string) => { + const parts = path.split("/"); + return parts.slice(0, 2).join("/"); }; return ( diff --git a/src/components/topicDialog.tsx b/src/components/topicDialog.tsx index 827e79e..2549d1e 100644 --- a/src/components/topicDialog.tsx +++ b/src/components/topicDialog.tsx @@ -26,7 +26,7 @@ export const TopicDialog = observer( await groups.fetchTask(); await topics.fetchTask(); const topicName = Topic.joinName(group, topic); - navigate(`${topicName}`); + navigate(topicName); }; const basicFields = (errors: FormikErrors): JSX.Element[] => [ From 77743fd05d41b62fc3804cf5e9b54aa49d56a63a Mon Sep 17 00:00:00 2001 From: Bohdan Artiukhov Date: Tue, 3 Oct 2023 15:48:31 +0200 Subject: [PATCH 3/3] fix:NU-1086 change validation pathnames --- src/components/navigationBar.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/components/navigationBar.tsx b/src/components/navigationBar.tsx index e2f42b6..58b7554 100644 --- a/src/components/navigationBar.tsx +++ b/src/components/navigationBar.tsx @@ -29,15 +29,12 @@ export const NavigationBar = observer(() => { const rootPath = useContext(RootPath); const normalizedPathname = pathname.indexOf(rootPath) === 0 ? pathname.substring(rootPath.length) : pathname; - let pathnames; - if (pathname.includes("topics")) { - pathnames = normalizedPathname - .replace(/^\/topics[^/]*\//, "/") - .split("/") - .filter(Boolean); - } else { - pathnames = normalizedPathname.split("/").filter(Boolean); - } + const pathnames = pathname.includes("topics") + ? normalizedPathname + .replace(/^\/topics[^/]*\//, "/") + .split("/") + .filter(Boolean) + : normalizedPathname.split("/").filter(Boolean); const homeText = groups.areGroupsHidden ? "Topics list" : "Groups and topics";