From 10b46bdd49122c21bf55de626afb557a70e842d5 Mon Sep 17 00:00:00 2001 From: Bill2015 Date: Mon, 26 Feb 2024 00:42:44 +0800 Subject: [PATCH] Fix: add unsupported icon for resource can't that generate the thumbnail Related Issues: - #25 --- src/api/resource/Dto.ts | 2 ++ src/assets/icons/not-supported-icon.png | Bin 0 -> 18811 bytes .../display/ResourceThumbnailDisplayer.tsx | 21 ------------- src/components/display/index.ts | 3 +- .../thumbnail/LocalFileThumbnailDisplayer.tsx | 25 +++++++++++++++ .../thumbnail/ResourceThumbnailDisplayer.tsx | 29 ++++++++++++++++++ .../thumbnail/file/LocalImageThumbnail.tsx | 9 ++++++ .../file/LocalUnsupportThumbnail.tsx | 13 ++++++++ .../display/thumbnail/file/index.ts | 2 ++ .../display/thumbnail/file/types.ts | 5 +++ src/components/display/thumbnail/index.ts | 3 ++ .../{ => thumbnail/url}/YoutubeThunbnail.tsx | 5 ++- src/components/display/thumbnail/url/index.ts | 1 + .../category-list/components/CategoryCard.tsx | 1 + .../resource-list/components/ResourceCard.tsx | 7 ++++- 15 files changed, 99 insertions(+), 27 deletions(-) create mode 100644 src/assets/icons/not-supported-icon.png delete mode 100644 src/components/display/ResourceThumbnailDisplayer.tsx create mode 100644 src/components/display/thumbnail/LocalFileThumbnailDisplayer.tsx create mode 100644 src/components/display/thumbnail/ResourceThumbnailDisplayer.tsx create mode 100644 src/components/display/thumbnail/file/LocalImageThumbnail.tsx create mode 100644 src/components/display/thumbnail/file/LocalUnsupportThumbnail.tsx create mode 100644 src/components/display/thumbnail/file/index.ts create mode 100644 src/components/display/thumbnail/file/types.ts create mode 100644 src/components/display/thumbnail/index.ts rename src/components/display/{ => thumbnail/url}/YoutubeThunbnail.tsx (97%) create mode 100644 src/components/display/thumbnail/url/index.ts diff --git a/src/api/resource/Dto.ts b/src/api/resource/Dto.ts index 7faaa799..5fb698bb 100644 --- a/src/api/resource/Dto.ts +++ b/src/api/resource/Dto.ts @@ -14,6 +14,8 @@ export interface ResourceFileDto { path: string, ext: string, + + media_type: string, } export interface ResourceResDto { diff --git a/src/assets/icons/not-supported-icon.png b/src/assets/icons/not-supported-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..b56f12ab8f8c64af0437759906a66e8e6ffb63e1 GIT binary patch literal 18811 zcmafaWmlWc_jQs62<}$gokEdPG`K@>mlkdD;vQUzyA*eK_u?+a3oQ<%XmS7N{yiVy zd69Kx*19q?nKQFzpR>=2fT_r0qP<1~005Zsa#HF501)vN2!J3X9)@2^E&ppdtIJ9N zs;9{RAR1sRab1fO9>&L6D2C)q zO)vfpiYT)}auRrW5ZGzG)|$8B7T!(v^%3uIOqRg8hB0~Sfajah@o}*QtrWX9cg1=J zJ*0V92?PhP>!#i|^F^eg;iKiJj`5S)-X}j%w(FBzB)6OAllS}C-dFxu8g2OUaSeW^Wnrd4Fm+E1&X3BN$xMglk(cQH&09bL9(?@Gi%yCJ{=cA z0-rv^K+J#cUj)djob&)AM`8wV*e!~m-YiForYfJAUZ0Jm1XCZ#LBNm;c3N$IUcFaa z1@6iGe7-Ae{wQJnvn0uFqId*nbU7x$S1NlK`?aXb72P%vNI*CP?Lbc2<#+eJi928R zHiCazSYZV;oT$BhLE^Z4e161rcV6!^>pnDAj;9(1KD`mUKGn1o@mYFp`W$;1(z8q3 zyBP)KM1=#xKPI|!@VpeP%oM!{K?K7;zJ2iOv7QqfkcRiqQl>K2^-R4Unz%ulc)Ura zdQA}sYu4DkSBT_Kac`cLZ@PhkOWkc8!>2X^g?0zxgALr)#>{}A7DTm;QO%>*pJ)$ zR|8Kg#8KeaAOo;A+^^BfWYpexe9MeS^qU^(JKZXeC<73AjJuOO;F8FU49uOn&bLZ= zjt9z5<8$QE12xoVrw<~ge~!h8bYVHsx;nQS0pk~cW5)9q=C>>afmps2HW(<`8lJ3# z_4KrV*q_SUIy$o2ml-yB^w4}9yeQaugY#W-k+-?!lz05)YyV~|T#=2<0%Y$alytY3 z@;frn<$n4~2}+DBU6=Wkaaz~mk4fMiOB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p@Krjj9=}sct$A>Zg1KOxhdH?_b literal 0 HcmV?d00001 diff --git a/src/components/display/ResourceThumbnailDisplayer.tsx b/src/components/display/ResourceThumbnailDisplayer.tsx deleted file mode 100644 index 3e7cdbe4..00000000 --- a/src/components/display/ResourceThumbnailDisplayer.tsx +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable react/jsx-props-no-spreading */ -import { convertFileSrc } from '@tauri-apps/api/tauri'; - -import { YoutubeThumbnail } from './YoutubeThunbnail'; -import { ResponsiveImage, ResponsiveImageProps } from './ResponsiveImage'; - -interface ResourceThumbnailDisplayerProps extends ResponsiveImageProps { - url?: string | undefined | null; - - filePath?: string | undefined | null; -} - -export function ResourceThumbnailDisplayer(props: ResourceThumbnailDisplayerProps) { - const { url, filePath, ...imgProps } = props; - - return ( - url - ? - : - ); -} diff --git a/src/components/display/index.ts b/src/components/display/index.ts index f7922b87..98742cc6 100644 --- a/src/components/display/index.ts +++ b/src/components/display/index.ts @@ -1,8 +1,7 @@ export * from './icons'; +export * from './thumbnail'; export * from './ResponsiveImage'; -export * from './YoutubeThunbnail'; export * from './EditableText'; -export * from './ResourceThumbnailDisplayer'; export * from './DateTimeDisplayer'; export * from './TagTypography'; export * from './SubTitle'; diff --git a/src/components/display/thumbnail/LocalFileThumbnailDisplayer.tsx b/src/components/display/thumbnail/LocalFileThumbnailDisplayer.tsx new file mode 100644 index 00000000..9f6e11e8 --- /dev/null +++ b/src/components/display/thumbnail/LocalFileThumbnailDisplayer.tsx @@ -0,0 +1,25 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import { LocalImageThumbnail, LocalUnsupportThumbnail } from './file'; +import { LocalThumbnailProps } from './file/types'; + +const LOCAL_MEDIA_TYPE = new Map(); + +LOCAL_MEDIA_TYPE.set('image/jpeg', LocalImageThumbnail); +LOCAL_MEDIA_TYPE.set('image/png', LocalImageThumbnail); +LOCAL_MEDIA_TYPE.set('image/gif', LocalImageThumbnail); + +interface LocalFileThumbnailDisplayerProps extends LocalThumbnailProps { + mediaType: string; +} + +export function LocalFileThumbnailDisplayer(props: LocalFileThumbnailDisplayerProps) { + const { filePath, mediaType, ...imgProps } = props; + + if (LOCAL_MEDIA_TYPE.has(mediaType) === false) { + return ; + } + + const Thumbnail = LOCAL_MEDIA_TYPE.get(mediaType)!; + + return ; +} diff --git a/src/components/display/thumbnail/ResourceThumbnailDisplayer.tsx b/src/components/display/thumbnail/ResourceThumbnailDisplayer.tsx new file mode 100644 index 00000000..11f30757 --- /dev/null +++ b/src/components/display/thumbnail/ResourceThumbnailDisplayer.tsx @@ -0,0 +1,29 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import { ResponsiveImageProps } from '@components/display'; + +import { YoutubeThumbnail } from './url'; +import { LocalFileThumbnailDisplayer } from './LocalFileThumbnailDisplayer'; + +export interface ResourceThumbnailDisplayerProps extends ResponsiveImageProps { + url?: string | undefined | null; + + filePath?: string | undefined | null; + + mediaType?: string; +} + +export function ResourceThumbnailDisplayer(props: ResourceThumbnailDisplayerProps) { + const { url, filePath, mediaType, ...imgProps } = props; + + return ( + url + ? + : ( + + ) + ); +} diff --git a/src/components/display/thumbnail/file/LocalImageThumbnail.tsx b/src/components/display/thumbnail/file/LocalImageThumbnail.tsx new file mode 100644 index 00000000..b3b1d6de --- /dev/null +++ b/src/components/display/thumbnail/file/LocalImageThumbnail.tsx @@ -0,0 +1,9 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import { convertFileSrc } from '@tauri-apps/api/tauri'; +import { ResponsiveImage } from '@components/display'; +import { LocalThumbnailProps } from './types'; + +export function LocalImageThumbnail(props: LocalThumbnailProps) { + const { filePath, ...imgProps } = props; + return ; +} diff --git a/src/components/display/thumbnail/file/LocalUnsupportThumbnail.tsx b/src/components/display/thumbnail/file/LocalUnsupportThumbnail.tsx new file mode 100644 index 00000000..d8e96b6d --- /dev/null +++ b/src/components/display/thumbnail/file/LocalUnsupportThumbnail.tsx @@ -0,0 +1,13 @@ +/* eslint-disable react/jsx-props-no-spreading */ +import { ResponsiveImage, ResponsiveImageProps } from '@components/display/ResponsiveImage'; +import UnsupportImage from '@assets/icons/not-supported-icon.png'; + +export interface LocalUnsupportThumbnailProps extends Omit { + mediaType: string; +} + +export function LocalUnsupportThumbnail(props: LocalUnsupportThumbnailProps) { + const { mediaType, ...imgProps } = props; + + return (); +} diff --git a/src/components/display/thumbnail/file/index.ts b/src/components/display/thumbnail/file/index.ts new file mode 100644 index 00000000..aadbac03 --- /dev/null +++ b/src/components/display/thumbnail/file/index.ts @@ -0,0 +1,2 @@ +export * from './LocalUnsupportThumbnail'; +export * from './LocalImageThumbnail'; diff --git a/src/components/display/thumbnail/file/types.ts b/src/components/display/thumbnail/file/types.ts new file mode 100644 index 00000000..b2369ec5 --- /dev/null +++ b/src/components/display/thumbnail/file/types.ts @@ -0,0 +1,5 @@ +import { ResponsiveImageProps } from '@components/display/ResponsiveImage'; + +export interface LocalThumbnailProps extends Omit { + filePath: string; +} diff --git a/src/components/display/thumbnail/index.ts b/src/components/display/thumbnail/index.ts new file mode 100644 index 00000000..7c856b8b --- /dev/null +++ b/src/components/display/thumbnail/index.ts @@ -0,0 +1,3 @@ +export * from './file'; +export * from './url'; +export * from './ResourceThumbnailDisplayer'; diff --git a/src/components/display/YoutubeThunbnail.tsx b/src/components/display/thumbnail/url/YoutubeThunbnail.tsx similarity index 97% rename from src/components/display/YoutubeThunbnail.tsx rename to src/components/display/thumbnail/url/YoutubeThunbnail.tsx index 4f54ba37..0c4b213d 100644 --- a/src/components/display/YoutubeThunbnail.tsx +++ b/src/components/display/thumbnail/url/YoutubeThunbnail.tsx @@ -1,11 +1,10 @@ /* eslint-disable react/jsx-props-no-spreading */ +import { useMemo, useRef, useState } from 'react'; import { CiImageOff } from 'react-icons/ci'; import { Center, Image } from '@mantine/core'; import { getYoutubeVideoId } from '@utils/urlParser'; import { useBackGroundImage } from '@hooks/ui-hooks'; - -import { useMemo, useRef, useState } from 'react'; -import { ResponsiveImageProps } from './ResponsiveImage'; +import { ResponsiveImageProps } from '@components/display'; export interface YoutubeThumbnailProps extends Omit { url: string; diff --git a/src/components/display/thumbnail/url/index.ts b/src/components/display/thumbnail/url/index.ts new file mode 100644 index 00000000..2c4edaf0 --- /dev/null +++ b/src/components/display/thumbnail/url/index.ts @@ -0,0 +1 @@ +export * from './YoutubeThunbnail'; diff --git a/src/pages/category-list/components/CategoryCard.tsx b/src/pages/category-list/components/CategoryCard.tsx index 8d713859..7b3b057e 100644 --- a/src/pages/category-list/components/CategoryCard.tsx +++ b/src/pages/category-list/components/CategoryCard.tsx @@ -55,6 +55,7 @@ export function CategoryCard(props: CategoryCardProps) { key={data.id} url={data.url?.full} filePath={`${data.root_path}${data.file?.path}`} + mediaType={data.file?.media_type} alt={data.name} useBackgoundImg /> diff --git a/src/pages/resource-list/components/ResourceCard.tsx b/src/pages/resource-list/components/ResourceCard.tsx index 2c0c297b..f0457986 100644 --- a/src/pages/resource-list/components/ResourceCard.tsx +++ b/src/pages/resource-list/components/ResourceCard.tsx @@ -49,7 +49,12 @@ export function ResourceCard(props: ResourceCardProps) { )} - +