From f34519ac474dd8589a4ba8658c097505ed5d9980 Mon Sep 17 00:00:00 2001 From: spaenleh Date: Wed, 24 Apr 2024 16:08:40 +0200 Subject: [PATCH] fix: remove white boxes --- .../item/publish/CustomizedTagsEdit.tsx | 24 +++++++---- .../item/settings/GeolocationPicker.tsx | 24 +++++++---- .../item/settings/ItemLicenseSettings.tsx | 6 ++- .../item/settings/ItemMetadataContent.tsx | 12 +++--- src/components/item/settings/ItemSettings.tsx | 6 +-- src/config/constants.ts | 5 +-- src/utils/image.ts | 41 ------------------- yarn.lock | 4 +- 8 files changed, 49 insertions(+), 73 deletions(-) delete mode 100644 src/utils/image.ts diff --git a/src/components/item/publish/CustomizedTagsEdit.tsx b/src/components/item/publish/CustomizedTagsEdit.tsx index 7ea84bb1f..e1cb38e44 100644 --- a/src/components/item/publish/CustomizedTagsEdit.tsx +++ b/src/components/item/publish/CustomizedTagsEdit.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react'; -import { Chip, Stack, TextField, Typography } from '@mui/material'; +import { Box, Chip, Stack, TextField, Typography } from '@mui/material'; import type { TextFieldProps } from '@mui/material'; import { DiscriminatedItem } from '@graasp/sdk'; @@ -53,13 +53,21 @@ const CustomizedTagsEdit = ({ item, disabled }: Props): JSX.Element => { }; return ( - - - {translateBuilder(BUILDER.ITEM_TAGS_TITLE)} - - - {translateBuilder(BUILDER.ITEM_TAGS_INFORMATION)} - + + + + {translateBuilder(BUILDER.ITEM_TAGS_TITLE)} + + + {translateBuilder(BUILDER.ITEM_TAGS_INFORMATION)} + + - - {t(BUILDER.ITEM_SETTINGS_GEOLOCATION_TITLE)} - - - {t(BUILDER.ITEM_SETTINGS_GEOLOCATION_EXPLANATION)} - + + + + {t(BUILDER.ITEM_SETTINGS_GEOLOCATION_TITLE)} + + + {t(BUILDER.ITEM_SETTINGS_GEOLOCATION_EXPLANATION)} + + { additionalInfo={ item.settings?.ccLicenseAdaption && ( { }; return ( - <> - - - + + {item.name} @@ -137,7 +137,7 @@ const ItemMetadataContent = (): JSX.Element => { - + ); }; diff --git a/src/components/item/settings/ItemSettings.tsx b/src/components/item/settings/ItemSettings.tsx index 3aea3a9b1..a211b87ca 100644 --- a/src/components/item/settings/ItemSettings.tsx +++ b/src/components/item/settings/ItemSettings.tsx @@ -11,6 +11,7 @@ import GeolocationPicker from './GeolocationPicker'; import ItemLicenseSettings from './ItemLicenseSettings'; import ItemMetadataContent from './ItemMetadataContent'; import ItemSettingsProperties from './ItemSettingsProperties'; +import ThumbnailSetting from './ThumbnailSetting'; const ItemSettings = (): JSX.Element => { const { item } = useOutletContext(); @@ -18,15 +19,12 @@ const ItemSettings = (): JSX.Element => { return ( + - - - - diff --git a/src/config/constants.ts b/src/config/constants.ts index fa885a45a..ed464c00d 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -95,9 +95,8 @@ export const GRAASP_LOGO_HEADER_HEIGHT = 40; export const ITEMS_TABLE_CONTAINER_HEIGHT = '65vh'; export const THUMBNAIL_ASPECT = 1; -export const THUMBNAIL_EXTENSION = 'image/jpeg'; -export const THUMBNAIL_SETTING_MAX_WIDTH = 200; -export const THUMBNAIL_SETTING_MAX_HEIGHT = 200; +export const THUMBNAIL_SETTING_MAX_WIDTH = 256; +export const THUMBNAIL_SETTING_MAX_HEIGHT = 256; export const H5P_FILE_DOT_EXTENSION = '.h5p'; diff --git a/src/utils/image.ts b/src/utils/image.ts deleted file mode 100644 index 266ff0bba..000000000 --- a/src/utils/image.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Crop } from 'react-image-crop'; - -import { THUMBNAIL_EXTENSION } from '../config/constants'; - -// eslint-disable-next-line import/prefer-default-export -export const getCroppedImg = ( - image: HTMLImageElement, - crop: Crop, - extension = THUMBNAIL_EXTENSION, -): Promise => { - const canvas = document.createElement('canvas'); - const scaleX = image.naturalWidth / image.width; - const scaleY = image.naturalHeight / image.height; - const ctx = canvas.getContext('2d'); - - canvas.width = crop.width * scaleX; - canvas.height = crop.height * scaleY; - - ctx?.drawImage( - image, - crop.x * scaleX, - crop.y * scaleY, - canvas.width, - canvas.height, - 0, - 0, - canvas.width, - canvas.height, - ); - - return new Promise((resolve, reject) => { - canvas.toBlob((blob) => { - if (!blob) { - reject(new Error('Canvas is empty')); - console.error('Canvas is empty'); - return; - } - resolve(blob); - }, extension); - }); -}; diff --git a/yarn.lock b/yarn.lock index 9323d9e7d..84d7d95f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1576,7 +1576,7 @@ __metadata: "@graasp/ui@github:graasp/graasp-ui#update-table-for-background": version: 4.15.1 - resolution: "@graasp/ui@https://github.com/graasp/graasp-ui.git#commit=40d8a0ca8f02f5a85c5a6cdc30f41bfb69f34e9d" + resolution: "@graasp/ui@https://github.com/graasp/graasp-ui.git#commit=af7a68cf5c243a9b0da782913e2a0c3cc106c56e" dependencies: "@ag-grid-community/client-side-row-model": "npm:31.2.1" "@ag-grid-community/react": "npm:^31.1.1" @@ -1608,7 +1608,7 @@ __metadata: react-router-dom: ^6.11.0 stylis: ^4.1.3 stylis-plugin-rtl: ^2.1.1 - checksum: 10/4869fd8cb47faad1e75387b8f3384d817f615892d6c12ab9d64d4d2085fcc9141b6207c451d2be06671ed0f3437aa787f681435a9ec1630339022bb97060b39b + checksum: 10/b2d81599f7053ae9a0efbd601a0e62f756fc90d0916078d6c8a198afd6fdc253062eb73cae3f5da279b1c1cad8a2959d05fb0aaf10c3091a8f5404a5c7919d6c languageName: node linkType: hard