Skip to content

Commit

Permalink
fix: minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrba committed Jun 13, 2022
1 parent c14117b commit 0be87c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
11 changes: 7 additions & 4 deletions src/components/common/CollapseButton.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types';
import IconButton from '@material-ui/core/IconButton';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
Expand All @@ -15,15 +15,18 @@ import { BUTTON_TYPES } from '../../config/constants';
const CollapseButton = ({ item, type, onClick }) => {
const { t } = useTranslation();

const editItem = useMutation(MUTATION_KEYS.EDIT_ITEM);
const { mutate: editItem } = useMutation(MUTATION_KEYS.EDIT_ITEM);
const [isCollapsible, setIsCollapsible] = useState(
item?.settings?.isCollapsible,
);

useEffect(() => {
setIsCollapsible(item?.settings?.isCollapsible);
}, [item]);

const handleCollapse = () => {
setIsCollapsible(!isCollapsible);

editItem.mutate({
editItem({
id: item.id,
name: item.name,
settings: {
Expand Down
10 changes: 5 additions & 5 deletions src/components/item/settings/ItemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const ItemSettings = ({ item }) => {
const { t } = useTranslation();
const classes = useStyles();

const editItem = useMutation(MUTATION_KEYS.EDIT_ITEM);
const { mutate: editItem } = useMutation(MUTATION_KEYS.EDIT_ITEM);

const settings = item.get('settings');

const handleChatbox = (event) => {
editItem.mutate({
editItem({
id: item.get('id'),
name: item.get('name'),
settings: {
Expand All @@ -52,7 +52,7 @@ const ItemSettings = ({ item }) => {
};

const handlePinned = (event) => {
editItem.mutate({
editItem({
id: item.get('id'),
name: item.get('name'),
settings: {
Expand All @@ -62,7 +62,7 @@ const ItemSettings = ({ item }) => {
};

const handleCollapse = (event) => {
editItem.mutate({
editItem({
id: item.get('id'),
name: item.get('name'),
settings: {
Expand Down Expand Up @@ -104,7 +104,7 @@ const ItemSettings = ({ item }) => {
color="primary"
/>
);
return <FormControlLabel label={t('Collapsible item')} control={control} />;
return <FormControlLabel label={t('Collapse item')} control={control} />;
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"Pin": "Pin this item",
"Unpin": "Unpin this item",
"Show Chat": "Show Chat",
"Collapsible item": "Set as collapsible item",
"Collapse item": "Set as collapsible item",
"Collapse": "Collapse",
"Uncollapse": "Uncollapse",
"Write the folder decription here…": "Write the folder decription here…",
Expand Down
2 changes: 1 addition & 1 deletion src/langs/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"Pin": "Epingler",
"Unpin": "Détacher",
"Show Chat": "Afficher le chat",
"Collapsible item": "Définir comme élément pliant",
"Collapse item": "Minimiser l'élément",
"Collapse": "Collapse",
"Uncollapse": "Uncollapse",
"Write the folder decription here…": "Entrer la description du dossier ici…",
Expand Down

0 comments on commit 0be87c5

Please sign in to comment.