Merge pull request #192 from mirumee/fix/minor-bugs

Fix minor bugs
This commit is contained in:
Dominik Żegleń 2019-10-02 11:13:40 +02:00 committed by GitHub
commit dda3b0dc7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 17 deletions

View file

@ -1,9 +1,9 @@
import Button from "@material-ui/core/Button";
import Card from "@material-ui/core/Card";
import React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import AppHeader from "@saleor/components/AppHeader";
import SearchBar from "@saleor/components/SearchBar";
import { sectionNames } from "@saleor/intl";
import Container from "../../../components/Container";
@ -23,10 +23,12 @@ export interface AttributeListPageProps
SearchPageProps,
TabPageProps {
attributes: AttributeList_attributes_edges_node[];
onBack: () => void;
}
const AttributeListPage: React.FC<AttributeListPageProps> = ({
onAdd,
onBack,
initialSearch,
onSearchChange,
currentTab,
@ -41,6 +43,9 @@ const AttributeListPage: React.FC<AttributeListPageProps> = ({
return (
<Container>
<AppHeader onBack={onBack}>
<FormattedMessage {...sectionNames.configuration} />
</AppHeader>
<PageHeader title={intl.formatMessage(sectionNames.attributes)}>
<Button onClick={onAdd} color="primary" variant="contained">
<FormattedMessage

View file

@ -15,6 +15,7 @@ import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog";
import SaveFilterTabDialog, {
SaveFilterTabDialogFormData
} from "@saleor/components/SaveFilterTabDialog";
import { configurationMenuUrl } from "@saleor/configuration";
import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier";
import usePaginator, {
@ -165,6 +166,7 @@ const AttributeList: React.FC<AttributeListProps> = ({ params }) => {
isChecked={isSelected}
onAdd={() => navigate(attributeAddUrl())}
onAll={() => navigate(attributeListUrl())}
onBack={() => navigate(configurationMenuUrl)}
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
onRowClick={id => () => navigate(attributeUrl(id))}

View file

@ -222,6 +222,7 @@ export const CategoryList: React.StatelessComponent<CategoryListProps> = ({
})}
variant="delete"
>
<DialogContentText>
<FormattedMessage
defaultMessage="Are you sure you want to delete {counter, plural,
one {this category}
@ -234,6 +235,7 @@ export const CategoryList: React.StatelessComponent<CategoryListProps> = ({
)
}}
/>
</DialogContentText>
<DialogContentText>
<FormattedMessage defaultMessage="Remember this will also delete all products assigned to this category." />
</DialogContentText>

View file

@ -18,6 +18,7 @@ import { SearchCategories_categories_edges_node } from "@saleor/containers/Searc
import { SearchCollections_collections_edges_node } from "@saleor/containers/SearchCollections/types/SearchCollections";
import { SearchPages_pages_edges_node } from "@saleor/containers/SearchPages/types/SearchPages";
import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors";
import useModalDialogOpen from "@saleor/hooks/useModalDialogOpen";
import useStateFromProps from "@saleor/hooks/useStateFromProps";
import { buttonMessages, sectionNames } from "@saleor/intl";
import { UserError } from "@saleor/types";
@ -97,17 +98,20 @@ const MenuItemDialog: React.StatelessComponent<MenuItemDialogProps> = ({
);
const [url, setUrl] = React.useState<string>(undefined);
// Reset input state after closing dialog
useModalDialogOpen(open, {
onClose: () => {
setData(initial || defaultInitial);
setDisplayValue(initialDisplayValue);
setUrl(undefined);
}
});
// Refresh initial display value if changed
React.useEffect(() => setDisplayValue(initialDisplayValue), [
initialDisplayValue
]);
// Reset input state after closing dialog
React.useEffect(() => {
setDisplayValue(initialDisplayValue);
setUrl(undefined);
}, [open]);
const mutationErrors = getErrors(errors);
let options: IMenu = [];

View file

@ -18,7 +18,8 @@ const props: AttributeListPageProps = {
...listActionsProps,
...tabPageProps,
...searchPageProps,
attributes
attributes,
onBack: () => undefined
};
storiesOf("Views / Attributes / Attribute list", module)