diff --git a/package.json b/package.json index 9d62151c6..87ded3167 100644 --- a/package.json +++ b/package.json @@ -13,10 +13,10 @@ "@emotion/react": "11.10.5", "@emotion/styled": "11.10.5", "@graasp/chatbox": "1.0.3", - "@graasp/query-client": "0.2.1", - "@graasp/sdk": "0.4.1", - "@graasp/translations": "1.5.0", - "@graasp/ui": "0.13.0", + "@graasp/query-client": "0.3.0", + "@graasp/sdk": "0.6.0", + "@graasp/translations": "1.7.0", + "@graasp/ui": "2.0.0", "@mui/icons-material": "5.11.0", "@mui/lab": "5.0.0-alpha.117", "@mui/material": "5.11.6", diff --git a/src/components/common/CollapseButton.tsx b/src/components/common/CollapseButton.tsx index 9c399082f..531c3b65c 100644 --- a/src/components/common/CollapseButton.tsx +++ b/src/components/common/CollapseButton.tsx @@ -10,21 +10,21 @@ import { useEffect, useState } from 'react'; import { MUTATION_KEYS } from '@graasp/query-client'; import { Item } from '@graasp/sdk'; import { BUILDER } from '@graasp/translations'; +import { ActionButton, ActionButtonVariant } from '@graasp/ui'; -import { ButtonType } from '../../config/constants'; import { useBuilderTranslation } from '../../config/i18n'; import { useMutation } from '../../config/queryClient'; import { COLLAPSE_ITEM_BUTTON_CLASS } from '../../config/selectors'; type Props = { item: Item; - type?: ButtonType; + type?: ActionButtonVariant; onClick?: () => void; }; const CollapseButton = ({ item, - type = ButtonType.ICON_BUTTON, + type = ActionButton.ICON_BUTTON, onClick, }: Props): JSX.Element => { const { t: translateBuilder } = useBuilderTranslation(); @@ -57,7 +57,7 @@ const CollapseButton = ({ : translateBuilder(BUILDER.COLLAPSE_ITEM_COLLAPSE_TEXT); switch (type) { - case ButtonType.MENU_ITEM: + case ActionButton.MENU_ITEM: return ( ); - case ButtonType.ICON_BUTTON: + case ActionButton.ICON_BUTTON: default: return ( diff --git a/src/components/common/DeleteButton.tsx b/src/components/common/DeleteButton.tsx index b50692219..05554b852 100644 --- a/src/components/common/DeleteButton.tsx +++ b/src/components/common/DeleteButton.tsx @@ -3,7 +3,10 @@ import { IconButtonProps } from '@mui/material/IconButton'; import { FC, useState } from 'react'; import { BUILDER } from '@graasp/translations'; -import { DeleteButton as GraaspDeleteButton } from '@graasp/ui'; +import { + ActionButtonVariant, + DeleteButton as GraaspDeleteButton, +} from '@graasp/ui'; import { useBuilderTranslation } from '../../config/i18n'; import { ITEM_DELETE_BUTTON_CLASS } from '../../config/selectors'; @@ -13,7 +16,7 @@ type Props = { itemIds: string[]; color?: IconButtonProps['color']; id?: string; - type?: string; + type?: ActionButtonVariant; onClick?: () => void; }; diff --git a/src/components/common/FavoriteButton.tsx b/src/components/common/FavoriteButton.tsx index 2f3605096..b9d1610ba 100644 --- a/src/components/common/FavoriteButton.tsx +++ b/src/components/common/FavoriteButton.tsx @@ -5,7 +5,10 @@ import { FC } from 'react'; import { MUTATION_KEYS } from '@graasp/query-client'; import { ItemRecord, MemberRecord } from '@graasp/sdk/frontend'; import { BUILDER } from '@graasp/translations'; -import { FavoriteButton as GraaspFavoriteButton } from '@graasp/ui'; +import { + ActionButtonVariant, + FavoriteButton as GraaspFavoriteButton, +} from '@graasp/ui'; import { useBuilderTranslation } from '../../config/i18n'; import { useMutation } from '../../config/queryClient'; @@ -14,7 +17,7 @@ import { useCurrentUserContext } from '../context/CurrentUserContext'; type Props = { item: ItemRecord; - type?: string; + type?: ActionButtonVariant; onClick?: () => void; size?: IconButtonProps['size']; }; diff --git a/src/components/common/HideButton.tsx b/src/components/common/HideButton.tsx index aa5dc532a..1669ddaaa 100644 --- a/src/components/common/HideButton.tsx +++ b/src/components/common/HideButton.tsx @@ -8,21 +8,22 @@ import Tooltip from '@mui/material/Tooltip'; import { MUTATION_KEYS } from '@graasp/query-client'; import { Item } from '@graasp/sdk'; import { BUILDER } from '@graasp/translations'; +import { ActionButton, ActionButtonVariant } from '@graasp/ui'; -import { ButtonType, HIDDEN_ITEM_TAG_ID } from '../../config/constants'; +import { HIDDEN_ITEM_TAG_ID } from '../../config/constants'; import { useBuilderTranslation } from '../../config/i18n'; import { hooks, useMutation } from '../../config/queryClient'; import { HIDDEN_ITEM_BUTTON_CLASS } from '../../config/selectors'; type Props = { item: Item; - type?: ButtonType; + type?: ActionButtonVariant; onClick?: () => void; }; const HideButton = ({ item, - type = ButtonType.ICON_BUTTON, + type = ActionButton.ICON_BUTTON, onClick, }: Props): JSX.Element => { const { t: translateBuilder } = useBuilderTranslation(); @@ -69,7 +70,7 @@ const HideButton = ({ const icon = hiddenTag ? : ; switch (type) { - case ButtonType.MENU_ITEM: { + case ActionButton.MENU_ITEM: { const menuItem = ( ); } - case ButtonType.ICON_BUTTON: + case ActionButton.ICON_BUTTON: default: return ( diff --git a/src/components/common/MoveButton.tsx b/src/components/common/MoveButton.tsx index 3cef53089..df9081e21 100644 --- a/src/components/common/MoveButton.tsx +++ b/src/components/common/MoveButton.tsx @@ -3,9 +3,12 @@ import { IconButtonProps } from '@mui/material/IconButton'; import { FC, useContext } from 'react'; import { BUILDER } from '@graasp/translations'; -import { MoveButton as GraaspMoveButton } from '@graasp/ui'; +import { + ActionButton, + ActionButtonVariant, + MoveButton as GraaspMoveButton, +} from '@graasp/ui'; -import { ButtonType } from '../../config/constants'; import { useBuilderTranslation } from '../../config/i18n'; import { ITEM_MENU_MOVE_BUTTON_CLASS, @@ -17,7 +20,7 @@ type MoveButtonProps = { itemIds: string[]; color?: IconButtonProps['color']; id?: string; - type?: ButtonType; + type?: ActionButtonVariant; onClick?: () => void; }; @@ -25,7 +28,7 @@ const MoveButton: FC = ({ itemIds, color = 'default', id, - type = ButtonType.ICON_BUTTON, + type = ActionButton.ICON_BUTTON, onClick, }) => { const { t: translateBuilder } = useBuilderTranslation(); diff --git a/src/components/common/PinButton.tsx b/src/components/common/PinButton.tsx index fae0c180a..3649fe437 100644 --- a/src/components/common/PinButton.tsx +++ b/src/components/common/PinButton.tsx @@ -3,14 +3,14 @@ import { useState } from 'react'; import { MUTATION_KEYS } from '@graasp/query-client'; import { Item } from '@graasp/sdk'; import { BUILDER } from '@graasp/translations'; -import { PinButton as GraaspPinButton } from '@graasp/ui'; +import { ActionButtonVariant, PinButton as GraaspPinButton } from '@graasp/ui'; import { useBuilderTranslation } from '../../config/i18n'; import { useMutation } from '../../config/queryClient'; import { PIN_ITEM_BUTTON_CLASS } from '../../config/selectors'; type Props = { - type?: string; + type?: ActionButtonVariant; item: Item; onClick?: () => void; }; diff --git a/src/components/common/RecycleButton.tsx b/src/components/common/RecycleButton.tsx index 21d34bec9..8a22da38e 100644 --- a/src/components/common/RecycleButton.tsx +++ b/src/components/common/RecycleButton.tsx @@ -8,8 +8,8 @@ import { FC } from 'react'; import { MUTATION_KEYS } from '@graasp/query-client'; import { BUILDER } from '@graasp/translations'; +import { ActionButton, ActionButtonVariant } from '@graasp/ui'; -import { ButtonType } from '../../config/constants'; import { useBuilderTranslation } from '../../config/i18n'; import { useMutation } from '../../config/queryClient'; import { @@ -21,7 +21,7 @@ type Props = { itemIds: string[]; color?: IconButtonProps['color']; id?: string; - type?: ButtonType; + type?: ActionButtonVariant; onClick?: () => void; }; @@ -29,7 +29,7 @@ const RecycleButton: FC = ({ itemIds, color = 'default', id, - type = ButtonType.ICON_BUTTON, + type = ActionButton.ICON_BUTTON, onClick, }) => { const { t: translateBuilder } = useBuilderTranslation(); @@ -45,7 +45,7 @@ const RecycleButton: FC = ({ const text = translateBuilder(BUILDER.RECYCLE_ITEM_BUTTON); switch (type) { - case ButtonType.MENU_ITEM: + case ActionButton.MENU_ITEM: return ( = ({ {text} ); - case ButtonType.ICON_BUTTON: + case ActionButton.ICON_BUTTON: default: return ( diff --git a/src/components/item/ItemContent.tsx b/src/components/item/ItemContent.tsx index 123d6492b..cd5c388cb 100644 --- a/src/components/item/ItemContent.tsx +++ b/src/components/item/ItemContent.tsx @@ -1,20 +1,31 @@ -import { Container, styled } from '@mui/material'; +import { Button, Container, styled } from '@mui/material'; -import { FC } from 'react'; +import { useState } from 'react'; import { UseQueryResult } from 'react-query'; import { Api, MUTATION_KEYS } from '@graasp/query-client'; import { + DocumentItemExtraProperties, ItemType, PermissionLevel, buildPdfViewerLink, getDocumentExtra, + getH5PExtra, } from '@graasp/sdk'; import { + AppItemTypeRecord, DocumentItemTypeRecord, + EmbeddedLinkItemTypeRecord, + EtherpadItemTypeRecord, EtherpadRecord, + FolderItemTypeRecord, + H5PItemTypeRecord, ItemRecord, + LocalFileItemTypeRecord, + MemberRecord, + S3FileItemTypeRecord, } from '@graasp/sdk/frontend'; +import { COMMON } from '@graasp/translations'; import { AppItem, DocumentItem, @@ -23,6 +34,7 @@ import { H5PItem, LinkItem, Loader, + SaveButton, } from '@graasp/ui'; import { @@ -34,6 +46,7 @@ import { H5P_INTEGRATION_URL, ITEM_DEFAULT_HEIGHT, } from '../../config/constants'; +import { useCommonTranslation } from '../../config/i18n'; import { hooks, useMutation } from '../../config/queryClient'; import { DOCUMENT_ITEM_TEXT_EDITOR_ID, @@ -49,81 +62,343 @@ import { useLayoutContext } from '../context/LayoutContext'; import ItemActions from '../main/ItemActions'; import Items from '../main/Items'; import NewItemButton from '../main/NewItemButton'; +import { DocumentExtraForm } from './form/DocumentForm'; const { useChildren, useFileContent, useEtherpad } = hooks; -const FileWrapper = styled(Container)(() => ({ +const StyledContainer = styled(Container)(() => ({ textAlign: 'center', height: '80vh', flexGrow: 1, })); +/** + * Helper component to render typed file items + */ +const FileContent = ({ + item, + isEditing, + onSaveCaption, + saveButtonId, +}: { + item: LocalFileItemTypeRecord | S3FileItemTypeRecord; + isEditing: boolean; + onSaveCaption: (text: string) => void; + saveButtonId: string; +}): JSX.Element => { + const { + data: fileContent, + isLoading, + isError, + } = useFileContent(item.id, { + replyUrl: true, + }); + + // todo: remove when query client is correctly typed + const file = fileContent as Record; + + if (isLoading) { + return ; + } + + if (isError) { + return ; + } + + return ( + + + + ); +}; + +/** + * Helper component to render typed link items + */ +const LinkContent = ({ + item, + member, + isEditing, + onSaveCaption, + saveButtonId, +}: { + item: EmbeddedLinkItemTypeRecord; + member: MemberRecord; + isEditing: boolean; + onSaveCaption: (caption: string) => void; + saveButtonId: string; +}): JSX.Element => ( + + + +); + +/** + * Helper component to render typed document items + */ +const DocumentContent = ({ + item, + isEditing, + onSaveDocument, + onCancel, + saveButtonId, +}: { + item: DocumentItemTypeRecord; + isEditing: boolean; + onSaveDocument: (update: DocumentItemExtraProperties) => void; + onCancel: () => void; + saveButtonId: string; +}): JSX.Element => { + const { t: translateCommon } = useCommonTranslation(); + + const extra = getDocumentExtra(item?.extra); + + const [content, setContent] = useState< + DocumentItemExtraProperties['content'] + >(extra?.content ?? ''); + const [flavor, setFlavor] = useState( + extra?.flavor, + ); + + const newExtra = { content, flavor }; + + const onSave = () => onSaveDocument(newExtra); + + return ( + + {isEditing ? ( + <> + setFlavor(f || undefined)} + saveButtonId={saveButtonId} + /> + + + + ) : ( + + )} + + ); +}; + +/** + * Helper component to render typed app items + */ +const AppContent = ({ + item, + member, + permission, + isEditing, + onSaveCaption, + saveButtonId, +}: { + item: AppItemTypeRecord; + member: MemberRecord; + permission: PermissionLevel; + isEditing: boolean; + onSaveCaption: (caption: string) => void; + saveButtonId: string; +}): JSX.Element => ( + +); + +/** + * Helper component to render typed folder items + */ +const FolderContent = ({ + item, + isEditing, + enableEditing, +}: { + item: FolderItemTypeRecord; + isEditing: boolean; + enableEditing: boolean; +}): JSX.Element => { + const { + data: children, + isLoading, + isError, + } = useChildren(item.id, { + ordered: true, + }); + + if (isLoading) { + return ; + } + + if (isError) { + return ; + } + + return ( + ] : undefined + } + ToolbarActions={ItemActions} + showCreator + /> + ); +}; + +/** + * Helper component to render typed H5P items + */ +const H5PContent = ({ item }: { item: H5PItemTypeRecord }): JSX.Element => { + const { contentId } = getH5PExtra(item?.extra); + + if (!contentId) { + return ; + } + + return ( + + ); +}; + +/** + * Helper component to render typed Etherpad items + */ +const EtherpadContent = ({ + item, +}: { + item: EtherpadItemTypeRecord; +}): JSX.Element => { + const { + data: etherpad, + isLoading, + isError, + }: UseQueryResult = useEtherpad( + item, + 'write', // server will return read view if no write access allowed + ); + + if (isLoading) { + return ; + } + + if (!etherpad?.padUrl || isError) { + return ; + } + + return ( + + ); +}; + +/** + * Props for {@see ItemContent} + */ type Props = { item: ItemRecord; enableEditing?: boolean; permission: PermissionLevel; }; -const ItemContent: FC = ({ item, enableEditing, permission }) => { - const { id: itemId, type: itemType } = item; +/** + * Main item renderer component + */ +const ItemContent = ({ + item, + enableEditing, + permission, +}: Props): JSX.Element => { const { mutate: editItem } = useMutation( MUTATION_KEYS.EDIT_ITEM, ); const { editingItemId, setEditingItemId } = useLayoutContext(); - // provide user to app - const { data: member, isLoading: isLoadingUser } = useCurrentUserContext(); + const { data: member, isLoading, isError } = useCurrentUserContext(); - // display children - const { data: children, isLoading: isLoadingChildren } = useChildren(itemId, { - ordered: true, - enabled: item?.type === ItemType.FOLDER, - }); - - const { data: fileData, isLoading: isLoadingFileContent } = useFileContent( - itemId, - { - enabled: - item && - (itemType === ItemType.LOCAL_FILE || itemType === ItemType.S3_FILE), - replyUrl: true, - }, - ); - const isEditing = enableEditing && editingItemId === itemId; + const isEditing = enableEditing && editingItemId === item.id; - const etherpadQuery: UseQueryResult = useEtherpad( - item, - 'write', - ); // server will return read view if no write access allowed - - if ( - isLoadingFileContent || - isLoadingUser || - isLoadingChildren || - etherpadQuery?.isLoading - ) { + if (isLoading) { return ; } - if (!item || !itemId || etherpadQuery?.isError) { + if (!item || !item.id || isError) { return ; } - const onSaveCaption = (caption) => { + const onSaveCaption = (caption: string) => { // edit item only when description has changed if (caption !== item.description) { - editItem({ id: itemId, description: caption }); + editItem({ id: item.id, description: caption }); } setEditingItemId(null); }; - const onSaveDocument = (text) => { - // edit item only when description has changed - if ( - text !== getDocumentExtra((item as DocumentItemTypeRecord)?.extra).content - ) { - editItem({ id: itemId, extra: buildDocumentExtra({ content: text }) }); - } + const onSaveDocument = ({ content, flavor }: DocumentItemExtraProperties) => { + editItem({ + id: item.id, + extra: buildDocumentExtra({ content, flavor }), + }); setEditingItemId(null); }; @@ -131,119 +406,66 @@ const ItemContent: FC = ({ item, enableEditing, permission }) => { setEditingItemId(null); }; - const saveButtonId = buildSaveButtonId(itemId); + const saveButtonId = buildSaveButtonId(item.id); - switch (itemType) { + switch (item.type) { case ItemType.LOCAL_FILE: case ItemType.S3_FILE: { - // todo: remove when query client is correctly typed - const file = fileData as Record; return ( - - - + ); } case ItemType.LINK: return ( - - - + ); case ItemType.DOCUMENT: return ( - - - + ); case ItemType.APP: return ( - ); case ItemType.FOLDER: return ( - ] : undefined - } - ToolbarActions={ItemActions} - showCreator + enableEditing={enableEditing} /> ); case ItemType.H5P: { - const contentId = item.extra?.h5p?.contentId; - if (!contentId) { - return ; - } - - return ( - - ); + return ; } case ItemType.ETHERPAD: { - if (!etherpadQuery?.data?.padUrl) { - return ; - } - return ( - - ); + return ; } default: diff --git a/src/components/item/form/DocumentForm.tsx b/src/components/item/form/DocumentForm.tsx index 5e5112763..3bf9de772 100644 --- a/src/components/item/form/DocumentForm.tsx +++ b/src/components/item/form/DocumentForm.tsx @@ -1,16 +1,97 @@ +import { FormControl, InputLabel, MenuItem, Select } from '@mui/material'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; -import { DocumentItemType, ItemType } from '@graasp/sdk'; +import { useEffect, useState } from 'react'; + +import { + DocumentItemExtraFlavor, + DocumentItemExtraProperties, + DocumentItemType, + ItemType, +} from '@graasp/sdk'; import { DocumentItemTypeRecord } from '@graasp/sdk/frontend'; import { BUILDER } from '@graasp/translations'; -import { TextEditor } from '@graasp/ui'; +import { DocumentItem } from '@graasp/ui'; import { useBuilderTranslation } from '../../../config/i18n'; import { ITEM_FORM_DOCUMENT_TEXT_ID } from '../../../config/selectors'; import { buildDocumentExtra } from '../../../utils/itemExtra'; import BaseForm from './BaseItemForm'; +export const DocumentExtraForm = ({ + documentItemId, + extra, + maxHeight, + onCancel, + onContentChange, + onContentSave, + onFlavorChange, + placeholder, + saveButtonId, + showActions = false, +}: { + documentItemId?: string; + extra: DocumentItemExtraProperties; + maxHeight?: string; + onCancel?: () => void; + onContentChange?: (text: string) => void; + onContentSave?: (text: string) => void; + onFlavorChange?: (text: DocumentItemExtraProperties['flavor']) => void; + placeholder?: string; + saveButtonId?: string; + showActions?: boolean; +}): JSX.Element => { + const { t } = useBuilderTranslation(); + const flavorsTranslations = Object.values(DocumentItemExtraFlavor).map( + (f) => [f, t(BUILDER[`DOCUMENT_FLAVOR_${f.toUpperCase()}`])], + ); + + return ( + <> + + + Flavor + + + + + + + + ); +}; + type Props = { onChange: (item: Partial) => void; item: Partial; @@ -24,38 +105,50 @@ const DocumentForm = ({ }: Props): JSX.Element => { const { t: translateBuilder } = useBuilderTranslation(); - const handleOnChange = (content) => { + const initContent: string = + updatedProperties?.extra?.[ItemType.DOCUMENT]?.content || + item?.extra?.[ItemType.DOCUMENT]?.content; + + const initFlavor: DocumentItemExtraProperties['flavor'] = + updatedProperties?.extra?.[ItemType.DOCUMENT]?.flavor || + item?.extra?.[ItemType.DOCUMENT]?.flavor; + + const [content, setContent] = + useState(initContent); + const [flavor, setFlavor] = + useState(initFlavor); + + const currentExtra = buildDocumentExtra({ content, flavor }); + + // synchronize upper state after async local state change + useEffect(() => { onChange({ ...updatedProperties, - extra: buildDocumentExtra({ content }), + extra: currentExtra, }); - }; - - const value = - updatedProperties?.extra?.[ItemType.DOCUMENT]?.content || - item?.extra?.[ItemType.DOCUMENT]?.content || - ''; + // we only want to execute the state sync on local state change + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [content, flavor]); return ( <> {translateBuilder(BUILDER.CREATE_NEW_ITEM_DOCUMENT_TITLE)} - - - + + ); }; diff --git a/src/components/main/CopyButton.tsx b/src/components/main/CopyButton.tsx index 293bcf79e..d45f7ce32 100644 --- a/src/components/main/CopyButton.tsx +++ b/src/components/main/CopyButton.tsx @@ -3,7 +3,10 @@ import { IconButtonProps } from '@mui/material'; import { FC, MouseEventHandler } from 'react'; import { BUILDER } from '@graasp/translations'; -import { CopyButton as GraaspCopyButton } from '@graasp/ui'; +import { + ActionButtonVariant, + CopyButton as GraaspCopyButton, +} from '@graasp/ui'; import { useBuilderTranslation } from '../../config/i18n'; import { @@ -16,7 +19,7 @@ export type Props = { color?: IconButtonProps['color']; id?: string; onClick?: MouseEventHandler; - type?: string; + type?: ActionButtonVariant; itemIds: string[]; }; diff --git a/src/components/main/ItemMenu.tsx b/src/components/main/ItemMenu.tsx index 13f1cac3e..b8ebfe5b9 100644 --- a/src/components/main/ItemMenu.tsx +++ b/src/components/main/ItemMenu.tsx @@ -10,8 +10,8 @@ import { FC, useContext, useState } from 'react'; import { Item, convertJs } from '@graasp/sdk'; import { BUILDER } from '@graasp/translations'; +import { ActionButton } from '@graasp/ui'; -import { ButtonType } from '../../config/constants'; import { useBuilderTranslation } from '../../config/i18n'; import { ITEM_MENU_BUTTON_CLASS, @@ -70,16 +70,20 @@ const ItemMenu: FC = ({ item, canEdit = false }) => { return [ , - , - , - , + , + , + , , @@ -94,12 +98,12 @@ const ItemMenu: FC = ({ item, canEdit = false }) => { , , diff --git a/src/config/constants.ts b/src/config/constants.ts index 80077a8f2..8d51d8eb7 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -231,11 +231,6 @@ export const HOST_MAP = { [Context.EXPLORER]: '', }; -export enum ButtonType { - MENU_ITEM = 'menuItem', - ICON_BUTTON = 'iconButton', -} - export const MEMBERSHIP_TABLE_HEIGHT = 400; export const MEMBERSHIP_TABLE_ROW_HEIGHT = 75; diff --git a/src/utils/itemExtra.ts b/src/utils/itemExtra.ts index 80c2eed75..2b9dcb439 100644 --- a/src/utils/itemExtra.ts +++ b/src/utils/itemExtra.ts @@ -4,12 +4,13 @@ import { EmbeddedLinkItemExtra, EmbeddedLinkItemExtraProperties, FileItemProperties, + ItemLoginSchema, ItemSettings, ItemType, LocalFileItemExtra, S3FileItemExtra, } from '@graasp/sdk'; -import { ItemLogin, ItemLoginSchema } from '@graasp/ui/dist/types'; +import { ItemLogin } from '@graasp/sdk/frontend'; export const buildFileExtra = ( file: FileItemProperties, @@ -59,9 +60,9 @@ export const getItemLoginSchema = (extra: { }): string | undefined => extra?.itemLogin?.loginSchema; export const buildDocumentExtra = ( - text: DocumentItemExtraProperties, + document: DocumentItemExtraProperties, ): DocumentItemExtra => ({ - [ItemType.DOCUMENT]: text, + [ItemType.DOCUMENT]: document, }); export const buildAppExtra = ({ diff --git a/yarn.lock b/yarn.lock index f7feecc8d..a5bceb5de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2349,9 +2349,9 @@ __metadata: languageName: node linkType: hard -"@graasp/query-client@npm:0.2.1": - version: 0.2.1 - resolution: "@graasp/query-client@npm:0.2.1" +"@graasp/query-client@npm:0.3.0": + version: 0.3.0 + resolution: "@graasp/query-client@npm:0.3.0" dependencies: "@graasp/sdk": 0.4.1 "@graasp/translations": 1.4.0 @@ -2364,7 +2364,7 @@ __metadata: uuid: 9.0.0 peerDependencies: react: ^17.0.0 - checksum: 63337026c3fe71d9a772cc5a9f2144fc523fa1682db29bb3718fb096e1a8dd9945ae32eef900a129baa32979ca5c89d9457956bf95552d06977e4f1ecd0505a2 + checksum: 6d52a706f7b6418e4c67d4ca0835107c27b113d54fe090503694d6908f6ee1d48dd25fc00eac3d6d4436f14aa30f460ea1e9e300fd0e0a68398214bbaca00eef languageName: node linkType: hard @@ -2402,6 +2402,23 @@ __metadata: languageName: node linkType: hard +"@graasp/sdk@npm:0.6.0": + version: 0.6.0 + resolution: "@graasp/sdk@npm:0.6.0" + dependencies: + "@fastify/secure-session": 5.3.0 + aws-sdk: 2.1310.0 + fastify: 3.29.5 + fluent-json-schema: 3.1.0 + immutable: 4.2.4 + js-cookie: 3.0.1 + qs: 6.11.0 + slonik: 28.1.1 + uuid: 9.0.0 + checksum: 450ec10d93b2139ea21728b6ce633e6947092707b1caa66055a0a251607b0c2b28ed03d3c9baa1864e930a460289927209256aef7509e7b8ff4973d17703a2ba + languageName: node + linkType: hard + "@graasp/translations@npm:1.4.0": version: 1.4.0 resolution: "@graasp/translations@npm:1.4.0" @@ -2411,12 +2428,12 @@ __metadata: languageName: node linkType: hard -"@graasp/translations@npm:1.5.0": - version: 1.5.0 - resolution: "@graasp/translations@npm:1.5.0" +"@graasp/translations@npm:1.7.0": + version: 1.7.0 + resolution: "@graasp/translations@npm:1.7.0" dependencies: i18next: 21.8.1 - checksum: e5e3e00b334cab2a71776c6a13dce0284239ed83fcc5622d5b31df791616c82ad4dda40a9a829bc5ed0d46457ecdf7d28ff0aa568d977ce7f66f7dab4c89580e + checksum: fa4b2e3b6ea86d42c1c3fb928762b708dc0fc7bcb960654eff6e810b9fd97baecdee54cb43564ae47650e20878833035ac52564ca2e4f9ee8745322bc952d49c languageName: node linkType: hard @@ -2459,11 +2476,11 @@ __metadata: languageName: node linkType: hard -"@graasp/ui@npm:0.13.0": - version: 0.13.0 - resolution: "@graasp/ui@npm:0.13.0" +"@graasp/ui@npm:2.0.0": + version: 2.0.0 + resolution: "@graasp/ui@npm:2.0.0" dependencies: - "@graasp/sdk": 0.4.1 + "@graasp/sdk": 0.6.0 clsx: 1.1.1 http-status-codes: 2.2.0 immutable: 4.2.4 @@ -2494,7 +2511,7 @@ __metadata: optional: true ag-grid-react: optional: true - checksum: 2188c3b23c3c9751e0255c355671abaad5ac4801c92e29798e6b517dda65b47ad0be5467a3abf646a1c6b1624aa2bc10e9895306dbc131912493732b8c39ad14 + checksum: 0bfd67465c0b572732329e8d4b493f5113d8dfb4a5a51ec5a5b541f11f8425b2dd38032c5f54eccf798f400998a9effb8ed5a0526c2dd0fc6a6d31e26c87a42c languageName: node linkType: hard @@ -9038,7 +9055,7 @@ __metadata: languageName: node linkType: hard -"fastify@npm:3.29.5, fastify@npm:^3.29.1": +"fastify@npm:3.29.5": version: 3.29.5 resolution: "fastify@npm:3.29.5" dependencies: @@ -9062,6 +9079,29 @@ __metadata: languageName: node linkType: hard +"fastify@npm:^3.29.1": + version: 3.29.3 + resolution: "fastify@npm:3.29.3" + dependencies: + "@fastify/ajv-compiler": ^1.0.0 + "@fastify/error": ^2.0.0 + abstract-logging: ^2.0.0 + avvio: ^7.1.2 + fast-json-stringify: ^2.5.2 + find-my-way: ^4.5.0 + flatstr: ^1.0.12 + light-my-request: ^4.2.0 + pino: ^6.13.0 + process-warning: ^1.0.0 + proxy-addr: ^2.0.7 + rfdc: ^1.1.4 + secure-json-parse: ^2.0.0 + semver: ^7.3.2 + tiny-lru: ^8.0.1 + checksum: a3edd89ff5dd0efae43989f18a6ab2270b9b8fc11c6fc7cca6e8cfe3647dc4b0bb5b20104fe2c8468efbaad57af03113e4c592fafae8c619b8edc9a9e1ae98f4 + languageName: node + linkType: hard + "fastq@npm:^1.6.0, fastq@npm:^1.6.1": version: 1.15.0 resolution: "fastq@npm:1.15.0" @@ -9891,10 +9931,10 @@ __metadata: "@emotion/react": 11.10.5 "@emotion/styled": 11.10.5 "@graasp/chatbox": 1.0.3 - "@graasp/query-client": 0.2.1 - "@graasp/sdk": 0.4.1 - "@graasp/translations": 1.5.0 - "@graasp/ui": 0.13.0 + "@graasp/query-client": 0.3.0 + "@graasp/sdk": 0.6.0 + "@graasp/translations": 1.7.0 + "@graasp/ui": 2.0.0 "@graasp/websockets": "github:graasp/graasp-websockets.git" "@mui/icons-material": 5.11.0 "@mui/lab": 5.0.0-alpha.117