frontend client for gemstone. decentralised workplace app

feat: chat message styling

serenity 7ee4af66 e73bbb9a

Changed files
+44 -17
src
components
Chat
Profile
+42 -16
src/components/Chat/Message.tsx
···
import { Text } from "@/components/primitives/Text";
import { Avatar } from "@/components/Profile/Avatar";
+
import { Name } from "@/components/Profile/Name";
+
import { useFacet } from "@/lib/facet";
import type { ShardMessage } from "@/lib/types/messages";
+
import { useCurrentPalette } from "@/providers/ThemeProvider";
+
import { format } from "date-fns";
import { View } from "react-native";
export const Message = ({ message }: { message: ShardMessage }) => {
+
const { typography } = useFacet();
+
const { semantic } = useCurrentPalette()
+
+
const sentAtString = format(new Date(message.sentAt), "h:mm aaa");
+
return (
<View
style={{
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
-
alignItems: "flex-end",
+
alignItems: "flex-start",
}}
>
<Avatar did={message.sentBy} />
<View
style={{
-
marginBottom: 12,
-
padding: 12,
+
paddingLeft: 12,
borderRadius: 8,
}}
>
-
<Text
+
<View
style={{
-
fontSize: 16,
-
marginBottom: 4,
-
}}
-
>
-
{message.content}
-
</Text>
-
<Text
-
style={{
-
fontSize: 12,
-
color: "#666",
+
flex: 1,
+
flexDirection: "row",
+
alignItems: "center",
+
gap: 4,
}}
>
-
{new Date(message.sentAt).toLocaleTimeString()}
-
</Text>
+
<Name did={message.sentBy} />
+
<Text
+
style={{
+
fontSize: 12,
+
color: semantic.textTertiary,
+
}}
+
>
+
{sentAtString}
+
</Text>
+
</View>
+
<View>
+
<Text
+
style={[
+
{
+
marginBottom: 4,
+
},
+
// @ts-expect-error it's fiiiiiiine
+
{
+
fontWeight: typography.weights.extralight,
+
},
+
typography.sizes.sm,
+
]}
+
>
+
{message.content}
+
</Text>
+
</View>
</View>
</View>
);
+2 -1
src/components/Profile/Name.tsx
···
) : (
profile && (
<Text
-
style={{ fontWeight: typography.weights.extralight.toString() }}
+
// @ts-expect-error it's fiiiiiiiine
+
style={{ fontWeight: typography.weights.normal }}
>
{profile.displayName ?? profile.handle}
</Text>