Merge pull request #3883 from RSSNext/sync/main-to-dev-20250608
Sync main branch to dev branch
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# What's New in v0.5.0
|
||||
|
||||
## Shiny new things
|
||||
|
||||
- Double-clicking the draggable edge on either side of the entry list resets it to its default position (26c6853)
|
||||
- Brand-new Feed Manager panel (dbd43ae)
|
||||
- OPML import now offers a preview and lets you choose specific feeds to import (de6c2ff)
|
||||
- All-new Share sheet (5bbd96e)
|
||||
|
||||
## Improvements
|
||||
|
||||
- Switched to hCaptcha for a smoother human-verification experience (22aec92)
|
||||
- Gradually rolling out an experimental unified local database for mobile and desktop (#3809)
|
||||
- Implemented smooth scrolling (6c73ae5)
|
||||
- Significant overall performance boost
|
||||
- AI will skip summarising extra-short articles to avoid trivial summaries (852fb1d)
|
||||
- Added “Reset to defaults” button to the shortcuts page (#3834)
|
||||
- Added a border around 2-factor QR codes for better scan reliability (f7faf78)
|
||||
- RSSHub routes top-feed list now respects your Discover-language setting (14d4da3)
|
||||
- Audio player now prefers episode artwork over feed artwork (#3855)
|
||||
- You can now manually paste your login token to bypass Microsoft Store deeplink issues (47e07a4)
|
||||
- Added “Check for updates” button in Settings (ef304cd)
|
||||
|
||||
## No longer broken
|
||||
|
||||
- Dropdown menus now keep keyboard focus when opened (f31d43d)
|
||||
- “Mark as read” button is now perfectly centred (#3836)
|
||||
- Entry list no longer displays stale cached items (0a167ac)
|
||||
- Squashed numerous shortcut-key bugs
|
||||
@@ -1,5 +1,11 @@
|
||||
# What's new in vNEXT_VERSION
|
||||
|
||||
## Shiny new things
|
||||
|
||||
## Improvements
|
||||
|
||||
## No longer broken
|
||||
|
||||
Performance: Fix context menu re-render loop.
|
||||
## Thanks
|
||||
|
||||
Special thanks to external contributors @ for their valuable contributions
|
||||
|
||||
@@ -64,6 +64,30 @@ const socialOptions: SocialShareOption[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const getShareUrl = (entryId: string) => {
|
||||
const entry = getEntry(entryId)
|
||||
if (!entry) return ""
|
||||
|
||||
// Temporarily use the original link
|
||||
return entry.entries.url!
|
||||
// const params = getRouteParams()
|
||||
|
||||
// let subscriptionId = "all"
|
||||
|
||||
// if (params.feedId) {
|
||||
// subscriptionId = params.feedId
|
||||
// } else if (params.inboxId) {
|
||||
// subscriptionId = params.inboxId
|
||||
// } else if (params.listId) {
|
||||
// subscriptionId = params.listId
|
||||
// }
|
||||
|
||||
// return UrlBuilder.shareEntry(entryId, {
|
||||
// view: params.view,
|
||||
// subscriptionId,
|
||||
// })
|
||||
}
|
||||
|
||||
export const SharePanel = ({ entryId }: SharePanelProps) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -72,14 +96,14 @@ export const SharePanel = ({ entryId }: SharePanelProps) => {
|
||||
if (!entry) return null
|
||||
|
||||
const { title, description } = entry.entries
|
||||
const shareUrl = globalThis.location.href
|
||||
const shareUrl = getShareUrl(entryId)
|
||||
|
||||
// Limit text to 50 characters with ellipsis
|
||||
const truncateText = (text: string, maxLength = 50) => {
|
||||
return text.length > maxLength ? `${text.slice(0, maxLength)}...` : text
|
||||
}
|
||||
|
||||
const shareTitle = `${title || t("share.default_title")} - Follow`
|
||||
const shareTitle = `${title || t("share.default_title")} - Folo`
|
||||
const baseText = description || title || t("share.default_description")
|
||||
const truncatedText = truncateText(baseText)
|
||||
const shareText = `${truncatedText} | ${t("share.discover_more")}`
|
||||
@@ -90,7 +114,7 @@ export const SharePanel = ({ entryId }: SharePanelProps) => {
|
||||
url: shareUrl,
|
||||
}
|
||||
},
|
||||
[t],
|
||||
[entryId, t],
|
||||
)
|
||||
|
||||
const handleNativeShare = useCallback(async () => {
|
||||
@@ -127,14 +151,14 @@ export const SharePanel = ({ entryId }: SharePanelProps) => {
|
||||
}, [entryId, generateShareContent, t])
|
||||
|
||||
const handleCopyLink = useCallback(async () => {
|
||||
const shareUrl = globalThis.location.href
|
||||
const shareUrl = getShareUrl(entryId)
|
||||
try {
|
||||
await navigator.clipboard.writeText(shareUrl)
|
||||
toast.success(t("share.link_copied"))
|
||||
} catch {
|
||||
toast.error(t("share.copy_failed"))
|
||||
}
|
||||
}, [t])
|
||||
}, [entryId, t])
|
||||
|
||||
const handleSocialShare = useCallback(
|
||||
(shareUrlTemplate: string) => {
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
import { FeedViewType } from "@follow/constants"
|
||||
import { UrlBuilder as UrlBuilderClass } from "@follow/utils/url-builder"
|
||||
|
||||
import { WEB_URL } from "~/constants/env"
|
||||
|
||||
export const UrlBuilder = new UrlBuilderClass(WEB_URL)
|
||||
class WebUrlBuilder extends UrlBuilderClass {
|
||||
constructor() {
|
||||
super(WEB_URL)
|
||||
}
|
||||
|
||||
shareEntry(
|
||||
id: string,
|
||||
options?: {
|
||||
view?: FeedViewType
|
||||
subscriptionId?: string
|
||||
},
|
||||
) {
|
||||
const { view = FeedViewType.Articles, subscriptionId = "all" } = options || {}
|
||||
|
||||
return super.join(`timeline/view-${view}/${subscriptionId}/${id}`, { share: "1" })
|
||||
}
|
||||
}
|
||||
|
||||
export const UrlBuilder = new WebUrlBuilder()
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ROUTE_ENTRY_PENDING } from "~/constants"
|
||||
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { EntryContent } from "~/modules/entry-content/index.mobile"
|
||||
|
||||
import { EntryColumnMobile } from "../entry-column/mobile"
|
||||
import { EntryColumnMobile } from "../timeline-column/mobile"
|
||||
|
||||
export const EntryContentMobile = () => {
|
||||
const { entryId } = useRouteParamsSelector((s) => ({
|
||||
|
||||
+3
-3
@@ -6,17 +6,17 @@ const noop = () =>
|
||||
})
|
||||
export const LeftSidebarLayout = withResponsiveComponent<object>(
|
||||
() =>
|
||||
import("~/modules/app-layout/feed-column/desktop").then((m) => ({
|
||||
import("~/modules/app-layout/subscription-column/desktop").then((m) => ({
|
||||
default: m.MainDestopLayout,
|
||||
})),
|
||||
() =>
|
||||
import("~/modules/app-layout/feed-column/index.mobile").then((m) => ({
|
||||
import("~/modules/app-layout/subscription-column/index.mobile").then((m) => ({
|
||||
default: m.MobileRootLayout,
|
||||
})),
|
||||
)
|
||||
|
||||
export const MobileFeedScreen = withResponsiveComponent<object>(noop, () =>
|
||||
import("~/modules/app-layout/feed-column/mobile").then((m) => ({
|
||||
import("~/modules/app-layout/subscription-column/mobile").then((m) => ({
|
||||
default: m.FeedColumnMobile,
|
||||
})),
|
||||
)
|
||||
+2
-2
@@ -7,7 +7,7 @@ const noop = () =>
|
||||
})
|
||||
export const CenterColumnLayout = withResponsiveComponent<object>(
|
||||
() =>
|
||||
import("~/modules/app-layout/entry-column/desktop").then((m) => ({
|
||||
import("~/modules/app-layout/timeline-column/desktop").then((m) => ({
|
||||
default: m.CenterColumnDesktop,
|
||||
})),
|
||||
() =>
|
||||
@@ -17,7 +17,7 @@ export const CenterColumnLayout = withResponsiveComponent<object>(
|
||||
)
|
||||
|
||||
export const MobileCenterColumnScreen = withResponsiveComponent<object>(noop, () =>
|
||||
import("~/modules/app-layout/entry-column/mobile").then((m) => ({
|
||||
import("~/modules/app-layout/timeline-column/mobile").then((m) => ({
|
||||
default: m.EntryColumnMobile,
|
||||
})),
|
||||
)
|
||||
+1
-1
@@ -8,7 +8,7 @@ import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
|
||||
import { usePreventOverscrollBounce } from "~/hooks/common"
|
||||
import { EntryColumn } from "~/modules/entry-column"
|
||||
|
||||
import { MobileFloatBar } from "../feed-column/float-bar.mobile"
|
||||
import { MobileFloatBar } from "../subscription-column/float-bar.mobile"
|
||||
|
||||
export const EntryColumnMobile = () => {
|
||||
const isStartupTimeline = useGeneralSettingKey("startupScreen") === "timeline"
|
||||
@@ -2,9 +2,9 @@ import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { Card, CardContent, CardHeader } from "@follow/components/ui/card/index.jsx"
|
||||
import { RelativeTime } from "@follow/components/ui/datetime/index.js"
|
||||
import { getBackgroundGradient } from "@follow/utils/color"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { cn, formatNumber } from "@follow/utils/utils"
|
||||
import type { FC } from "react"
|
||||
import { memo, useMemo } from "react"
|
||||
import { memo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useLocation } from "react-router"
|
||||
|
||||
@@ -95,7 +95,6 @@ interface DiscoverFeedCardProps {
|
||||
|
||||
export const DiscoverFeedCard: FC<DiscoverFeedCardProps> = memo(
|
||||
({ item, onSuccess, className }) => {
|
||||
const numberFormatter = useMemo(() => new Intl.NumberFormat("en-US", {}), [])
|
||||
const { t } = useTranslation("common")
|
||||
|
||||
const isSubscribed = useIsSubscribed(item.feed?.id || item.list?.id || "")
|
||||
@@ -140,7 +139,7 @@ export const DiscoverFeedCard: FC<DiscoverFeedCardProps> = memo(
|
||||
<i className="i-mgc-user-3-cute-re" />
|
||||
|
||||
<span>
|
||||
{numberFormatter.format(item.analytics.subscriptionCount)}{" "}
|
||||
{formatNumber(item.analytics.subscriptionCount)}{" "}
|
||||
{t("feed.follower", { count: item.analytics.subscriptionCount })}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Skeleton } from "@follow/components/ui/skeleton/index.js"
|
||||
import type { FeedAnalyticsModel, FeedOrListRespModel, ListAnalyticsModel } from "@follow/models"
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import type { FC } from "react"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { RelativeTime } from "~/components/ui/datetime"
|
||||
@@ -17,7 +17,7 @@ export interface FeedSummaryProps {
|
||||
}
|
||||
export const FeedSummary: FC<FeedSummaryProps> = ({ feed, analytics, showAnalytics = true }) => {
|
||||
const { t } = useTranslation("common")
|
||||
const numberFormatter = useMemo(() => new Intl.NumberFormat("en-US", {}), [])
|
||||
|
||||
return (
|
||||
<div>
|
||||
<FollowSummary feed={feed} />
|
||||
@@ -33,7 +33,7 @@ export const FeedSummary: FC<FeedSummaryProps> = ({ feed, analytics, showAnalyti
|
||||
<i className="i-mgc-user-3-cute-re" />
|
||||
|
||||
<span>
|
||||
{numberFormatter.format(analytics.subscriptionCount)}{" "}
|
||||
{formatNumber(analytics.subscriptionCount)}{" "}
|
||||
{t("feed.follower", { count: analytics.subscriptionCount })}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import type { FC } from "react"
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { useIsSubscribed } from "~/store/subscription"
|
||||
@@ -13,7 +13,6 @@ export const TrendingFeedCard: FC<{
|
||||
}> = ({ item }) => {
|
||||
const { t } = useTranslation("common")
|
||||
const { analytics } = item
|
||||
const numberFormatter = useMemo(() => new Intl.NumberFormat("en-US", {}), [])
|
||||
const isSubscribed = useIsSubscribed(item.feed?.id || item.list?.id || "")
|
||||
return (
|
||||
<div>
|
||||
@@ -25,7 +24,7 @@ export const TrendingFeedCard: FC<{
|
||||
<i className="i-mgc-user-3-cute-re" />
|
||||
|
||||
<span>
|
||||
{numberFormatter.format(analytics.subscriptionCount)}{" "}
|
||||
{formatNumber(analytics.subscriptionCount)}{" "}
|
||||
{t("feed.follower", { count: analytics.subscriptionCount })}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import { HeaderTopReturnBackButton } from "~/components/mobile/button"
|
||||
import { FEED_COLLECTION_LIST } from "~/constants"
|
||||
import { LOGO_MOBILE_ID } from "~/constants/dom"
|
||||
import { useRouteParams } from "~/hooks/biz/useRouteParams"
|
||||
import { FeedColumnMobile } from "~/modules/app-layout/feed-column/mobile"
|
||||
import { FeedColumnMobile } from "~/modules/app-layout/subscription-column/mobile"
|
||||
import { COMMAND_ID } from "~/modules/command/commands/id"
|
||||
import { useRunCommandFn } from "~/modules/command/hooks/use-command"
|
||||
import { useRefreshFeedMutation } from "~/queries/feed"
|
||||
|
||||
@@ -13,7 +13,6 @@ import { useEntry } from "~/store/entry"
|
||||
|
||||
export function AISummary({ entryId }: { entryId: string }) {
|
||||
const { t } = useTranslation()
|
||||
const entryContentLength = useEntry(entryId, (state) => state.entries.content?.length) || 0
|
||||
const summarySetting = useEntry(entryId, (state) => state.settings?.summary)
|
||||
const isInReadabilitySuccess = useEntryIsInReadabilitySuccess(entryId)
|
||||
const showAISummary = useShowAISummary(summarySetting)
|
||||
@@ -34,7 +33,7 @@ export function AISummary({ entryId }: { entryId: string }) {
|
||||
},
|
||||
)
|
||||
|
||||
if (!showAISummary || entryContentLength < 100 || (!summary.isLoading && !summary.data)) {
|
||||
if (!showAISummary || (!summary.isLoading && !summary.data)) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typogra
|
||||
import { views } from "@follow/constants"
|
||||
import type { ExtractBizResponse } from "@follow/models"
|
||||
import { jotaiStore } from "@follow/utils"
|
||||
import { sortByAlphabet } from "@follow/utils/utils"
|
||||
import { formatNumber, sortByAlphabet } from "@follow/utils/utils"
|
||||
import clsx from "clsx"
|
||||
import { useSingleton } from "foxact/use-singleton"
|
||||
import type { PrimitiveAtom } from "jotai"
|
||||
@@ -140,7 +140,7 @@ const SubscriptionFeedsSection = () => {
|
||||
return nextSet
|
||||
})
|
||||
})
|
||||
scrollContainerElement.querySelectorAll("button[data-id]").forEach((el) => {
|
||||
scrollContainerElement.querySelectorAll("[data-id]").forEach((el) => {
|
||||
observer.observe(el)
|
||||
})
|
||||
return () => {
|
||||
@@ -506,13 +506,13 @@ const FeedListItem = memo(
|
||||
<div className="text-center text-xs">
|
||||
{analytics ? (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<div className="grid grid-cols-2 gap-1">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div className="text-text-secondary flex items-center gap-1">
|
||||
<i className="i-mgc-user-3-cute-re" />
|
||||
<span className="tabular-nums">
|
||||
{analytics.subscriptionCount?.toLocaleString() || "0"}
|
||||
{formatNumber(analytics.subscriptionCount || 0)}
|
||||
</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
@@ -525,8 +525,8 @@ const FeedListItem = memo(
|
||||
<div className="text-text-secondary flex items-center gap-1">
|
||||
<i className="i-mgc-safety-certificate-cute-re" />
|
||||
<span className="tabular-nums">
|
||||
{analytics.updatesPerWeek?.toFixed(1) || "0"}
|
||||
{"/week"}
|
||||
{Math.round(analytics.updatesPerWeek || 0) || "0"}
|
||||
{"/w"}
|
||||
</span>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
TooltipTrigger,
|
||||
} from "@follow/components/ui/tooltip/index.jsx"
|
||||
import { views } from "@follow/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { cn, formatNumber } from "@follow/utils/utils"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useMemo } from "react"
|
||||
import { toast } from "sonner"
|
||||
@@ -175,7 +175,7 @@ export const SettingLists = () => {
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell size="sm" className="tabular-nums">
|
||||
{listDataMap[row.id]?.subscriptionCount}
|
||||
{formatNumber(listDataMap[row.id]?.subscriptionCount || 0)}
|
||||
</TableCell>
|
||||
<TableCell size="sm" className="tabular-nums">
|
||||
<Balance>{BigInt(listDataMap[row.id]?.purchaseAmount || 0n)}</Balance>
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import { Input } from "@follow/components/ui/input/Input.js"
|
||||
import { LoadingCircle } from "@follow/components/ui/loading/index.js"
|
||||
import { EllipsisHorizontalTextWithTooltip } from "@follow/components/ui/typography/EllipsisWithTooltip.js"
|
||||
import { CategoryMap, RSSHubCategories } from "@follow/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { cn, formatNumber } from "@follow/utils/utils"
|
||||
import { keepPreviousData } from "@tanstack/react-query"
|
||||
import { useMemo, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
@@ -281,7 +281,7 @@ const RecommendationListItem = ({
|
||||
{analytics?.subscriptionCount && (
|
||||
<div className="flex items-center gap-0.5 text-xs">
|
||||
<i className="i-mgc-fire-cute-re" />
|
||||
{analytics?.subscriptionCount}
|
||||
{formatNumber(analytics?.subscriptionCount || 0)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { isMobile } from "@follow/components/hooks/useMobile.js"
|
||||
import { redirect } from "react-router"
|
||||
|
||||
import { ROUTE_ENTRY_PENDING } from "~/constants"
|
||||
import { MobileCenterColumnScreen } from "~/modules/app-layout/entry-column/index"
|
||||
import { MobileCenterColumnScreen } from "~/modules/app-layout/timeline-column/index"
|
||||
|
||||
export const Component = () => {
|
||||
return <MobileCenterColumnScreen />
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
export { CenterColumnLayout as Component } from "~/modules/app-layout/entry-column/index"
|
||||
export { CenterColumnLayout as Component } from "~/modules/app-layout/timeline-column/index"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { redirect } from "react-router"
|
||||
|
||||
import { getGeneralSettings } from "~/atoms/settings/general"
|
||||
import { ROUTE_ENTRY_PENDING, ROUTE_FEED_PENDING } from "~/constants"
|
||||
import { MobileFeedScreen } from "~/modules/app-layout/feed-column/index"
|
||||
import { MobileFeedScreen } from "~/modules/app-layout/subscription-column/index"
|
||||
|
||||
export function Component() {
|
||||
return <MobileFeedScreen />
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { LeftSidebarLayout as Component } from "~/modules/app-layout/feed-column/index"
|
||||
export { LeftSidebarLayout as Component } from "~/modules/app-layout/subscription-column/index"
|
||||
|
||||
@@ -50,7 +50,7 @@ export const ExtensionExposeProvider = () => {
|
||||
return env.VITE_API_URL
|
||||
},
|
||||
getWebUrl() {
|
||||
return window.location.origin
|
||||
return env.VITE_WEB_URL
|
||||
},
|
||||
|
||||
clearIfLoginOtherAccount(newUserId: string) {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import type { SupportedLanguages } from "@follow/models/types"
|
||||
|
||||
import { getReadabilityContent } from "~/atoms/readability"
|
||||
import { apiClient } from "~/lib/api-fetch"
|
||||
import { defineQuery } from "~/lib/defineQuery"
|
||||
import { parseHtml } from "~/lib/parse-html"
|
||||
import { translate } from "~/lib/translate"
|
||||
import { getEntry } from "~/store/entry"
|
||||
|
||||
export const ai = {
|
||||
translation: ({
|
||||
@@ -31,6 +34,19 @@ export const ai = {
|
||||
target?: "content" | "readabilityContent"
|
||||
}) =>
|
||||
defineQuery(["summary", entryId, language, target], async () => {
|
||||
const content =
|
||||
target === "readabilityContent"
|
||||
? getReadabilityContent()[entryId]?.content
|
||||
: getEntry(entryId)?.entries.content
|
||||
if (!content) {
|
||||
return null
|
||||
}
|
||||
|
||||
const text = parseHtml(content).toText()
|
||||
if (text.length < 100) {
|
||||
return null
|
||||
}
|
||||
|
||||
const res = await apiClient.ai.summary.$get({
|
||||
query: {
|
||||
id: entryId,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Folo",
|
||||
"type": "module",
|
||||
"version": "0.4.9",
|
||||
"version": "0.5.0",
|
||||
"private": true,
|
||||
"description": "Follow everything in one place",
|
||||
"author": "Folo Team",
|
||||
@@ -94,5 +94,5 @@
|
||||
"vite-tsconfig-paths": "5.1.4"
|
||||
},
|
||||
"productName": "Folo",
|
||||
"mainHash": "c1310ea7b1278a253bb9f34f38d76e16d3ffd66d910a9af2a071834e789ee180"
|
||||
"mainHash": "c4275ef4fd948d72b930953bd4d4b3a45bb37a20eeab354f78b86b6eca1a19d6"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { cn } from "@follow/utils"
|
||||
import { cn, formatNumber } from "@follow/utils"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { Text, View } from "react-native"
|
||||
import { useColor } from "react-native-uikit-colors"
|
||||
@@ -87,7 +87,9 @@ export const Trending = ({
|
||||
>
|
||||
<View className="flex flex-row items-center gap-1 opacity-60">
|
||||
<User3CuteReIcon width={13} height={13} />
|
||||
<Text className="text-text text-sm">{item.analytics.subscriptionCount}</Text>
|
||||
<Text className="text-text text-sm">
|
||||
{formatNumber(item.analytics.subscriptionCount || 0)}
|
||||
</Text>
|
||||
</View>
|
||||
</FeedSummary>
|
||||
))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useSubscriptionByFeedId } from "@follow/store/subscription/hooks"
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import { Text, View } from "react-native"
|
||||
|
||||
import { RelativeDateTime } from "@/src/components/ui/datetime/RelativeDateTime"
|
||||
@@ -22,7 +23,7 @@ export const SearchFeedCard = ({ item }: { item: SearchResultItem }) => {
|
||||
<View className="flex-row items-center gap-1.5">
|
||||
<User3CuteReIcon width={14} height={14} color={iconColor} />
|
||||
<Text className="text-secondary-label text-sm">
|
||||
{item.analytics?.subscriptionCount} followers
|
||||
{formatNumber(item.analytics?.subscriptionCount || 0)} followers
|
||||
</Text>
|
||||
</View>
|
||||
<View className="flex-row items-center gap-1.5">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useSubscriptionByListId } from "@follow/store/subscription/hooks"
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { useAtomValue } from "jotai"
|
||||
import { memo } from "react"
|
||||
@@ -124,7 +125,9 @@ const SearchListCard = memo(({ item }: { item: SearchResultItem }) => {
|
||||
<View className="mt-4 flex-row items-center gap-6 pl-4 opacity-60">
|
||||
<View className="flex-row items-center gap-2">
|
||||
<User3CuteReIcon width={16} height={16} color={iconColor} />
|
||||
<Text className="text-text">{item.subscriptionCount} followers</Text>
|
||||
<Text className="text-text">
|
||||
{formatNumber(item.analytics?.subscriptionCount || 0)} followers
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
</ItemPressable>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useFeed, usePrefetchFeed, usePrefetchFeedByUrl } from "@follow/store/fe
|
||||
import { useSubscriptionByFeedId } from "@follow/store/subscription/hooks"
|
||||
import { subscriptionSyncService } from "@follow/store/subscription/store"
|
||||
import type { SubscriptionForm } from "@follow/store/subscription/types"
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useEffect, useState } from "react"
|
||||
import { Controller, useForm } from "react-hook-form"
|
||||
@@ -184,7 +185,7 @@ function FollowImpl(props: { feedId: string }) {
|
||||
<View className="flex-row items-center gap-1">
|
||||
<User3CuteReIcon width={12} height={12} />
|
||||
<Text className="text-text text-sm">
|
||||
{feed.subscriptionCount}{" "}
|
||||
{formatNumber(feed.subscriptionCount || 0)}{" "}
|
||||
{tCommon("feed.follower", { count: feed.subscriptionCount })}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -10,13 +10,11 @@ import { Avatar, AvatarFallback, AvatarImage } from "@follow/components/ui/avata
|
||||
import { Button } from "@follow/components/ui/button/index.jsx"
|
||||
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
|
||||
import { useTitle } from "@follow/hooks"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { cn, formatNumber } from "@follow/utils/utils"
|
||||
import { Fragment, memo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useParams } from "react-router"
|
||||
|
||||
const numberFormatter = new Intl.NumberFormat()
|
||||
|
||||
const FeedRow = memo<{ feed: Feed["feed"] }>(({ feed }) => {
|
||||
return (
|
||||
<a
|
||||
@@ -154,7 +152,7 @@ export function Component() {
|
||||
{!!list.data?.subscriptionCount && (
|
||||
<div className="px-4 text-center">
|
||||
<div className="text-xl font-semibold text-zinc-900 dark:text-zinc-100">
|
||||
{numberFormatter.format(list.data.subscriptionCount)}
|
||||
{formatNumber(list.data.subscriptionCount)}
|
||||
</div>
|
||||
<div className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
{t("feed.follower", { count: list.data.subscriptionCount })}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { getFeedIconSrc } from "@follow/components/utils/icon.js"
|
||||
import { formatNumber } from "@follow/utils"
|
||||
import * as React from "react"
|
||||
|
||||
import type { ApiClient } from "~/lib/api-client"
|
||||
@@ -24,7 +25,7 @@ export const renderFeedOG = async (apiClient: ApiClient, feedId: string) => {
|
||||
fallback: true,
|
||||
src: image!,
|
||||
})
|
||||
const numberFormatter = new Intl.NumberFormat("en-US")
|
||||
|
||||
const imageBase64 = await getImageBase64(image || src)
|
||||
|
||||
try {
|
||||
@@ -84,8 +85,8 @@ export const renderFeedOG = async (apiClient: ApiClient, feedId: string) => {
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
{numberFormatter.format(feed.data.subscriptionCount)} followers with{" "}
|
||||
{numberFormatter.format(feed.data.readCount)} recent reads on Folo
|
||||
{formatNumber(feed.data.subscriptionCount || 0)} followers with{" "}
|
||||
{formatNumber(feed.data.readCount || 0)} recent reads on Folo
|
||||
</p>
|
||||
</div>
|
||||
</OGCanvas>,
|
||||
|
||||
+2
-2
@@ -323,7 +323,7 @@
|
||||
"register.login": "Login",
|
||||
"register.password": "Password",
|
||||
"register.submit": "Create account",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>Double click</b> to collapse",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>Double click</b> to reset to default size",
|
||||
"resize.tooltip.drag_to_resize": "<b>Drag</b> to resize",
|
||||
"search.empty.no_results": "No results found.",
|
||||
"search.group.entries": "Entries",
|
||||
@@ -340,7 +340,7 @@
|
||||
"share.copy_link": "Copy Link",
|
||||
"share.default_description": "Check out this entry",
|
||||
"share.default_title": "Entry Share",
|
||||
"share.discover_more": "Discover more on Follow",
|
||||
"share.discover_more": "Discover more on Folo",
|
||||
"share.link_copied": "Link copied to clipboard",
|
||||
"share.social_media": "Social Media",
|
||||
"share.system_share": "System Share",
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@
|
||||
"register.login": "ログイン",
|
||||
"register.password": "パスワード",
|
||||
"register.submit": "作成",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>ダブルクリック</b> してたたみます",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>ダブルクリック</b> してデフォルトサイズにリセットします",
|
||||
"resize.tooltip.drag_to_resize": "<b>ドラッグ</b> してリサイズできます",
|
||||
"search.empty.no_results": "結果が見つかりませんでした。",
|
||||
"search.group.entries": "エントリー",
|
||||
|
||||
@@ -322,7 +322,7 @@
|
||||
"register.login": "登录",
|
||||
"register.password": "密码",
|
||||
"register.submit": "创建账户",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>双击</b>以折叠",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>双击</b>重置为默认大小",
|
||||
"resize.tooltip.drag_to_resize": "<b>拖动</b>以调整大小",
|
||||
"search.empty.no_results": "搜索结果为空",
|
||||
"search.group.entries": "条目",
|
||||
@@ -339,7 +339,7 @@
|
||||
"share.copy_link": "复制链接",
|
||||
"share.default_description": "查看这个精彩内容",
|
||||
"share.default_title": "内容分享",
|
||||
"share.discover_more": "在 Follow 上发现更多精彩内容",
|
||||
"share.discover_more": "在 Folo 上发现更多精彩内容",
|
||||
"share.link_copied": "链接已复制到剪贴板",
|
||||
"share.social_media": "社交媒体",
|
||||
"share.system_share": "系统分享",
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
"register.login": "登入",
|
||||
"register.password": "密碼",
|
||||
"register.submit": "創建帳號",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>雙擊</b>以摺疊",
|
||||
"resize.tooltip.double_click_to_collapse": "<b>雙擊</b>重置為預設大小",
|
||||
"resize.tooltip.drag_to_resize": "<b>拖動</b>以調整大小",
|
||||
"search.empty.no_results": "搜尋結果為空",
|
||||
"search.group.entries": "條目",
|
||||
|
||||
@@ -29,31 +29,23 @@ export const PanelSplitter = (
|
||||
$css.remove()
|
||||
}
|
||||
}, [cursor, isDragging])
|
||||
|
||||
const [ref, { height }] = useMeasure()
|
||||
|
||||
const El = (
|
||||
<div
|
||||
tabIndex={-1}
|
||||
ref={ref}
|
||||
{...rest}
|
||||
className={cn(
|
||||
"active:!bg-accent absolute inset-0 z-[3] w-[2px] -translate-x-1/2 cursor-ew-resize bg-transparent hover:bg-gray-400 hover:dark:bg-neutral-500",
|
||||
isDragging ? "bg-accent" : "",
|
||||
)}
|
||||
/>
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="relative h-full w-0 shrink-0" data-hide-in-print>
|
||||
{tooltip ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger>{El}</TooltipTrigger>
|
||||
<TooltipContent sideOffset={height / 2}>{tooltip}</TooltipContent>
|
||||
</Tooltip>
|
||||
) : (
|
||||
El
|
||||
)}
|
||||
</div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<div ref={ref} className="relative h-full w-0 shrink-0" data-hide-in-print>
|
||||
<div
|
||||
tabIndex={-1}
|
||||
{...rest}
|
||||
className={cn(
|
||||
"active:!bg-accent absolute inset-0 z-[3] w-[2px] -translate-x-1/2 cursor-ew-resize bg-transparent hover:bg-gray-400 hover:dark:bg-neutral-500",
|
||||
isDragging ? "bg-accent" : "",
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent sideOffset={-height / 2}>{tooltip}</TooltipContent>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export class UrlBuilder {
|
||||
constructor(private readonly webUrl: string) {}
|
||||
private join(path: string, query?: Record<string, string>) {
|
||||
protected join(path: string, query?: Record<string, string>) {
|
||||
const nextUrl = new URL(this.webUrl)
|
||||
nextUrl.pathname = path
|
||||
if (query) {
|
||||
|
||||
@@ -449,3 +449,30 @@ export function doesTextContainHTML(text?: string | null): boolean {
|
||||
if (!text) return false
|
||||
return /<([a-z][a-z0-9]*)\b[^>]*>\s*[^<>\s].*<\/\1>/i.test(text)
|
||||
}
|
||||
|
||||
/**
|
||||
* Format number to a more readable format
|
||||
* @param num - The number to format
|
||||
* @returns The formatted number
|
||||
*/
|
||||
export function formatNumber(num: number): string {
|
||||
// Handle negative numbers
|
||||
const isNegative = num < 0
|
||||
const absNum = Math.abs(num)
|
||||
|
||||
// Define thresholds
|
||||
const billion = 1_000_000_000
|
||||
const million = 1_000_000
|
||||
const thousand = 1_000
|
||||
|
||||
// Format based on number size
|
||||
if (absNum >= billion) {
|
||||
return `${isNegative ? "-" : ""}${(absNum / billion).toFixed(1)}B`
|
||||
} else if (absNum >= million) {
|
||||
return `${isNegative ? "-" : ""}${(absNum / million).toFixed(1)}M`
|
||||
} else if (absNum >= thousand) {
|
||||
return `${isNegative ? "-" : ""}${(absNum / thousand).toFixed(1)}K`
|
||||
}
|
||||
|
||||
return `${isNegative ? "-" : ""}${absNum}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user