diff --git a/cypress/e2e/item/settings/itemSettings.cy.ts b/cypress/e2e/item/settings/itemSettings.cy.ts index ff7ef5bbb..b18141ab0 100644 --- a/cypress/e2e/item/settings/itemSettings.cy.ts +++ b/cypress/e2e/item/settings/itemSettings.cy.ts @@ -398,14 +398,11 @@ describe('Item Settings', () => { cy.visit(buildItemSettingsPath(itemId)); // default value - cy.get(`#${FILE_SETTING_MAX_WIDTH_ID} + input`).should( - 'have.value', - MaxWidth.ExtraLarge, - ); + cy.get(`#${FILE_SETTING_MAX_WIDTH_ID}`).should('have.value', 'default'); const newMaxWidth = MaxWidth.Small; - cy.get(`#${FILE_SETTING_MAX_WIDTH_ID}`).click(); - cy.get(`[role="option"][data-value="${newMaxWidth}"]`).click(); + cy.get(`#${FILE_SETTING_MAX_WIDTH_ID}`).select(newMaxWidth); + // cy.get(`[role="option"][data-value="${newMaxWidth}"]`).click(); cy.wait('@editItem').then( ({ @@ -432,7 +429,7 @@ describe('Item Settings', () => { }, }, settings: { - maxWidth: MaxWidth.ExtraLarge, + maxWidth: MaxWidth.Large, }, }); cy.setUpApi({ items: [FILE] }); @@ -440,7 +437,7 @@ describe('Item Settings', () => { cy.visit(buildItemSettingsPath(itemId)); - cy.get(`#${FILE_SETTING_MAX_WIDTH_ID} + input`).should( + cy.get(`#${FILE_SETTING_MAX_WIDTH_ID}`).should( 'have.value', FILE.settings.maxWidth, ); diff --git a/package.json b/package.json index 89c450f14..1eeeb69ac 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "@graasp/chatbox": "3.1.0", "@graasp/map": "1.15.0", "@graasp/query-client": "3.14.0", - "@graasp/sdk": "4.15.0", - "@graasp/translations": "1.28.0", - "@graasp/ui": "4.20.0", + "@graasp/sdk": "4.15.1", + "@graasp/translations": "1.30.3", + "@graasp/ui": "4.20.2", "@mui/icons-material": "5.15.19", "@mui/lab": "5.0.0-alpha.170", "@mui/material": "5.15.19", diff --git a/src/components/item/ItemContent.tsx b/src/components/item/ItemContent.tsx index d0cf4328e..9ba05c081 100644 --- a/src/components/item/ItemContent.tsx +++ b/src/components/item/ItemContent.tsx @@ -1,6 +1,6 @@ import { useOutletContext } from 'react-router-dom'; -import { Container, Skeleton, styled } from '@mui/material'; +import { Container, Skeleton, Stack, styled } from '@mui/material'; import { Api } from '@graasp/query-client'; import { @@ -50,12 +50,13 @@ import Items from '../main/Items'; import NewItemButton from '../main/NewItemButton'; import { OutletType } from '../pages/item/type'; import { useItemSearch } from './ItemSearch'; +import FileAlignmentSetting from './settings/file/FileAlignmentSetting'; +import FileMaxWidthSetting from './settings/file/FileMaxWidthSetting'; +import { SettingVariant } from './settings/settingTypes'; const { useChildren, useFileContentUrl, useEtherpad } = hooks; const StyledContainer = styled(Container)(() => ({ - textAlign: 'center', - height: '80vh', flexGrow: 1, })); @@ -72,12 +73,18 @@ const FileContent = ({ if (fileUrl) { return ( - + + + + + + + ); } diff --git a/src/components/item/form/DescriptionPlacementForm.tsx b/src/components/item/form/DescriptionPlacementForm.tsx index 73af54479..377b3efee 100644 --- a/src/components/item/form/DescriptionPlacementForm.tsx +++ b/src/components/item/form/DescriptionPlacementForm.tsx @@ -6,6 +6,8 @@ import { DiscriminatedItem, } from '@graasp/sdk'; +import { CornerDownRightIcon, CornerUpRightIcon } from 'lucide-react'; + import { useBuilderTranslation } from '@/config/i18n'; import { ITEM_SETTING_DESCRIPTION_PLACEMENT_SELECT_ID, @@ -31,32 +33,37 @@ const DescriptionPlacementForm = ({ const handlePlacementChanged = (placement: string): void => { onPlacementChanged(placement as DescriptionPlacementType); }; + const descriptionPlacement = + updatedProperties.settings?.descriptionPlacement ?? DEFAULT_PLACEMENT; return ( + ) : ( + + ) + } + valueText={t(BUILDER.ITEM_SETTINGS_DESCRIPTION_PLACEMENT_HELPER, { + placement: t(descriptionPlacement).toLowerCase(), + })} inputSetting={ } /> diff --git a/src/components/item/settings/AdminChatSettings.tsx b/src/components/item/settings/AdminChatSettings.tsx index e009a4e1d..23c428f5e 100644 --- a/src/components/item/settings/AdminChatSettings.tsx +++ b/src/components/item/settings/AdminChatSettings.tsx @@ -1,5 +1,7 @@ import { PackedItem, PermissionLevel } from '@graasp/sdk'; +import { MessageSquareTextIcon } from 'lucide-react'; + import { useBuilderTranslation } from '@/config/i18n'; import { BUILDER } from '@/langs/constants'; @@ -28,6 +30,7 @@ const AdminChatSettings = ({ item }: Props): JSX.Element | null => { } inputSetting={} /> ); diff --git a/src/components/item/settings/FileSettings.tsx b/src/components/item/settings/FileSettings.tsx deleted file mode 100644 index 64c3fb430..000000000 --- a/src/components/item/settings/FileSettings.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { SelectChangeEvent } from '@mui/material'; - -import { LocalFileItemType, MaxWidth, S3FileItemType } from '@graasp/sdk'; -import { Select } from '@graasp/ui'; - -import { Expand as ExpandIcon } from 'lucide-react'; - -import { useBuilderTranslation, useEnumsTranslation } from '@/config/i18n'; -import { mutations } from '@/config/queryClient'; -import { FILE_SETTING_MAX_WIDTH_ID } from '@/config/selectors'; -import { BUILDER } from '@/langs/constants'; - -import ItemSettingProperty from './ItemSettingProperty'; - -const FileSettings = ({ - item, -}: { - item: S3FileItemType | LocalFileItemType; -}): JSX.Element => { - const { t: translateEnum } = useEnumsTranslation(); - const { t: translateBuilder } = useBuilderTranslation(); - const { mutate: editItem } = mutations.useEditItem(); - - const onChange = (e: SelectChangeEvent) => { - editItem({ - id: item.id, - settings: { maxWidth: e.target.value as MaxWidth }, - }); - }; - - return ( - } - inputSetting={ -