generated from graasp/graasp-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use thumbnails and display date on cards (#498)
* fix: use thumbnails and display date on cards * fix: add a fallback if thumbnail is not found * fix: use ItemIcon in ItemThumbnail
- Loading branch information
Showing
9 changed files
with
735 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,52 +33,52 @@ | |
}, | ||
"dependencies": { | ||
"@emotion/cache": "11.11.0", | ||
"@emotion/react": "11.11.1", | ||
"@emotion/react": "11.11.3", | ||
"@emotion/styled": "11.11.0", | ||
"@graasp/chatbox": "3.0.3", | ||
"@graasp/query-client": "2.4.2", | ||
"@graasp/query-client": "2.5.0", | ||
"@graasp/sdk": "3.6.0", | ||
"@graasp/translations": "1.21.1", | ||
"@graasp/translations": "1.23.0", | ||
"@graasp/ui": "4.5.1", | ||
"@mui/icons-material": "5.14.19", | ||
"@mui/icons-material": "5.15.7", | ||
"@mui/lab": "5.0.0-alpha.151", | ||
"@mui/material": "5.14.19", | ||
"@sentry/react": "7.93.0", | ||
"@mui/material": "5.15.7", | ||
"@sentry/react": "7.99.0", | ||
"classnames": "2.5.1", | ||
"i18next": "23.7.7", | ||
"i18next": "23.7.16", | ||
"lodash.truncate": "4.4.2", | ||
"react": "18.2.0", | ||
"react-accessible-treeview": "2.8.3", | ||
"react-dom": "18.2.0", | ||
"react-ga4": "2.1.0", | ||
"react-i18next": "13.5.0", | ||
"react-intersection-observer": "9.5.3", | ||
"react-router": "6.21.3", | ||
"react-router-dom": "6.21.3", | ||
"react-intersection-observer": "9.6.0", | ||
"react-router": "6.22.0", | ||
"react-router-dom": "6.22.0", | ||
"react-toastify": "10.0.4", | ||
"stylis": "4.3.1", | ||
"stylis-plugin-rtl": "2.1.1", | ||
"uuid": "9.0.1" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "18.6.0", | ||
"@cypress/code-coverage": "3.12.18", | ||
"@cypress/code-coverage": "3.12.19", | ||
"@trivago/prettier-plugin-sort-imports": "4.3.0", | ||
"@types/lodash.truncate": "^4.4.9", | ||
"@types/node": "^20.10.1", | ||
"@types/react": "18.2.48", | ||
"@types/react-dom": "^18.2.17", | ||
"@types/uuid": "9.0.7", | ||
"@types/node": "^20.11.16", | ||
"@types/react": "18.2.51", | ||
"@types/react-dom": "^18.2.18", | ||
"@types/uuid": "9.0.8", | ||
"@typescript-eslint/eslint-plugin": "6.20.0", | ||
"@typescript-eslint/parser": "6.20.0", | ||
"@vitejs/plugin-react": "^4.2.0", | ||
"commitlint": "18.4.4", | ||
"@vitejs/plugin-react": "^4.2.1", | ||
"commitlint": "18.6.0", | ||
"concurrently": "8.2.2", | ||
"cypress": "13.6.3", | ||
"cypress": "13.6.4", | ||
"cypress-iframe": "1.0.1", | ||
"cypress-vite": "1.5.0", | ||
"env-cmd": "10.1.0", | ||
"eslint": "^8.54.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-airbnb": "19.0.4", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-import-resolver-typescript": "3.6.1", | ||
|
@@ -87,16 +87,13 @@ | |
"eslint-plugin-react": "7.33.2", | ||
"eslint-plugin-react-hooks": "4.6.0", | ||
"http-status-codes": "2.3.0", | ||
"husky": "8.0.3", | ||
"husky": "9.0.10", | ||
"prettier": "3.2.4", | ||
"rollup-plugin-visualizer": "5.12.0", | ||
"typescript": "^5.3.2", | ||
"vite": "^5.0.4", | ||
"vite-plugin-checker": "^0.6.2", | ||
"typescript": "^5.3.3", | ||
"vite": "^5.0.12", | ||
"vite-plugin-checker": "^0.6.4", | ||
"vite-plugin-istanbul": "5.0.0" | ||
}, | ||
"resolutions": { | ||
"@graasp/sdk": "3.6.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
DiscriminatedItem, | ||
ThumbnailSize, | ||
ThumbnailSizeType, | ||
getMimetype, | ||
} from '@graasp/sdk'; | ||
import { ItemIcon } from '@graasp/ui'; | ||
|
||
import { hooks } from '@/config/queryClient'; | ||
|
||
type Props = { | ||
item: DiscriminatedItem; | ||
size?: ThumbnailSizeType; | ||
}; | ||
const ItemThumbnail = ({ | ||
item, | ||
size = ThumbnailSize.Small, | ||
}: Props): JSX.Element | null => { | ||
const { data: thumbnailSrc } = hooks.useItemThumbnailUrl({ | ||
id: item.id, | ||
size, | ||
}); | ||
|
||
return ( | ||
<ItemIcon | ||
type={item.type} | ||
mimetype={getMimetype(item.extra)} | ||
alt={item.name} | ||
iconSrc={thumbnailSrc} | ||
sx={{ borderRadius: 1 }} | ||
/> | ||
); | ||
}; | ||
export default ItemThumbnail; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.