Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Use compact pills for Space post status

Anand Baburajanc67c92e4fc23
diff --git a/web/apps/space/src/components/PostUnreadBadge.tsx b/web/apps/space/src/components/PostUnreadBadge.tsx
index 9ec41984ba..ba345c240f 100644
--- a/web/apps/space/src/components/PostUnreadBadge.tsx
+++ b/web/apps/space/src/components/PostUnreadBadge.tsx
@@ -1,12 +1,11 @@
import { Box } from "@mui/material";
import React from "react";
-import { spaceTileCircleInset } from "styles/tiles";
+import { spaceTilePillInset } from "styles/tiles";
interface SpacePostBadgeProps extends React.PropsWithChildren {
backgroundColor: string;
color: string;
placement?: "center" | "top-right";
- variant?: "default" | "unread";
}
export const SpacePostBadge: React.FC<SpacePostBadgeProps> = ({
@@ -14,10 +13,9 @@ export const SpacePostBadge: React.FC<SpacePostBadgeProps> = ({
children,
color,
placement = "top-right",
- variant = "default",
}) => {
- const height = variant == "unread" || placement == "center" ? 24 : 20;
- const inset = spaceTileCircleInset(height);
+ const height = placement == "center" ? 24 : 18;
+ const inset = spaceTilePillInset(height);
return (
<Box
component="span"
@@ -54,11 +52,6 @@ export const SpacePostBadge: React.FC<SpacePostBadgeProps> = ({
top: inset,
maxWidth: `calc(100% - 2 * (${inset}))`,
}),
- ...(variant == "unread" && {
- border: "1px solid #FFFFFF",
- fontSize: 12,
- px: "6px",
- }),
}}
>
<Box
@@ -74,7 +67,7 @@ export const SpacePostBadge: React.FC<SpacePostBadgeProps> = ({
export const SpacePostUnreadBadge: React.FC<{ count: number }> = ({
count,
}) => (
- <SpacePostBadge backgroundColor="#F63A3A" color="#FFFFFF" variant="unread">
- {count}
+ <SpacePostBadge backgroundColor="#F63A3A" color="#FFFFFF">
+ {count} new
</SpacePostBadge>
);
diff --git a/web/apps/space/src/screens/HomeScreen.tsx b/web/apps/space/src/screens/HomeScreen.tsx
index 091b350ae6..c6f26e76ce 100644
--- a/web/apps/space/src/screens/HomeScreen.tsx
+++ b/web/apps/space/src/screens/HomeScreen.tsx
@@ -637,7 +637,19 @@ export const FriendPostTile: React.FC<FriendPostTileProps> = ({
Unavailable
</SpacePostBadge>
)}
- {!isRead && <SpacePostUnreadBadge count={posts.length} />}
+ {!isLoading &&
+ post &&
+ !postUnavailable &&
+ (isRead ? (
+ <SpacePostBadge
+ backgroundColor={tileBadgeBackground}
+ color={textBase}
+ >
+ Seen
+ </SpacePostBadge>
+ ) : (
+ <SpacePostUnreadBadge count={posts.length} />
+ ))}
</Box>
{friendRequestDirection != "received" &&
!isAvatarPending &&
diff --git a/web/apps/space/src/styles/tiles.ts b/web/apps/space/src/styles/tiles.ts
index e9bcca13d8..78bcd2caef 100644
--- a/web/apps/space/src/styles/tiles.ts
+++ b/web/apps/space/src/styles/tiles.ts
@@ -14,3 +14,6 @@ export const spaceTileInnerRadius =
export const spaceTileCircleInset = (diameter: number) =>
`max(var(--space-tile-padding), calc(var(--space-tile-radius) - ${diameter / 2}px))`;
+
+export const spaceTilePillInset = (height: number) =>
+ `calc(var(--space-tile-padding) + max(0px, ${spaceTileInnerRadius} - ${height / 2}px) * ${1 - Math.SQRT1_2})`;