···
1
+
import { Text } from "@/components/primitives/Text";
2
+
import { useFacet } from "@/lib/facet";
3
+
import type { AtUri } from "@/lib/types/atproto";
4
+
import type { SystemsGmstnDevelopmentChannel } from "@/lib/types/lexicon/systems.gmstn.development.channels";
5
+
import { useCurrentPalette } from "@/providers/ThemeProvider";
6
+
import { Link, usePathname } from "expo-router";
7
+
import { Hash } from "lucide-react-native";
8
+
import { useState } from "react";
9
+
import { View } from "react-native";
10
+
import { Pressable } from "react-native-gesture-handler";
12
+
export const ChannelPickerItem = ({
16
+
channel: SystemsGmstnDevelopmentChannel;
17
+
channelAtUri: AtUri;
19
+
const { semantic, colors } = useCurrentPalette();
20
+
const { typography, atoms } = useFacet();
21
+
const path = usePathname();
22
+
const [hovered, setHovered] = useState(false);
24
+
const { authority, collection, rKey } = channelAtUri;
26
+
if (!collection || !rKey)
28
+
"Channel at:// URI object provided to channel picker item must contain a collection and rkey fields.",
31
+
const pathRKey = path.split("/")[3];
33
+
const isCurrentChannel = pathRKey === rKey;
35
+
const hoverHandler = () => {
36
+
setHovered((hovered) => !hovered);
40
+
<Pressable onHoverIn={hoverHandler} onHoverOut={hoverHandler}>
41
+
<Link href={`/${authority}/channel/${rKey}`}>
45
+
flexDirection: "row",
46
+
alignItems: "center",
53
+
isCurrentChannel || hovered
56
+
borderRadius: atoms.radii.lg,
65
+
isCurrentChannel ? colors.subtext0 : colors.overlay2
71
+
color: isCurrentChannel
75
+
typography.sizes.sm,