diff --git a/apps/mobile/package.json b/apps/mobile/package.json index 288ed5dce..5cad3bb8e 100644 --- a/apps/mobile/package.json +++ b/apps/mobile/package.json @@ -73,6 +73,7 @@ "react-hook-form": "7.54.0", "react-native": "0.76.5", "react-native-bouncy-checkbox": "4.1.2", + "react-native-color-matrix-image-filters": "^7.0.2", "react-native-context-menu-view": "1.16.0", "react-native-gesture-handler": "~2.20.2", "react-native-image-colors": "2.4.0", diff --git a/apps/mobile/src/components/ui/icon/fallback-icon.tsx b/apps/mobile/src/components/ui/icon/fallback-icon.tsx index 6071ae3cd..7131e4fdc 100644 --- a/apps/mobile/src/components/ui/icon/fallback-icon.tsx +++ b/apps/mobile/src/components/ui/icon/fallback-icon.tsx @@ -4,6 +4,7 @@ import { LinearGradient } from "expo-linear-gradient" import { useMemo, useState } from "react" import type { DimensionValue, StyleProp, TextStyle, ViewStyle } from "react-native" import { StyleSheet, Text, View } from "react-native" +import { useColor } from "react-native-uikit-colors" export const FallbackIcon = ({ title, @@ -13,6 +14,7 @@ export const FallbackIcon = ({ style, textClassName, textStyle, + gray, }: { title: string url?: string @@ -21,6 +23,7 @@ export const FallbackIcon = ({ style?: StyleProp textClassName?: string textStyle?: StyleProp + gray?: boolean }) => { const colors = useMemo(() => getBackgroundGradient(title || url || ""), [title, url]) const sizeStyle = useMemo(() => ({ width: size, height: size }), [size]) @@ -36,10 +39,14 @@ export const FallbackIcon = ({ ) }, [title, textStyle, textClassName]) + const grayColor = useColor("gray2") + return ( diff --git a/apps/mobile/src/modules/feed-drawer/view-selector.tsx b/apps/mobile/src/modules/feed-drawer/view-selector.tsx new file mode 100644 index 000000000..c775ee351 --- /dev/null +++ b/apps/mobile/src/modules/feed-drawer/view-selector.tsx @@ -0,0 +1,102 @@ +import { cn } from "@follow/utils" +import { Image } from "expo-image" +import { Stack } from "expo-router" +import { ScrollView, TouchableOpacity, View } from "react-native" +import { Grayscale } from "react-native-color-matrix-image-filters" + +import { BlurEffect } from "@/src/components/common/BlurEffect" +import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon" +import type { ViewDefinition } from "@/src/constants/views" +import { views } from "@/src/constants/views" +import { useList } from "@/src/store/list/hooks" +import { useAllListSubscription } from "@/src/store/subscription/hooks" +import { useColor } from "@/src/theme/colors" + +import { LeftAction, RightAction } from "../entry-list/action" +import { selectFeed, useSelectedFeed } from "../feed-drawer/atoms" + +export function ViewSelector() { + return ( + + ) +} + +function ViewItems() { + const lists = useAllListSubscription() + + return ( + + {views.map((view) => ( + + ))} + {lists.map((listId) => ( + + ))} + + ) +} + +function ViewItem({ view }: { view: ViewDefinition }) { + const selectedFeed = useSelectedFeed() + const isActive = selectedFeed.type === "view" && selectedFeed.viewId === view.view + + const bgColor = useColor("gray2") + + return ( + selectFeed({ type: "view", viewId: view.view })} + > + + + + + + + ) +} + +function ListItem({ listId }: { listId: string }) { + const list = useList(listId) + const selectedFeed = useSelectedFeed() + const isActive = selectedFeed.type === "list" && selectedFeed.listId === listId + + if (!list) return null + + return ( + selectFeed({ type: "list", listId })} + > + + + {list.image ? ( + isActive ? ( + + ) : ( + + + + ) + ) : ( + + )} + + + + ) +} diff --git a/apps/mobile/src/screens/(stack)/(tabs)/index.tsx b/apps/mobile/src/screens/(stack)/(tabs)/index.tsx index d0c13866e..63842b4ef 100644 --- a/apps/mobile/src/screens/(stack)/(tabs)/index.tsx +++ b/apps/mobile/src/screens/(stack)/(tabs)/index.tsx @@ -1,5 +1,11 @@ import { EntryList } from "@/src/modules/entry-list/entry-list" +import { ViewSelector } from "@/src/modules/feed-drawer/view-selector" export default function Index() { - return + return ( + <> + + + + ) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8c4a4a7e..98e532a5a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -583,6 +583,9 @@ importers: react-native-bouncy-checkbox: specifier: 4.1.2 version: 4.1.2 + react-native-color-matrix-image-filters: + specifier: ^7.0.2 + version: 7.0.2(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1) react-native-context-menu-view: specifier: 1.16.0 version: 1.16.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1) @@ -7065,6 +7068,9 @@ packages: cjs-module-lexer@1.4.1: resolution: {integrity: sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==} + clamp@1.0.1: + resolution: {integrity: sha512-kgMuFyE78OC6Dyu3Dy7vcx4uy97EIbVxJB/B0eJ3bUNAkwdNcxYzgKltnyADiYwsR7SEqkkUPsEUT//OVS6XMA==} + class-variance-authority@0.7.1: resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==} @@ -7273,6 +7279,9 @@ packages: resolution: {integrity: sha512-bQJ0YRck5ak3LgtnpKkiabX5pNF7tMUh1BSy2ZBOTh0Dim0BUu6aPPwByIns6/A5Prh8PufSPerMDUklpzes2Q==} engines: {node: '>= 0.8.0'} + concat-color-matrices@1.0.0: + resolution: {integrity: sha512-K0IMtl4m9LcHg4vVFb40Txmie/GwCJBkquGSn6wtA9yIcszzFZgGc6co4sSnjFdqeJAv+q2LrCHMUSb2GHAChA==} + concat-map@0.0.1: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} @@ -12711,6 +12720,12 @@ packages: react-native-bouncy-checkbox@4.1.2: resolution: {integrity: sha512-hB7YwCGTNoMpTPOPiP+RWyQH35S6vxUbc7IGEW/Rqyp7GonEyhtqtthmxiphneRXnywMh8CZwND7OnvppJZscg==} + react-native-color-matrix-image-filters@7.0.2: + resolution: {integrity: sha512-YwEbSbzwpD99v8KNiebLB5NymY9hPBQQJ778QN2/39YZ/tA9TbFA3M3qv4kU2qyF+Tdon6KbFOd7D7zaAXUhSA==} + peerDependencies: + react: '*' + react-native: '*' + react-native-context-menu-view@1.16.0: resolution: {integrity: sha512-zqeOAizM7MVV9o6h/quS0REQikBq3J4BkIRLFygY6RiCjr6rwuzSGkif7JRCHpAQQumSKlLqYl4N2h3AdoIHVg==} peerDependencies: @@ -13295,6 +13310,11 @@ packages: ripemd160@2.0.2: resolution: {integrity: sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==} + rn-color-matrices@4.1.0: + resolution: {integrity: sha512-a8++z3Zi4GhA0oWwKS3etdrVuVQ2q/ByTMh6lMxo+vaSv3SRSSg5SzpZk65GS0NCAqMhFT8WSvgSgNhO/F+xag==} + peerDependencies: + react-native: '*' + roarr@2.15.4: resolution: {integrity: sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==} engines: {node: '>=8.0'} @@ -14222,6 +14242,9 @@ packages: ts-pattern@5.6.0: resolution: {integrity: sha512-SL8u60X5+LoEy9tmQHWCdPc2hhb2pKI6I1tU5Jue3v8+iRqZdcT3mWPwKKJy1fMfky6uha82c8ByHAE8PMhKHw==} + ts-tiny-invariant@2.0.5: + resolution: {integrity: sha512-NGQzWRLGLMjOUTpsxMSRj63fuFBC8HV8L4NUxzDVgU4MFeOt3qFI2534M5L+ch22x53oDEwPaRBPXgAfRjcXHA==} + ts-toolbelt@6.15.5: resolution: {integrity: sha512-FZIXf1ksVyLcfr7M317jbB67XFJhOO1YqdTcuGaq9q5jLUoTikukZ+98TPjKiP2jC5CgmYdWWYs0s2nLSU0/1A==} @@ -22557,6 +22580,8 @@ snapshots: cjs-module-lexer@1.4.1: {} + clamp@1.0.1: {} + class-variance-authority@0.7.1: dependencies: clsx: 2.1.1 @@ -22764,6 +22789,10 @@ snapshots: transitivePeerDependencies: - supports-color + concat-color-matrices@1.0.0: + dependencies: + invariant: 2.2.4 + concat-map@0.0.1: {} confbox@0.1.8: {} @@ -29305,6 +29334,14 @@ snapshots: dependencies: '@freakycoder/react-native-bounceable': 1.0.3 + react-native-color-matrix-image-filters@7.0.2(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1): + dependencies: + concat-color-matrices: 1.0.0 + react: 18.3.1 + react-native: 0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1) + rn-color-matrices: 4.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)) + ts-tiny-invariant: 2.0.5 + react-native-context-menu-view@1.16.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1))(react@18.3.1): dependencies: react: 18.3.1 @@ -30036,6 +30073,11 @@ snapshots: hash-base: 3.1.0 inherits: 2.0.4 + rn-color-matrices@4.1.0(react-native@0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)): + dependencies: + clamp: 1.0.1 + react-native: 0.76.5(@babel/core@7.26.0)(@babel/preset-env@7.26.0(@babel/core@7.26.0))(@react-native-community/cli-server-api@14.1.0(bufferutil@4.0.8))(@types/react@18.3.14)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1) + roarr@2.15.4: dependencies: boolean: 3.2.0 @@ -31127,6 +31169,8 @@ snapshots: ts-pattern@5.6.0: {} + ts-tiny-invariant@2.0.5: {} + ts-toolbelt@6.15.5: {} tsconfck@3.1.4(typescript@5.7.2):