diff --git a/src/renderer/src/lib/utils.ts b/src/renderer/src/lib/utils.ts
index ad02aa767..878290a14 100644
--- a/src/renderer/src/lib/utils.ts
+++ b/src/renderer/src/lib/utils.ts
@@ -124,3 +124,25 @@ export const sleep = (ms: number) =>
export const capitalizeFirstLetter = (string: string) =>
string.charAt(0).toUpperCase() + string.slice(1)
+
+export const pluralize = (
+ noun: string,
+ count: number,
+ postfix: string | ((noun: string, rule: Intl.LDMLPluralRule) => string) = "s",
+) => {
+ let rule: Intl.LDMLPluralRule
+ // Check Support
+ if (typeof Intl === "undefined" || !Intl.PluralRules) {
+ if (count === 1) {
+ rule = "one"
+ } else {
+ rule = "other"
+ }
+ }
+ rule = new Intl.PluralRules("en", { type: "ordinal" }).select(count)
+
+ if (typeof postfix === "string") {
+ return `${noun}${count === 1 ? "" : postfix}`
+ }
+ return postfix(noun, rule)
+}
diff --git a/src/renderer/src/pages/(external)/(with-layout)/feed/[id]/index.tsx b/src/renderer/src/pages/(external)/(with-layout)/feed/[id]/index.tsx
index 9cb1984ab..ee0585d96 100644
--- a/src/renderer/src/pages/(external)/(with-layout)/feed/[id]/index.tsx
+++ b/src/renderer/src/pages/(external)/(with-layout)/feed/[id]/index.tsx
@@ -5,7 +5,7 @@ import { ListItemHoverOverlay } from "@renderer/components/ui/list-item-hover-ov
import { useTitle } from "@renderer/hooks/common"
import { views } from "@renderer/lib/constants"
import { FeedViewType } from "@renderer/lib/enum"
-import { cn } from "@renderer/lib/utils"
+import { cn, pluralize } from "@renderer/lib/utils"
import type { FeedModel } from "@renderer/models"
import { ArticleItem } from "@renderer/modules/entry-column/article-item"
import { NotificationItem } from "@renderer/modules/entry-column/notification-item"
@@ -62,7 +62,6 @@ export function Component() {
<>
{feed.data?.feed && (
-
{feed.data.subscriptionCount}
{" "}
- follows with
+ {pluralize("follow", feed.data.subscriptionCount)}
+ {" "}
+ with
{" "}
{feed.data.readCount}
{" "}
- reads on
+ {pluralize("read", feed.data.readCount)}
+ {" "}
+ on
+ {" "}
{APP_NAME}
diff --git a/src/renderer/src/pages/(external)/layout.tsx b/src/renderer/src/pages/(external)/layout.tsx
index 36969b874..dea97753f 100644
--- a/src/renderer/src/pages/(external)/layout.tsx
+++ b/src/renderer/src/pages/(external)/layout.tsx
@@ -1,10 +1,11 @@
-import { SessionProvider } from "@hono/auth-js/react"
+import { UserProvider } from "@renderer/providers/user-provider"
import { Outlet } from "react-router-dom"
export function Component() {
return (
-
+ <>
+
-
+ >
)
}
diff --git a/src/renderer/src/pages/(external)/login.tsx b/src/renderer/src/pages/(external)/login.tsx
index a72927028..c5547a428 100644
--- a/src/renderer/src/pages/(external)/login.tsx
+++ b/src/renderer/src/pages/(external)/login.tsx
@@ -1,4 +1,4 @@
-import { signIn, useSession } from "@hono/auth-js/react"
+import { SessionProvider, signIn, useSession } from "@hono/auth-js/react"
import { Logo } from "@renderer/components/icons/logo"
import { Button } from "@renderer/components/ui/button"
import { useSignOut } from "@renderer/hooks/biz/useSignOut"
@@ -7,6 +7,13 @@ import { useEffect, useState } from "react"
import { useLocation, useNavigate } from "react-router-dom"
export function Component() {
+ return (
+
+
+
+ )
+}
+function Login() {
const { status } = useSession()
const navigate = useNavigate()
const [redirecting, setRedirecting] = useState(false)
diff --git a/types/authjs.d.ts b/types/authjs.d.ts
index d309de7ea..b12a16506 100644
--- a/types/authjs.d.ts
+++ b/types/authjs.d.ts
@@ -4,7 +4,11 @@ declare module "@auth/core/types" {
id: string
name: string
+ email: string
+ emailVerified: null
image: string
+ handle: null
+ createdAt: string
}
interface Session {