diff --git a/services/web-ui/public/locales/en/blog-photos.json b/services/web-ui/public/locales/en/blog-photos.json new file mode 100644 index 00000000..2884efa9 --- /dev/null +++ b/services/web-ui/public/locales/en/blog-photos.json @@ -0,0 +1,4 @@ +{ + "error": "Unable to fetch photos", + "no-photos": "No photos has been uploaded yet. Create a blog post to make that happen!" +} diff --git a/services/web-ui/public/locales/sv/blog-photos.json b/services/web-ui/public/locales/sv/blog-photos.json new file mode 100644 index 00000000..9f659b81 --- /dev/null +++ b/services/web-ui/public/locales/sv/blog-photos.json @@ -0,0 +1,4 @@ +{ + "error": "Kunde inte hämta foton", + "no-photos": "Inga foton har laddats upp här än. Skapa en bloggpost för att ladda upp foton." +} diff --git a/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.container.tsx b/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.container.tsx index f5dbe6f8..d4489ce3 100644 --- a/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.container.tsx +++ b/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.container.tsx @@ -1,6 +1,7 @@ import { ReactElement } from "react"; +import { useTranslation } from "react-i18next"; -import { Typography } from "@mui/material"; +import { Box, Typography } from "@mui/material"; import { blogsApi } from "src/apis"; import { InteractionObserver } from "src/core/infinite-scroll"; @@ -14,6 +15,8 @@ import { BlogPhotoListPageSkeleton } from "./BlogPhotoListPage.skeleton"; const ITEMS_PER_PAGE = 10; export function BlogPhotoListPageContainer(): ReactElement { + const { t } = useTranslation("blog-photos"); + const { error, data, isPending, fetchNextPage, hasNextPage } = useInfiniteQuery({ queryKey: [CacheKeysConstants.BlogPhotoList], @@ -35,7 +38,7 @@ export function BlogPhotoListPageContainer(): ReactElement { if (error) { return ( - + ); } @@ -51,7 +54,9 @@ export function BlogPhotoListPageContainer(): ReactElement { if (!data || data.pages[0].length === 0) { return ( - No photos to display + + {t("no-photos")} + ); } diff --git a/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.skeleton.tsx b/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.skeleton.tsx index 86231ddd..083a5203 100644 --- a/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.skeleton.tsx +++ b/services/web-ui/src/features/blogs/pages/BlogPhotoListPage/BlogPhotoListPage.skeleton.tsx @@ -1,11 +1,38 @@ import { ReactElement } from "react"; -import { Skeleton } from "@mui/material"; +import { Box, Skeleton } from "@mui/material"; + +const getNumElement = (num: number) => { + const arr: number[] = []; + + for (let x = 0; x < num; x++) { + arr.push(x); + } + + return arr; +}; export function BlogPhotoListPageSkeleton(): ReactElement { + const photos = [3, 1, 4, 2]; + return ( <> - + {photos.map((photo, index) => ( + + + + + {getNumElement(photo).map((v) => ( + + ))} + + + + ))} ); } diff --git a/services/web-ui/src/features/chat/pages/ChatListPage/ChatListPage.skeleton.tsx b/services/web-ui/src/features/chat/pages/ChatListPage/ChatListPage.skeleton.tsx index 9413aaa2..2e78f06f 100644 --- a/services/web-ui/src/features/chat/pages/ChatListPage/ChatListPage.skeleton.tsx +++ b/services/web-ui/src/features/chat/pages/ChatListPage/ChatListPage.skeleton.tsx @@ -1,21 +1,30 @@ import { ReactElement } from "react"; -import { List, ListItem, Skeleton } from "@mui/material"; +import { + List, + ListItem, + ListItemAvatar, + ListItemText, + Skeleton, +} from "@mui/material"; export function ChatListPageSkeleton(): ReactElement { + const items = [150, 75, 180, 140, 80, 90, 130, 210, 70]; + return ( - - - - - - - + {items.map((item) => ( + + + + - - - + } + secondary={} + /> + + ))} ); }