π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Show spinner while space profile posts load
Anand Baburajanba6df8f5fca5
diff --git a/web/apps/space/src/pages/app/friends/[spaceId].tsx b/web/apps/space/src/pages/app/friends/[spaceId].tsxindex 050d5fbea9..cd1e67a167 100644--- a/web/apps/space/src/pages/app/friends/[spaceId].tsx+++ b/web/apps/space/src/pages/app/friends/[spaceId].tsx@@ -215,7 +215,7 @@ const Page: React.FC = () => {onLoadPostImage={loadCurrentSpacePostAssetURL}onReplyToPost={replyToCurrentPost}onSetPostLiked={setCurrentPostLiked}- showPostLoadingSkeleton={false}+ showPostLoadingIndicator={false}/></>);diff --git a/web/apps/space/src/pages/app/profile.tsx b/web/apps/space/src/pages/app/profile.tsxindex 3ad73d6468..8b4a635628 100644--- a/web/apps/space/src/pages/app/profile.tsx+++ b/web/apps/space/src/pages/app/profile.tsx@@ -23,7 +23,7 @@ import { prepareSpacePostImageFromEdit } from "utils/spacePostImage";import { spaceRoutes } from "utils/spaceRoutes";import { useSpaceRouter } from "utils/spaceRouteTransitions";-const initialPostSkeletonDelayMs = 350;+const initialPostLoadingIndicatorDelayMs = 350;const Page: React.FC = () => {const router = useSpaceRouter();@@ -32,8 +32,10 @@ const Page: React.FC = () => {const [friendsCount, setFriendsCount] = useState(0);const [posts, setPosts] = useState<SpaceProfilePost[]>([]);const [isPostsLoading, setIsPostsLoading] = useState(true);- const [showInitialPostSkeleton, setShowInitialPostSkeleton] =- useState(false);+ const [+ showInitialPostLoadingIndicator,+ setShowInitialPostLoadingIndicator,+ ] = useState(false);const postGroups = useMemo(() => profilePostGroupsFromPosts(posts),[posts],@@ -85,13 +87,13 @@ const Page: React.FC = () => {useEffect(() => {if (!isInitialPostsLoading) {- setShowInitialPostSkeleton(false);+ setShowInitialPostLoadingIndicator(false);return;}const timeoutID = window.setTimeout(- () => setShowInitialPostSkeleton(true),- initialPostSkeletonDelayMs,+ () => setShowInitialPostLoadingIndicator(true),+ initialPostLoadingIndicatorDelayMs,);return () => window.clearTimeout(timeoutID);}, [isInitialPostsLoading]);@@ -114,7 +116,7 @@ const Page: React.FC = () => {isStatsLoading={isPostsLoading}postGroups={postGroups}profile={profile}- showPostLoadingSkeleton={showInitialPostSkeleton}+ showPostLoadingIndicator={showInitialPostLoadingIndicator}onBack={() => void router.push(spaceRoutes.home)}onCreatePost={async (image, caption) => {const spaceId = profile.spaceId;diff --git a/web/apps/space/src/screens/ProfileScreen.tsx b/web/apps/space/src/screens/ProfileScreen.tsxindex 2511579e55..66e1a3f569 100644--- a/web/apps/space/src/screens/ProfileScreen.tsx+++ b/web/apps/space/src/screens/ProfileScreen.tsx@@ -4,7 +4,7 @@ import {Menu01Icon,} from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";-import { Box, Skeleton } from "@mui/material";+import { Box, CircularProgress, Skeleton } from "@mui/material";import { SpaceAvatarImage } from "components/SpaceAvatarImage";import {SpaceFileViewer,@@ -50,7 +50,6 @@ const photoMasonryGap = "3px";const photoMasonryPlaceholderBackground = "#F2F2F2";const photoMasonryRadius = "12px";const photoMasonryLoadRootMargin = "800px 0px";-const profilePostSkeletonAspectRatios = [1.18, 0.82, 1.45];interface ProfilePhotoDimensions {height: number;width: number;@@ -204,53 +203,20 @@ const ProfileStatsSkeleton: React.FC = () => (</Box>);-const ProfilePostLoadingSkeletons: React.FC = () => (+const ProfilePostLoadingIndicator: React.FC = () => (<Boxrole="status"aria-label="Loading posts"sx={{+ alignItems: "center",display: "flex",- flexDirection: "column",- gap: "10px",+ justifyContent: "center",+ minHeight: 144,mx: "16px",width: "calc(100% - 32px)",}}>- <Skeleton- variant="rectangular"- sx={{- bgcolor: photoMasonryPlaceholderBackground,- borderRadius: "999px",- height: 12,- mx: "2px",- width: 72,- }}- />- <Box- sx={{- borderRadius: photoMasonryRadius,- display: "flex",- flexDirection: "column",- gap: photoMasonryGap,- overflow: "hidden",- width: "100%",- }}- >- {profilePostSkeletonAspectRatios.map((aspectRatio, index) => (- <Skeleton- key={index}- variant="rectangular"- sx={{- aspectRatio,- bgcolor: photoMasonryPlaceholderBackground,- display: "block",- height: "auto",- transform: "none",- width: "100%",- }}- />- ))}- </Box>+ <CircularProgress size={26} thickness={4} sx={{ color: green }} /></Box>);@@ -389,7 +355,7 @@ interface ProfileScreenProps {isCoverLoading?: boolean;isPostsLoading?: boolean;isStatsLoading?: boolean;- showPostLoadingSkeleton?: boolean;+ showPostLoadingIndicator?: boolean;onAddFriend?: () => void;onBack?: () => void;onCreatePost?: (@@ -432,7 +398,7 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({onShareProfileLink,postGroups = [],profile,- showPostLoadingSkeleton,+ showPostLoadingIndicator,spaceLogoHref = "https://ente.com/space",}) => {const [selectedPost, setSelectedPost] =@@ -484,9 +450,10 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({const canOpenProfileCover = isOwnerProfile && Boolean(onOpenProfileCover);const canOpenProfilePhoto = isOwnerProfile && Boolean(onOpenProfilePhoto);const hasProfilePosts = postsSharedCount > 0;- const shouldShowPostLoadingSkeleton =- isPostsLoading && (showPostLoadingSkeleton ?? true);- const shouldShowPostGrid = hasProfilePosts || shouldShowPostLoadingSkeleton;+ const shouldShowPostLoadingIndicator =+ isPostsLoading && (showPostLoadingIndicator ?? true);+ const shouldShowPostGrid =+ hasProfilePosts || shouldShowPostLoadingIndicator;const isCoverImageLoading = Boolean(coverUrl && loadedCoverUrl != coverUrl);const shouldShowCoverSkeleton =isCoverLoading || isCoverURLPending || isCoverImageLoading;@@ -1534,8 +1501,8 @@ export const ProfileScreen: React.FC<ProfileScreenProps> = ({</Box>);})- ) : shouldShowPostLoadingSkeleton ? (- <ProfilePostLoadingSkeletons />+ ) : shouldShowPostLoadingIndicator ? (+ <ProfilePostLoadingIndicator />) : isPostsLoading ? null : (<Boxsx={{