diff --git a/apps/mobile/src/components/common/AnimatedComponents.tsx b/apps/mobile/src/components/common/AnimatedComponents.tsx index b2f444054..2224c8f2f 100644 --- a/apps/mobile/src/components/common/AnimatedComponents.tsx +++ b/apps/mobile/src/components/common/AnimatedComponents.tsx @@ -1,5 +1,8 @@ -import { Animated, FlatList, ScrollView, TouchableOpacity } from "react-native" +import { Animated, FlatList, Pressable, ScrollView, TouchableOpacity } from "react-native" +import Reanimated from "react-native-reanimated" export const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView) export const AnimatedFlatList = Animated.createAnimatedComponent(FlatList) export const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity) + +export const ReAnimatedPressable = Reanimated.createAnimatedComponent(Pressable) diff --git a/apps/mobile/src/components/ui/form/Select.tsx b/apps/mobile/src/components/ui/form/Select.tsx index 0f2798fd0..d2810a1ec 100644 --- a/apps/mobile/src/components/ui/form/Select.tsx +++ b/apps/mobile/src/components/ui/form/Select.tsx @@ -6,7 +6,7 @@ import ContextMenu from "react-native-context-menu-view" import { useEventCallback } from "usehooks-ts" import { MingcuteDownLineIcon } from "@/src/icons/mingcute_down_line" -import { useColor } from "@/src/theme/colors" +import { accentColor } from "@/src/theme/colors" import { FormLabel } from "./Label" @@ -52,11 +52,9 @@ export function Select({ onValueChange(currentValue) }, []) - const systemFill = useColor("text") - return ( - {!!label && } + {!!label && } {/* Trigger */} ({ > - {valueToLabelMap.get(currentValue)} - - + {valueToLabelMap.get(currentValue)} + + diff --git a/apps/mobile/src/components/ui/form/Switch.tsx b/apps/mobile/src/components/ui/form/Switch.tsx index bfb706ca1..7d179faef 100644 --- a/apps/mobile/src/components/ui/form/Switch.tsx +++ b/apps/mobile/src/components/ui/form/Switch.tsx @@ -21,7 +21,7 @@ export const FormSwitch = forwardRef( {!!label && } {!!description && ( - {description} + {description} )} diff --git a/apps/mobile/src/components/ui/form/TextField.tsx b/apps/mobile/src/components/ui/form/TextField.tsx index 0e9e7f5ac..00ef62123 100644 --- a/apps/mobile/src/components/ui/form/TextField.tsx +++ b/apps/mobile/src/components/ui/form/TextField.tsx @@ -23,15 +23,13 @@ export const TextField = forwardRef( ) => { return ( <> - {!!label && } + {!!label && } {!!description && ( - - {description} - + {description} )} ( diff --git a/apps/mobile/src/components/ui/pressable/item-pressable.tsx b/apps/mobile/src/components/ui/pressable/item-pressable.tsx index e614596ee..e507c2846 100644 --- a/apps/mobile/src/components/ui/pressable/item-pressable.tsx +++ b/apps/mobile/src/components/ui/pressable/item-pressable.tsx @@ -1,22 +1,61 @@ import { cn, composeEventHandlers } from "@follow/utils" -import { memo, useState } from "react" -import { Pressable } from "react-native" +import { memo, useEffect, useState } from "react" +import type { Pressable } from "react-native" +import { StyleSheet } from "react-native" +import { + Easing, + interpolateColor, + useAnimatedStyle, + useSharedValue, + withTiming, +} from "react-native-reanimated" + +import { useColor } from "@/src/theme/colors" + +import { ReAnimatedPressable } from "../../common/AnimatedComponents" export const ItemPressable: typeof Pressable = memo(({ children, ...props }) => { const [isPressing, setIsPressing] = useState(false) + + const secondarySystemGroupedBackground = useColor("secondarySystemGroupedBackground") + + const systemFill = useColor("systemFill") + const pressed = useSharedValue(0) + + useEffect(() => { + if (isPressing) { + pressed.value = 1 + } else { + pressed.value = withTiming(0, { + duration: 300, + easing: Easing.ease, + }) + } + }, [isPressing, pressed]) + + const colorStyle = useAnimatedStyle(() => { + return { + backgroundColor: interpolateColor( + pressed.value, + [0, 1], + [secondarySystemGroupedBackground, systemFill], + ), + } + }) return ( - setIsPressing(true))} onPressOut={composeEventHandlers(props.onPressOut, () => setIsPressing(false))} onHoverIn={composeEventHandlers(props.onHoverIn, () => setIsPressing(true))} onHoverOut={composeEventHandlers(props.onHoverOut, () => setIsPressing(false))} className={cn( - isPressing ? "bg-tertiary-system-background" : "bg-system-background", + // isPressing ? "bg-system-fill" : "bg-secondary-system-grouped-background", props.className, )} + style={StyleSheet.flatten([colorStyle, props.style])} > {children} - + ) }) diff --git a/apps/mobile/src/modules/discover/Recommendations.tsx b/apps/mobile/src/modules/discover/Recommendations.tsx index 53ea8bf95..c10629018 100644 --- a/apps/mobile/src/modules/discover/Recommendations.tsx +++ b/apps/mobile/src/modules/discover/Recommendations.tsx @@ -176,7 +176,7 @@ const ItemRenderer = ({ if (typeof item === "string") { // Rendering header return ( - + {item} ) @@ -256,7 +256,7 @@ const NavigationSidebar: FC<{ scrollToLetter(title) }} > - {title} + {title} ))} diff --git a/apps/mobile/src/modules/discover/search.tsx b/apps/mobile/src/modules/discover/search.tsx index 2d29d0d12..4aa7e0b52 100644 --- a/apps/mobile/src/modules/discover/search.tsx +++ b/apps/mobile/src/modules/discover/search.tsx @@ -66,11 +66,11 @@ const DiscoverHeaderImpl = () => { } const PlaceholerSearchBar = () => { - const placeholderTextColor = useColor("placeholderText") + const labelColor = useColor("secondaryLabel") return ( { router.push("/search") }} @@ -79,8 +79,8 @@ const PlaceholerSearchBar = () => { className="absolute inset-0 flex flex-row items-center justify-center" pointerEvents="none" > - - + + Search @@ -116,7 +116,7 @@ const ComposeSearchBar = () => { const SearchInput = () => { const { searchFocusedAtom, searchValueAtom } = useSearchPageContext() const [isFocused, setIsFocused] = useAtom(searchFocusedAtom) - const placeholderTextColor = useColor("placeholderText") + const placeholderTextColor = useColor("secondaryLabel") const searchValue = useAtomValue(searchValueAtom) const setSearchValue = useSetAtom(searchValueAtom) const inputRef = useRef(null) @@ -183,7 +183,7 @@ const SearchInput = () => { }, [isFocused]) return ( - + {focusOrHasValue && ( { > {!searchValue && !tempSearchValue && ( - + Search )} @@ -228,7 +228,7 @@ const SearchInput = () => { pointerEvents="none" > - + Search diff --git a/apps/mobile/src/modules/subscription/CategoryGrouped.tsx b/apps/mobile/src/modules/subscription/CategoryGrouped.tsx index 17e0c84b3..007326276 100644 --- a/apps/mobile/src/modules/subscription/CategoryGrouped.tsx +++ b/apps/mobile/src/modules/subscription/CategoryGrouped.tsx @@ -1,13 +1,15 @@ import { memo, useState } from "react" -import { Text, TouchableOpacity, View } from "react-native" +import { Text, TouchableOpacity } from "react-native" import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated" import { ItemPressable } from "@/src/components/ui/pressable/item-pressable" import { MingcuteRightLine } from "@/src/icons/mingcute_right_line" import { useUnreadCounts } from "@/src/store/unread/hooks" +import { useColor } from "@/src/theme/colors" import { SubscriptionFeedCategoryContextMenu } from "../context-menu/feeds" import { GroupedContext, useViewPageCurrentView } from "./ctx" +import { ItemSeparator } from "./ItemSeparator" import { UnGroupedList } from "./UnGroupedList" // const CategoryList: FC<{ @@ -30,6 +32,7 @@ export const CategoryGrouped = memo( }, [rotateSharedValue]) const view = useViewPageCurrentView() + const tertiaryLabelColor = useColor("tertiaryLabel") return ( <> { // TODO navigate to category }} - className="border-item-pressed h-12 flex-row items-center border-b px-3" + className="h-12 flex-row items-center px-3" > - + {category} {!!unreadCounts && ( - {unreadCounts} + {unreadCounts} )} {expanded && ( - - - + + )} diff --git a/apps/mobile/src/modules/subscription/ItemSeparator.tsx b/apps/mobile/src/modules/subscription/ItemSeparator.tsx new file mode 100644 index 000000000..d96b44a8c --- /dev/null +++ b/apps/mobile/src/modules/subscription/ItemSeparator.tsx @@ -0,0 +1,8 @@ +import { StyleSheet, View } from "react-native" + +const el = ( + +) +export const ItemSeparator = () => { + return el +} diff --git a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx index a353c8620..467f82bfa 100644 --- a/apps/mobile/src/modules/subscription/SubscriptionLists.tsx +++ b/apps/mobile/src/modules/subscription/SubscriptionLists.tsx @@ -3,7 +3,7 @@ import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs" import { useHeaderHeight } from "@react-navigation/elements" import { useAtom } from "jotai" import { memo, useEffect, useMemo, useRef, useState } from "react" -import { RefreshControl, StyleSheet, Text, View } from "react-native" +import { FlatList, RefreshControl, StyleSheet, Text, View } from "react-native" import PagerView from "react-native-pager-view" import ReAnimated, { LinearTransition } from "react-native-reanimated" import { useSafeAreaInsets } from "react-native-safe-area-context" @@ -29,6 +29,7 @@ import { useViewPageCurrentView, ViewPageCurrentViewProvider } from "./ctx" import { InboxItem } from "./items/InboxItem" import { ListSubscriptionItem } from "./items/ListSubscriptionItem" import { SubscriptionItem } from "./items/SubscriptionItem" +import { ItemSeparator } from "./ItemSeparator" export const SubscriptionLists = memo(() => { const [currentView, setCurrentView] = useAtom(viewAtom) @@ -112,6 +113,7 @@ const SubscriptionList = ({ view }: { view: FeedViewType }) => { refreshing={refreshing} /> } + className={"bg-system-grouped-background"} contentInsetAdjustmentBehavior="automatic" scrollIndicatorInsets={{ bottom: tabHeight - insets.bottom, @@ -121,6 +123,7 @@ const SubscriptionList = ({ view }: { view: FeedViewType }) => { paddingTop: offsetTop, paddingBottom: tabHeight, }} + ItemSeparatorComponent={ItemSeparator} data={data} ListHeaderComponent={ListHeaderComponent} renderItem={ItemRender} @@ -165,7 +168,7 @@ const ListHeaderComponent = () => { {view === FeedViewType.Articles && } - Feeds + Feeds ) } @@ -175,13 +178,17 @@ const InboxList = () => { if (inboxes.length === 0) return null return ( - Inboxes - {inboxes.map((id) => { - return - })} + Inboxes + + ) } +const renderInboxItems = ({ item }: { item: string }) => const StarItem = () => { return ( @@ -204,13 +211,19 @@ const ListList = () => { if (sortedListIds.length === 0) return null return ( - Lists - {sortedListIds.map((id) => { + Lists + {/* {sortedListIds.map((id) => { return - })} + })} */} + ) } +const renderListItems = ({ item }: { item: string }) => const style = StyleSheet.create({ flex: { diff --git a/apps/mobile/src/modules/subscription/UnGroupedList.tsx b/apps/mobile/src/modules/subscription/UnGroupedList.tsx index 129a7f294..861101ca8 100644 --- a/apps/mobile/src/modules/subscription/UnGroupedList.tsx +++ b/apps/mobile/src/modules/subscription/UnGroupedList.tsx @@ -1,9 +1,11 @@ import type { FC } from "react" +import { FlatList } from "react-native" import { useSortedUngroupedSubscription } from "@/src/store/subscription/hooks" import { useFeedListSortMethod, useFeedListSortOrder } from "./atoms" import { SubscriptionItem } from "./items/SubscriptionItem" +import { ItemSeparator } from "./ItemSeparator" export const UnGroupedList: FC<{ subscriptionIds: string[] @@ -11,15 +13,14 @@ export const UnGroupedList: FC<{ const sortBy = useFeedListSortMethod() const sortOrder = useFeedListSortOrder() const sortedSubscriptionIds = useSortedUngroupedSubscription(subscriptionIds, sortBy, sortOrder) - const lastSubscriptionId = sortedSubscriptionIds.at(-1) - return sortedSubscriptionIds.map((id) => { - return ( - - ) - }) + return ( + + ) } + +const renderSubscriptionItems = ({ item }: { item: string }) => diff --git a/apps/mobile/src/modules/subscription/ViewTab.tsx b/apps/mobile/src/modules/subscription/ViewTab.tsx index dcbc60654..cafd5fc86 100644 --- a/apps/mobile/src/modules/subscription/ViewTab.tsx +++ b/apps/mobile/src/modules/subscription/ViewTab.tsx @@ -66,7 +66,7 @@ export const ViewTab = () => { return ( { scrollOffsetX.current = event.nativeEvent.contentOffset.x }} showsHorizontalScrollIndicator={false} - className="border-tertiary-system-background" horizontal ref={tabRef} contentContainerStyle={styles.tabScroller} diff --git a/apps/mobile/src/modules/subscription/items/InboxItem.tsx b/apps/mobile/src/modules/subscription/items/InboxItem.tsx index 625ad1b1e..e8edbb4fb 100644 --- a/apps/mobile/src/modules/subscription/items/InboxItem.tsx +++ b/apps/mobile/src/modules/subscription/items/InboxItem.tsx @@ -16,7 +16,7 @@ export const InboxItem = memo(({ id }: { id: string }) => { if (!subscription) return null return ( - + - + {!!list.image && ( diff --git a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx index fba7c030d..7de86fc87 100644 --- a/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx +++ b/apps/mobile/src/modules/subscription/items/SubscriptionItem.tsx @@ -48,6 +48,7 @@ export const SubscriptionItem = memo(({ id, className }: { id: string; className const feed = useFeed(id) const inGrouped = !!useContext(GroupedContext) const view = useViewPageCurrentView() + // const swipeableRef: SwipeableRef = useRef(null) if (!subscription || !feed) return null @@ -73,7 +74,7 @@ export const SubscriptionItem = memo(({ id, className }: { id: string; className className={cn( "flex h-12 flex-row items-center", inGrouped ? "pl-8 pr-4" : "px-4", - "border-item-pressed border-b", + className, )} onPress={() => { diff --git a/apps/mobile/src/screens/(modal)/follow.tsx b/apps/mobile/src/screens/(modal)/follow.tsx index 3b7144700..2f6c0f261 100644 --- a/apps/mobile/src/screens/(modal)/follow.tsx +++ b/apps/mobile/src/screens/(modal)/follow.tsx @@ -116,21 +116,19 @@ function FollowImpl() { /> {/* Group 1 */} - + {feed?.title} - - {feed?.description} - + {feed?.description} {/* Group 2 */} - + - + {keys.map((keyItem) => { const parameters = normalizeRSSHubParameters(route.parameters[keyItem.name]) @@ -172,7 +172,9 @@ function FormImpl({ route, routePrefix, name }: RsshubFormParams) { )} {!!parameters && ( - {parameters.description} + + {parameters.description} + )} ) @@ -200,11 +202,13 @@ const Maintainers = ({ maintainers }: { maintainers?: string[] }) => { } return ( - - This feed is provided by RSSHub, with credit to + + + This feed is provided by RSSHub, with credit to{" "} + {maintainers.map((m) => ( Linking.openURL(`https://github.com/${m}`)}> - @{m} + @{m} ))} diff --git a/apps/mobile/src/theme/colors.ts b/apps/mobile/src/theme/colors.ts index 4ef1c7bad..5f71e6e8d 100644 --- a/apps/mobile/src/theme/colors.ts +++ b/apps/mobile/src/theme/colors.ts @@ -64,33 +64,34 @@ export const palette = { export const lightVariants = { // UIKit Colors - label: "0 0 0", - secondaryLabel: "122 122 122", - tertiaryLabel: "172 172 178", - quaternaryLabel: "199 199 204", + placeholderText: "199 199 204", - separator: "209 209 214", - opaqueSeparator: "229 229 234", + separator: "84 84 86 0.34", + opaqueSeparator: "84 84 86 0.34", + nonOpaqueSeparator: "198 198 200", link: "0 122 255", + systemBackground: "255 255 255", secondarySystemBackground: "242 242 247", - tertiarySystemBackground: "229 229 234", + tertiarySystemBackground: "255 255 255", // Grouped systemGroupedBackground: "242 242 247", - systemGroupedBackground2: "255 255 255", + secondarySystemGroupedBackground: "255 255 255", + tertiarySystemGroupedBackground: "242 242 247", // System Colors - systemFill: "209 213 219", - secondarySystemFill: "209 213 219", - tertiarySystemFill: "209 213 219", - quaternarySystemFill: "209 213 219", + systemFill: "120 120 128 0.2", + secondarySystemFill: "120 120 128 0.16", + tertiarySystemFill: "120 120 128 0.12", + quaternarySystemFill: "120 120 128 0.08", // Text Colors + label: "0 0 0", text: "0 0 0", - secondaryText: "142 142 147", - tertiaryText: "99 99 102", - quaternaryText: "72 72 74", + secondaryLabel: "60 60 67 0.6", + tertiaryLabel: "60 60 67 0.3", + quaternaryLabel: "60 60 67 0.18", // Extended colors disabled: "235 235 228", @@ -98,13 +99,11 @@ export const lightVariants = { } export const darkVariants = { // UIKit Colors - label: "255 255 255", - secondaryLabel: "172 172 178", - tertiaryLabel: "122 122 122", - quaternaryLabel: "99 99 102", + placeholderText: "122 122 122", - separator: "72 72 74", - opaqueSeparator: "58 58 60", + separator: "56 56 58 0.6", + opaqueSeparator: "56 56 58 0.6", + nonOpaqueSeparator: "84 84 86", link: "10 132 255", systemBackground: "0 0 0", secondarySystemBackground: "28 28 30", @@ -112,19 +111,21 @@ export const darkVariants = { // Grouped systemGroupedBackground: "0 0 0", - systemGroupedBackground2: "28 28 30", + secondarySystemGroupedBackground: "28 28 30", + tertiarySystemGroupedBackground: "44 44 46", // System Colors - systemFill: "72 72 74", - secondarySystemFill: "99 99 102", - tertiarySystemFill: "122 122 122", - quaternarySystemFill: "142 142 147", + systemFill: "120 120 128 36", + secondarySystemFill: "120 120 128 0.32", + tertiarySystemFill: "120 120 128 0.24", + quaternarySystemFill: "120 120 128 0.19", // Text Colors + label: "255 255 255", text: "255 255 255", - secondaryText: "172 172 178", - tertiaryText: "122 122 122", - quaternaryText: "99 99 102", + secondaryLabel: "235 235 245 0.6", + tertiaryLabel: "235 235 245 0.3", + quaternaryLabel: "235 235 245 0.18", // Extended colors disabled: "85 85 85", diff --git a/apps/mobile/tailwind.config.ts b/apps/mobile/tailwind.config.ts index 885c83d67..f6a5c0a6c 100644 --- a/apps/mobile/tailwind.config.ts +++ b/apps/mobile/tailwind.config.ts @@ -38,13 +38,11 @@ export default resolveConfig({ }, // System colors - label: "rgb(var(--color-label) / )", - "secondary-label": "rgb(var(--color-secondaryLabel) / )", - "tertiary-label": "rgb(var(--color-tertiaryLabel) / )", - "quaternary-label": "rgb(var(--color-quaternaryLabel) / )", + "placeholder-text": "rgb(var(--color-placeholderText) / )", separator: "rgb(var(--color-separator) / )", - "opaque-separator": "rgb(var(--color-opaqueSeparator) / )", + "opaque-separator": "rgba(var(--color-opaqueSeparator))", + "non-opaque-separator": "rgba(var(--color-nonOpaqueSeparator))", link: "rgb(var(--color-link) / )", // Backgrounds @@ -53,18 +51,22 @@ export default resolveConfig({ "rgb(var(--color-secondarySystemBackground) / )", "tertiary-system-background": "rgb(var(--color-tertiarySystemBackground) / )", "system-grouped-background": "rgb(var(--color-systemGroupedBackground) / )", - "system-grouped-background-2": "rgb(var(--color-systemGroupedBackground2) / )", + "secondary-system-grouped-background": + "rgb(var(--color-secondarySystemGroupedBackground) / )", + "tertiary-system-grouped-background": + "rgb(var(--color-tertiarySystemGroupedBackground) / )", // System fills - "system-fill": "rgb(var(--color-systemFill) / )", - "secondary-system-fill": "rgb(var(--color-secondarySystemFill) / )", - "tertiary-system-fill": "rgb(var(--color-tertiarySystemFill) / )", - "quaternary-system-fill": "rgb(var(--color-quaternarySystemFill) / )", + "system-fill": "rgba(var(--color-systemFill))", + "secondary-system-fill": "rgba(var(--color-secondarySystemFill))", + "tertiary-system-fill": "rgba(var(--color-tertiarySystemFill))", + "quaternary-system-fill": "rgba(var(--color-quaternarySystemFill))", // Text colors + label: "rgb(var(--color-text) / )", text: "rgb(var(--color-text) / )", - "secondary-text": "rgb(var(--color-secondaryText) / )", - "tertiary-text": "rgb(var(--color-tertiaryText) / )", - "quaternary-text": "rgb(var(--color-quaternaryText) / )", + "secondary-label": "rgba(var(--color-secondaryLabel))", + "tertiary-label": "rgba(var(--color-tertiaryLabel))", + "quaternary-label": "rgba(var(--color-quaternaryLabel))", // Extended colors disabled: "rgb(var(--color-disabled) / )", diff --git a/packages/utils/src/color.ts b/packages/utils/src/color.ts index 291a91b00..53c0db5f4 100644 --- a/packages/utils/src/color.ts +++ b/packages/utils/src/color.ts @@ -162,6 +162,6 @@ export const withOpacity = (color: string, opacity: number) => { } } export const rgbStringToRgb = (hex: string) => { - const [r, g, b] = hex.split(" ").map((s) => Number.parseInt(s)) - return `rgb(${r}, ${g}, ${b})` + const [r, g, b, a] = hex.split(" ").map((s) => Number.parseFloat(s)) + return `rgba(${r}, ${g}, ${b}, ${a || 1})` }