Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refine Space posting controls and message previews

Anand Baburajan90e605d29117
diff --git a/web/apps/space/src/components/AddFriendTile.tsx b/web/apps/space/src/components/AddFriendTile.tsx
index 9b14b3da35..2a66b14dfc 100644
--- a/web/apps/space/src/components/AddFriendTile.tsx
+++ b/web/apps/space/src/components/AddFriendTile.tsx
@@ -122,7 +122,7 @@ export const SpaceAddFriendTile: React.FC<SpaceAddFriendTileProps> = ({
sx={{
alignItems: "center",
appearance: "none",
- bgcolor: spaceSurface,
+ bgcolor: "#303034",
border: 0,
borderRadius: "inherit",
color: "#65656D",
diff --git a/web/apps/space/src/components/HomeHeader.tsx b/web/apps/space/src/components/HomeHeader.tsx
index 5c39b1c9ad..23cb0f3250 100644
--- a/web/apps/space/src/components/HomeHeader.tsx
+++ b/web/apps/space/src/components/HomeHeader.tsx
@@ -65,7 +65,7 @@ export const SpaceHomeHeader: React.FC<SpaceHomeHeaderProps> = ({
zIndex: 4,
"&::after": {
bgcolor: spaceSurface,
- borderRadius: "999px",
+ borderRadius: "12px",
content: '""',
height: spaceHomeHeaderBarHeight,
left: "16px",
diff --git a/web/apps/space/src/components/NewPostButton.tsx b/web/apps/space/src/components/NewPostButton.tsx
index 575b4204ab..5484d390b3 100644
--- a/web/apps/space/src/components/NewPostButton.tsx
+++ b/web/apps/space/src/components/NewPostButton.tsx
@@ -6,47 +6,71 @@ import { useSpaceAppState } from "state/app-state";
const green = "#08C225";
-export const spaceNewPostButtonSize = 28;
-export const spaceNewPostButtonRadius = spaceNewPostButtonSize / 2;
+export const spaceNewPostButtonSize = 44;
+export const spaceNewPostButtonRadius = 12;
export const SpaceNewPostButton: React.FC<{
isDisabled?: boolean;
+ label?: string;
onClick: () => void;
-}> = ({ isDisabled = false, onClick }) => {
+}> = ({ isDisabled = false, label, onClick }) => {
const { postPublication } = useSpaceAppState();
const disabled = isDisabled || postPublication?.phase == "posting";
return (
<Box
- className="green-bg"
component="button"
type="button"
- aria-label="New post"
+ aria-label={label ?? "New post"}
disabled={disabled}
onClick={onClick}
sx={{
alignItems: "center",
appearance: "none",
- bgcolor: green,
+ bgcolor: "#232326",
border: 0,
borderRadius: `${spaceNewPostButtonRadius}px`,
color: "#FFFFFF",
cursor: disabled ? "default" : "pointer",
display: "flex",
flexShrink: 0,
+ font: "inherit",
+ fontSize: 12,
height: spaceNewPostButtonSize,
justifyContent: "center",
+ lineHeight: "18px",
opacity: disabled ? 0.6 : 1,
p: 0,
- width: spaceNewPostButtonSize,
- "&:hover:not(:disabled)": { bgcolor: "#07B422" },
+ "&:hover:not(:disabled) .green-bg": {
+ filter: "brightness(0.96)",
+ },
"&:focus-visible": {
outline: `2px solid ${green}`,
outlineOffset: 3,
},
}}
>
- <HugeiconsIcon icon={Add01Icon} size={20} strokeWidth={2} />
+ {label && (
+ <Box component="span" sx={{ px: "16px", whiteSpace: "nowrap" }}>
+ {label}
+ </Box>
+ )}
+ <Box
+ className="green-bg"
+ component="span"
+ sx={{
+ alignItems: "center",
+ bgcolor: green,
+ borderRadius: "inherit",
+ display: "flex",
+ flexShrink: 0,
+ height: "100%",
+ justifyContent: "center",
+ width: spaceNewPostButtonSize,
+ }}
+ >
+ <HugeiconsIcon icon={Add01Icon} size={20} strokeWidth={2} />
+ </Box>
</Box>
);
};
diff --git a/web/apps/space/src/components/OwnPostTile.tsx b/web/apps/space/src/components/OwnPostTile.tsx
index e300345655..c305e99a6a 100644
--- a/web/apps/space/src/components/OwnPostTile.tsx
+++ b/web/apps/space/src/components/OwnPostTile.tsx
@@ -1,22 +1,14 @@
-import { Image01Icon } from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
import { Box, Skeleton } from "@mui/material";
import { spaceHomeHeaderBarHeight } from "components/HomeHeader";
import {
SpaceNewPostButton,
- spaceNewPostButtonRadius,
spaceNewPostButtonSize,
} from "components/NewPostButton";
import log from "ente-base/log";
import React from "react";
import type { SpacePost, SpacePostAssetURLLoader } from "services/space";
import { useSpaceAppState, type SpacePostPublishPhase } from "state/app-state";
-import {
- spaceSurface,
- spaceSurfaceHover,
- spaceText,
- spaceTextMuted,
-} from "styles/colors";
+import { spaceSurfaceHover, spaceText, spaceTextMuted } from "styles/colors";
import { formatSpaceDate } from "utils/display";
import { thumbHashDataURLFromBase64 } from "utils/thumbhash";
@@ -24,7 +16,6 @@ const green = "#08C225";
const groupInset = 8;
const groupGap = groupInset * 1.5;
const groupHeight = spaceHomeHeaderBarHeight;
-const groupRadius = groupHeight / 2;
const PostTimestamp: React.FC<{
timestampMs: number;
@@ -87,7 +78,15 @@ const PostTimestamp: React.FC<{
</time>
)}
{status == "posting" && (
- <Box component="span" aria-hidden>
+ <Box
+ component="span"
+ aria-hidden
+ sx={{
+ display: "inline-block",
+ textAlign: "left",
+ width: "1em",
+ }}
+ >
{".".repeat((Math.floor(now / 500) % 3) + 1)}
</Box>
)}
@@ -177,151 +176,147 @@ export const SpaceOwnPostTile: React.FC<SpaceOwnPostTileProps> = ({
aria-label="Your latest post"
sx={{
alignItems: "center",
- bgcolor: spaceSurface,
- borderRadius: `${groupRadius}px`,
boxSizing: "border-box",
display: "flex",
flexShrink: 0,
fontFamily: '"Inter Variable", Inter, sans-serif',
gap: `${groupGap}px`,
height: groupHeight,
+ justifyContent: isEmpty ? "flex-end" : "space-between",
minWidth: 0,
- p: `${groupInset}px`,
"& .MuiSkeleton-root": {
visibility: showSkeleton ? "visible" : "hidden",
},
}}
>
- <Box
- component="button"
- type="button"
- aria-label="Open your posts"
- disabled={!canOpenPost}
- onClick={onOpenPost}
- sx={{
- alignItems: "center",
- appearance: "none",
- bgcolor: "transparent",
- border: 0,
- borderRadius: `${spaceNewPostButtonRadius}px`,
- color: spaceText,
- cursor: canOpenPost ? "pointer" : "default",
- display: "flex",
- flex: 1,
- font: "inherit",
- gap: `${groupGap}px`,
- minWidth: 0,
- p: 0,
- textAlign: "left",
- "&:focus-visible": {
- outline: `2px solid ${green}`,
- outlineOffset: 2,
- },
- }}
- >
+ {!isEmpty && (
<Box
- component="span"
+ component="button"
+ type="button"
+ aria-label="Open your posts"
+ disabled={!canOpenPost}
+ onClick={onOpenPost}
sx={{
- bgcolor: spaceSurfaceHover,
- borderRadius: `${spaceNewPostButtonRadius}px`,
- display: "grid",
+ alignItems: "center",
+ appearance: "none",
+ bgcolor: "#232326",
+ border: 0,
+ borderRadius: "12px",
+ color: spaceText,
+ cursor: canOpenPost ? "pointer" : "default",
+ display: "flex",
flexShrink: 0,
- height: spaceNewPostButtonSize,
- overflow: "hidden",
- placeItems: "center",
- position: "relative",
- width: spaceNewPostButtonSize,
- }}
- >
- {isEmpty && (
- <HugeiconsIcon
- icon={Image01Icon}
- size={18}
- strokeWidth={1.6}
- color={spaceTextMuted}
- aria-hidden
- />
- )}
- {thumbHashDataURL && !unavailable && (
- <Box
- component="img"
- alt=""
- src={thumbHashDataURL}
- sx={{
- filter: "blur(8px)",
- height: "100%",
- inset: 0,
- objectFit: "cover",
- position: "absolute",
- transform: "scale(1.08)",
- width: "100%",
- }}
- />
- )}
- {imageUrl && !unavailable ? (
- <Box
- component="img"
- alt=""
- src={imageUrl}
- onError={() =>
- post && setLoadedImage({ post, failed: true })
- }
- sx={{
- display: "block",
- height: "100%",
- objectFit: "cover",
- position: "relative",
- width: "100%",
- }}
- />
- ) : loading && !thumbHashDataURL ? (
- <Skeleton
- variant="rectangular"
- sx={{ height: "100%", width: "100%" }}
- />
- ) : null}
- </Box>
- <Box
- component="span"
- sx={{
- display: "grid",
- flex: 1,
+ font: "inherit",
+ height: "100%",
minWidth: 0,
- placeItems: "center",
+ p: 0,
+ textAlign: "left",
+ "&:focus-visible": {
+ outline: `2px solid ${green}`,
+ outlineOffset: 2,
+ },
}}
>
- {post ? (
- <PostTimestamp
- timestampMs={post.timestampMs}
- phase={publishPhase}
- expiresAtMs={postPublication?.statusExpiresAtMs}
- />
- ) : loading ? (
- <Skeleton
- width={72}
- sx={{ fontSize: 12, lineHeight: "18px" }}
- />
- ) : (
- <Box
- component="span"
- sx={{
- color: isEmpty ? spaceText : spaceTextMuted,
- display: "block",
- fontSize: 12,
- fontWeight: 400,
- lineHeight: "18px",
- whiteSpace: "nowrap",
- }}
- >
- {unavailable
- ? "Post unavailable"
- : "Share your first post."}
- </Box>
- )}
+ <Box
+ component="span"
+ sx={{
+ bgcolor: spaceSurfaceHover,
+ borderRadius: "inherit",
+ display: "grid",
+ flexShrink: 0,
+ height: spaceNewPostButtonSize,
+ overflow: "hidden",
+ placeItems: "center",
+ position: "relative",
+ width: spaceNewPostButtonSize,
+ }}
+ >
+ {thumbHashDataURL && !unavailable && (
+ <Box
+ component="img"
+ alt=""
+ src={thumbHashDataURL}
+ sx={{
+ filter: "blur(8px)",
+ height: "100%",
+ inset: 0,
+ objectFit: "cover",
+ position: "absolute",
+ transform: "scale(1.08)",
+ width: "100%",
+ }}
+ />
+ )}
+ {imageUrl && !unavailable ? (
+ <Box
+ component="img"
+ alt=""
+ src={imageUrl}
+ onError={() =>
+ post &&
+ setLoadedImage({ post, failed: true })
+ }
+ sx={{
+ display: "block",
+ height: "100%",
+ objectFit: "cover",
+ position: "relative",
+ width: "100%",
+ }}
+ />
+ ) : loading && !thumbHashDataURL ? (
+ <Skeleton
+ variant="rectangular"
+ sx={{ height: "100%", width: "100%" }}
+ />
+ ) : null}
+ </Box>
+ <Box
+ component="span"
+ sx={{
+ boxSizing: "border-box",
+ display: "grid",
+ flexShrink: 0,
+ height: "100%",
+ minWidth: 0,
+ px: `${groupGap}px`,
+ py: `${groupInset}px`,
+ placeItems: "center start",
+ textAlign: "left",
+ }}
+ >
+ {post ? (
+ <PostTimestamp
+ timestampMs={post.timestampMs}
+ phase={publishPhase}
+ expiresAtMs={postPublication?.statusExpiresAtMs}
+ />
+ ) : loading ? (
+ <Skeleton
+ width={72}
+ sx={{ fontSize: 12, lineHeight: "18px" }}
+ />
+ ) : (
+ <Box
+ component="span"
+ sx={{
+ color: spaceTextMuted,
+ display: "block",
+ fontSize: 12,
+ fontWeight: 400,
+ lineHeight: "18px",
+ whiteSpace: "nowrap",
+ }}
+ >
+ Post unavailable
+ </Box>
+ )}
+ </Box>
</Box>
- </Box>
+ )}
<SpaceNewPostButton
isDisabled={isNewPostDisabled}
+ label={isEmpty ? "Share your first photo" : undefined}
onClick={onNewPost}
/>
</Box>
diff --git a/web/apps/space/src/components/PostFloatingActionButton.tsx b/web/apps/space/src/components/PostFloatingActionButton.tsx
index 6458ec0295..703a0d3de8 100644
--- a/web/apps/space/src/components/PostFloatingActionButton.tsx
+++ b/web/apps/space/src/components/PostFloatingActionButton.tsx
@@ -28,7 +28,7 @@ export const SpacePostFloatingActionButton: React.FC<
appearance: "none",
bgcolor: green,
border: 0,
- borderRadius: "50%",
+ borderRadius: "12px",
bottom: "calc(env(safe-area-inset-bottom) + 16px)",
boxShadow: "0 10px 24px rgba(0, 0, 0, 0.22)",
color: "#FFFFFF",
diff --git a/web/apps/space/src/screens/MessagesScreen.tsx b/web/apps/space/src/screens/MessagesScreen.tsx
index fc1a294ba0..02f4887378 100644
--- a/web/apps/space/src/screens/MessagesScreen.tsx
+++ b/web/apps/space/src/screens/MessagesScreen.tsx
@@ -1300,7 +1300,7 @@ const PostQuotePreview: React.FC<{
appearance: "none",
bgcolor: "transparent",
border: 0,
- borderRadius: "20%",
+ borderRadius: "28px",
color: "inherit",
cursor: canOpen ? "pointer" : "default",
display: "inline-flex",