feat: inbox (#742)

* feat: display inbox in feed list

* feat: inbox creation and modification and deletion

* feat: seperate feed-form and list-form

* feat: inbox form

* fix: types

* feat: navigation with listId

* fix: listId

* feat: fetch inbox entry

* fix: types

* feat: use feedicon and feedtitle for inbox item

* feat: get inbox by id

* feat: inbox list

* feat: inbox text

* feat: inbox deletion confirmation

* chore: auto-fix linting and formatting issues

* feat: INBOXES_EMAIL env

* chore: auto-fix linting and formatting issues
This commit is contained in:
DIYgod
2024-10-03 22:24:36 +08:00
committed by GitHub
parent 426a1d48dd
commit 2fba746447
66 changed files with 2624 additions and 261 deletions
+1
View File
@@ -4,3 +4,4 @@ VITE_IMGPROXY_URL=http://localhost:2873
VITE_SENTRY_DSN=
VITE_BUILD_TYPE=production
VITE_POSTHOG_KEY=
VITE_INBOXES_EMAIL=__devdev@follow.re
@@ -196,6 +196,10 @@ export function FeedIcon({
)
break
}
case feed?.type === "inbox": {
ImageElement = <i className="i-mgc-inbox-cute-fi mr-2 shrink-0" style={sizeStyle} />
break
}
case !!feed?.title && !!feed.title[0]: {
ImageElement = fallbackIcon
break
+31 -17
View File
@@ -1,4 +1,5 @@
import { WEB_URL } from "@follow/shared/constants"
import { env } from "@follow/shared/env"
import { FeedIcon } from "~/components/feed-icon"
import { cn } from "~/lib/utils"
@@ -16,15 +17,35 @@ export function FollowSummary({
docs?: string
className?: string
}) {
const isList = feed.type === "list"
let siteLink
let feedLink
let feedTitle = feed.title
let feedText
switch (feed.type) {
case "feed": {
siteLink = feed.siteUrl || void 0
feedLink = feed.url || docs
feedText = feed.url || docs
break
}
case "list": {
siteLink = `${WEB_URL}/list/${feed.id}`
feedLink = siteLink
feedText = `/list/${feed.id}`
break
}
case "inbox": {
siteLink = void 0
feedLink = siteLink
feedText = `${feed.id}${env.VITE_INBOXES_EMAIL}`
feedTitle = feed.title || `${feed.id}'s Inbox`
break
}
}
return (
<div className={cn("flex select-text flex-col gap-2 text-sm", className)}>
<a
href={!isList ? feed.siteUrl || void 0 : `${WEB_URL}/list/${feed.id}`}
target="_blank"
className="flex items-center"
rel="noreferrer"
>
<a href={siteLink} target="_blank" className="flex items-center" rel="noreferrer">
<FeedIcon
feed={feed}
fallbackUrl={docs}
@@ -33,7 +54,7 @@ export function FollowSummary({
/>
<div className="truncate text-base font-semibold leading-tight">
<div className="flex items-center">
{feed.title}
{feedTitle}
<FeedCertification className="center" feed={feed} />
</div>
<EllipsisHorizontalTextWithTooltip className="truncate text-xs font-normal text-zinc-500">
@@ -43,15 +64,8 @@ export function FollowSummary({
</a>
<div className="flex items-center gap-1 truncate text-zinc-500">
<i className="i-mgc-right-cute-re shrink-0" />
<a
href={!isList ? feed.url || docs : `${WEB_URL}/list/${feed.id}`}
target="_blank"
rel="noreferrer"
className="truncate"
>
<EllipsisHorizontalTextWithTooltip>
{`${!isList ? feed.url || docs : `list:${feed.id}`}`}
</EllipsisHorizontalTextWithTooltip>
<a href={feedLink} target="_blank" rel="noreferrer" className="truncate">
<EllipsisHorizontalTextWithTooltip>{feedText}</EllipsisHorizontalTextWithTooltip>
</a>
</div>
</div>
@@ -1,4 +1,3 @@
import { FeedViewType } from "~/lib/enum"
import { useEntryContentContext } from "~/modules/entry-content/hooks"
+2
View File
@@ -10,6 +10,8 @@ export const I18N_LOCALE_KEY = getStorageNS("I18N_LOCALE")
export const ROUTE_FEED_PENDING = "all"
export const ROUTE_ENTRY_PENDING = "pending"
export const ROUTE_FEED_IN_FOLDER = "folder-"
export const ROUTE_FEED_IN_LIST = "list-"
export const ROUTE_FEED_IN_INBOX = "inbox-"
export const DAILY_CLAIM_AMOUNT = "20"
export const INVITATION_PRICE = "100"
+14 -1
View File
@@ -2,10 +2,19 @@ import type { Transaction } from "dexie"
import Dexie from "dexie"
import { LOCAL_DB_NAME } from "./constants"
import { dbSchemaV1, dbSchemaV2, dbSchemaV3, dbSchemaV4, dbSchemaV5, dbSchemaV6 } from "./db_schema"
import {
dbSchemaV1,
dbSchemaV2,
dbSchemaV3,
dbSchemaV4,
dbSchemaV5,
dbSchemaV6,
dbSchemaV7,
} from "./db_schema"
import type { DB_Cleaner } from "./schemas/cleaner"
import type { DB_Entry, DB_EntryRelated } from "./schemas/entry"
import type { DB_Feed, DB_FeedUnread } from "./schemas/feed"
import type { DB_Inbox } from "./schemas/inbox"
import type { DB_List } from "./schemas/list"
import type { DB_Subscription } from "./schemas/subscription"
@@ -17,6 +26,7 @@ export interface LocalDBSchemaMap {
feedUnreads: DB_FeedUnread
cleaner: DB_Cleaner
lists: DB_List
inboxes: DB_Inbox
}
// Define a local DB
@@ -27,6 +37,7 @@ export class BrowserDB extends Dexie {
public entryRelated: BrowserDBTable<"entryRelated">
public feedUnreads: BrowserDBTable<"feedUnreads">
public lists: BrowserDBTable<"lists">
public inboxes: BrowserDBTable<"inboxes">
public cleaner: BrowserDBTable<"cleaner">
constructor() {
@@ -37,6 +48,7 @@ export class BrowserDB extends Dexie {
this.version(4).stores(dbSchemaV4)
this.version(5).stores(dbSchemaV5)
this.version(6).stores(dbSchemaV6)
this.version(7).stores(dbSchemaV7)
this.entries = this.table("entries")
this.feeds = this.table("feeds")
@@ -45,6 +57,7 @@ export class BrowserDB extends Dexie {
this.feedUnreads = this.table("feedUnreads")
this.cleaner = this.table("cleaner")
this.lists = this.table("lists")
this.inboxes = this.table("inboxes")
}
async upgradeToV2(trans: Transaction) {
+5
View File
@@ -33,3 +33,8 @@ export const dbSchemaV6 = {
...dbSchemaV5,
lists: "&id, title",
}
export const dbSchemaV7 = {
...dbSchemaV6,
inboxes: "&id",
}
@@ -0,0 +1,4 @@
export type DB_Inbox = {
id: string
title: string
}
+47 -2
View File
@@ -1,4 +1,5 @@
import { WEB_URL } from "@follow/shared/constants"
import { env } from "@follow/shared/env"
import { useMemo } from "react"
import { useTranslation } from "react-i18next"
@@ -8,12 +9,15 @@ import type { FeedViewType } from "~/lib/enum"
import type { NativeMenuItem } from "~/lib/native-menu"
import { useFeedClaimModal } from "~/modules/claim"
import { FeedForm } from "~/modules/discover/feed-form"
import { InboxForm } from "~/modules/discover/inbox-form"
import { ListForm } from "~/modules/discover/list-form"
import {
getFeedById,
useAddFeedToFeedList,
useFeedById,
useRemoveFeedFromFeedList,
} from "~/store/feed"
import { useInboxById } from "~/store/inbox"
import { useListById, useListByView } from "~/store/list"
import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription"
@@ -250,7 +254,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie
click: () => {
present({
title: t("sidebar.feed_actions.edit_list"),
content: ({ dismiss }) => <FeedForm asWidget id={listId} onSuccess={dismiss} isList />,
content: ({ dismiss }) => <ListForm asWidget id={listId} onSuccess={dismiss} />,
})
},
},
@@ -266,7 +270,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie
shortcut: "Meta+G",
disabled: getRouteParams().feedId === listId,
click: () => {
navigateEntry({ feedId: listId })
navigateEntry({ listId })
},
},
{
@@ -313,3 +317,44 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie
return { items }
}
export const useInboxActions = ({ inboxId }: { inboxId: string }) => {
const { t } = useTranslation()
const inbox = useInboxById(inboxId)
const { present } = useModalStack()
const items = useMemo(() => {
if (!inbox) return []
const items: NativeMenuItem[] = [
{
type: "text" as const,
label: t("sidebar.feed_actions.edit"),
shortcut: "E",
click: () => {
present({
title: t("sidebar.feed_actions.edit_inbox"),
content: ({ dismiss }) => <InboxForm asWidget id={inboxId} onSuccess={dismiss} />,
})
},
},
{
type: "separator" as const,
disabled: false,
},
{
type: "text" as const,
label: t("sidebar.feed_actions.copy_email_address"),
shortcut: "Meta+Shift+C",
disabled: false,
click: () => {
navigator.clipboard.writeText(`${inboxId}${env.VITE_INBOXES_EMAIL}`)
},
},
]
return items
}, [inbox, t, inboxId, present])
return { items }
}
@@ -4,6 +4,7 @@ import { useCallback } from "react"
import { useWhoami } from "~/atoms/user"
import { useModalStack } from "~/components/ui/modal"
import { FeedForm } from "~/modules/discover/feed-form"
import { ListForm } from "~/modules/discover/list-form"
import { useI18n } from "../common"
@@ -25,14 +26,12 @@ export const usePresentFeedFormModal = () => {
const isList = !!("listId" in params)
present({
title: isList ? t("sidebar.feed_actions.edit_list") : t("sidebar.feed_actions.edit_feed"),
content: ({ dismiss }) => (
<FeedForm
asWidget
id={isList ? params.listId : params.feedId}
isList={isList}
onSuccess={dismiss}
/>
),
content: ({ dismiss }) =>
isList ? (
<ListForm asWidget id={params.listId} onSuccess={dismiss} />
) : (
<FeedForm asWidget id={params.feedId} onSuccess={dismiss} />
),
})
} else {
window.location.href = `${DEEPLINK_SCHEME}add?id=${"feedId" in params ? params.feedId : params.listId}`
@@ -3,7 +3,13 @@ import { isUndefined } from "lodash-es"
import { getReadonlyRoute, getStableRouterNavigate } from "~/atoms/route"
import { setSidebarActiveView } from "~/atoms/sidebar"
import { resetShowSourceContent } from "~/atoms/source-content"
import { ROUTE_ENTRY_PENDING, ROUTE_FEED_IN_FOLDER, ROUTE_FEED_PENDING } from "~/constants"
import {
ROUTE_ENTRY_PENDING,
ROUTE_FEED_IN_FOLDER,
ROUTE_FEED_IN_INBOX,
ROUTE_FEED_IN_LIST,
ROUTE_FEED_PENDING,
} from "~/constants"
import { FeedViewType } from "~/lib/enum"
type NavigateEntryOptions = Partial<{
@@ -11,6 +17,8 @@ type NavigateEntryOptions = Partial<{
entryId: string | null
view: FeedViewType
folderName: string
inboxId: string
listId: string
}>
/**
* @description a hook to navigate to `feedId`, `entryId`, add search for `view`, `level`
@@ -19,7 +27,7 @@ type NavigateEntryOptions = Partial<{
export const useNavigateEntry = () => navigateEntry
export const navigateEntry = (options: NavigateEntryOptions) => {
const { entryId, feedId, view, folderName } = options || {}
const { entryId, feedId, view, folderName, inboxId, listId } = options || {}
const { params, searchParams } = getReadonlyRoute()
let finalFeedId = feedId || params.feedId || ROUTE_FEED_PENDING
@@ -31,6 +39,14 @@ export const navigateEntry = (options: NavigateEntryOptions) => {
finalFeedId = `${ROUTE_FEED_IN_FOLDER}${folderName}`
}
if (inboxId) {
finalFeedId = `${ROUTE_FEED_IN_INBOX}${inboxId}`
}
if (listId) {
finalFeedId = `${ROUTE_FEED_IN_LIST}${listId}`
}
finalFeedId = encodeURIComponent(finalFeedId)
const nextSearchParams = new URLSearchParams(searchParams)
+10 -1
View File
@@ -6,6 +6,8 @@ import {
FEED_COLLECTION_LIST,
ROUTE_ENTRY_PENDING,
ROUTE_FEED_IN_FOLDER,
ROUTE_FEED_IN_INBOX,
ROUTE_FEED_IN_LIST,
ROUTE_FEED_PENDING,
} from "~/constants"
import { FeedViewType } from "~/lib/enum"
@@ -42,8 +44,9 @@ export interface BizRouteParams {
isCollection: boolean
isAllFeeds: boolean
isPendingEntry: boolean
folderName?: string
inboxId?: string
listId?: string
}
const parseRouteParams = (params: Params<any>, search: URLSearchParams): BizRouteParams => {
@@ -64,6 +67,12 @@ const parseRouteParams = (params: Params<any>, search: URLSearchParams): BizRout
folderName: params.feedId?.startsWith(ROUTE_FEED_IN_FOLDER)
? params.feedId.slice(ROUTE_FEED_IN_FOLDER.length)
: undefined,
inboxId: params.feedId?.startsWith(ROUTE_FEED_IN_INBOX)
? params.feedId.slice(ROUTE_FEED_IN_INBOX.length)
: undefined,
listId: params.feedId?.startsWith(ROUTE_FEED_IN_LIST)
? params.feedId.slice(ROUTE_FEED_IN_LIST.length)
: undefined,
}
}
+26 -8
View File
@@ -18,20 +18,38 @@ export function clamp(value, min, max) {
return Math.max(Math.min(max, value), min)
}
export function getEntriesParams({ id, view }: { id?: number | string; view?: number }) {
export function getEntriesParams({
feedId,
inboxId,
listId,
view,
}: {
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
}) {
const params: {
feedId?: string
feedIdList?: string[]
isCollection?: boolean
withContent?: boolean
inboxId?: string
listId?: string
} = {}
if (id === FEED_COLLECTION_LIST) {
params.isCollection = true
} else if (id && id !== ROUTE_FEED_PENDING) {
if (id.toString().includes(",")) {
params.feedIdList = `${id}`.split(",")
} else {
params.feedId = `${id}`
if (inboxId) {
params.inboxId = `${inboxId}`
} else if (listId) {
params.listId = `${listId}`
} else if (feedId) {
if (feedId === FEED_COLLECTION_LIST) {
params.isCollection = true
} else if (feedId !== ROUTE_FEED_PENDING) {
if (feedId.toString().includes(",")) {
params.feedIdList = `${feedId}`.split(",")
} else {
params.feedId = `${feedId}`
}
}
}
if (view === FeedViewType.SocialMedia) {
+7 -3
View File
@@ -27,8 +27,11 @@ export type FeedModel = ExtractBizResponse<typeof apiClient.feeds.$get>["data"][
export type ListModelPoplutedFeeds = ExtractBizResponse<typeof apiClient.lists.$get>["data"]["list"]
export type ListModel = Omit<ListModelPoplutedFeeds, "feeds">
export type FeedOrListRespModel = FeedModel | ListModelPoplutedFeeds
export type FeedOrListModel = FeedModel | ListModel
export type InboxModel = ExtractBizResponse<typeof apiClient.inboxes.$get>["data"]
export type FeedOrListRespModel = FeedModel | ListModelPoplutedFeeds | InboxModel
export type FeedOrListModel = FeedModel | ListModel | InboxModel
export type EntryResponse = Exclude<
Extract<ExtractBizResponse<typeof apiClient.entries.$get>, { code: 0 }>["data"],
@@ -36,7 +39,8 @@ export type EntryResponse = Exclude<
>
export type EntriesResponse = Array<
Exclude<Awaited<ReturnType<typeof apiClient.entries.$post>>["data"], undefined>
| Exclude<Awaited<ReturnType<typeof apiClient.entries.$post>>["data"], undefined>
| Exclude<Awaited<ReturnType<typeof apiClient.entries.inbox.$post>>["data"], undefined>
>[number]
export type CombinedEntryModel = EntriesResponse[number] & {
@@ -31,6 +31,7 @@ import { FeedViewType } from "~/lib/enum"
import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser"
import { getNewIssueUrl } from "~/lib/issues"
import { cn } from "~/lib/utils"
import type { FeedModel } from "~/models"
import { feed as feedQuery, useFeed } from "~/queries/feed"
import { subscription as subscriptionQuery } from "~/queries/subscriptions"
import { useFeedByIdOrUrl } from "~/store/feed"
@@ -47,18 +48,15 @@ const formSchema = z.object({
})
const defaultValue = { view: FeedViewType.Articles.toString() } as z.infer<typeof formSchema>
export const FeedForm: Component<{
url?: string
id?: string
isList?: boolean
defaultValues?: z.infer<typeof formSchema>
asWidget?: boolean
onSuccess?: () => void
}> = ({ id: _id, defaultValues = defaultValue, url, asWidget, onSuccess, isList }) => {
const queryParams = { id: _id, url, isList }
}> = ({ id: _id, defaultValues = defaultValue, url, asWidget, onSuccess }) => {
const queryParams = { id: _id, url }
const feedQuery = useFeed(queryParams)
@@ -66,7 +64,7 @@ export const FeedForm: Component<{
const feed = useFeedByIdOrUrl({
id,
url,
})
}) as FeedModel
const hasSub = useSubscriptionByFeedId(feed?.id || "")
const isSubscribed = !!feedQuery.data?.subscription || hasSub
@@ -96,6 +94,7 @@ export const FeedForm: Component<{
asWidget,
onSuccess,
subscriptionData: feedQuery.data?.subscription,
feed,
}}
/>
) : feedQuery.isLoading ? (
@@ -162,13 +161,12 @@ export const FeedForm: Component<{
const FeedInnerForm = ({
defaultValues,
id,
url,
asWidget,
onSuccess,
subscriptionData,
feed,
}: {
defaultValues?: z.infer<typeof formSchema>
url?: string
id?: string
asWidget?: boolean
onSuccess?: () => void
@@ -178,21 +176,15 @@ const FeedInnerForm = ({
isPrivate?: boolean
title?: string | null
}
feed: FeedModel
}) => {
const subscription = useSubscriptionByFeedId(id || "") || subscriptionData
const isSubscribed = !!subscription
const buttonRef = useRef<HTMLButtonElement>(null)
const feed = useFeedByIdOrUrl({ id, url })!
const isList = feed?.type === "list"
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: isList
? {
...defaultValues,
view: feed.view.toString(),
}
: defaultValues,
defaultValues,
})
const { setClickOutSideToDismiss, dismiss } = useCurrentModal()
@@ -213,12 +205,12 @@ const FeedInnerForm = ({
const followMutation = useMutation({
mutationFn: async (values: z.infer<typeof formSchema>) => {
const body = {
...(isList ? { listId: feed.id } : { url: feed.url }),
url: feed.url,
view: Number.parseInt(values.view),
category: values.category,
isPrivate: values.isPrivate,
title: values.title,
...(isSubscribed && !isList && { feedId: feed.id }),
feedId: feed.id,
}
const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post
@@ -289,11 +281,7 @@ const FeedInnerForm = ({
<FormItem>
<FormLabel>{t("feed_form.view")}</FormLabel>
<ViewSelectorRadioGroup
{...form.register("view")}
disabled={isList}
className={cn(isList && "opacity-60")}
/>
<ViewSelectorRadioGroup {...form.register("view")} />
<FormMessage />
</FormItem>
)}
@@ -314,36 +302,34 @@ const FeedInnerForm = ({
</FormItem>
)}
/>
{!isList && (
<FormField
control={form.control}
name="category"
render={({ field }) => (
<FormItem>
<FormField
control={form.control}
name="category"
render={({ field }) => (
<FormItem>
<div>
<FormLabel>{t("feed_form.category")}</FormLabel>
<FormDescription>{t("feed_form.category_description")}</FormDescription>
</div>
<FormControl>
<div>
<FormLabel>{t("feed_form.category")}</FormLabel>
<FormDescription>{t("feed_form.category_description")}</FormDescription>
<Autocomplete
maxHeight={window.innerHeight < 600 ? 120 : 240}
portal
suggestions={suggestions}
{...(field as any)}
onSuggestionSelected={(suggestion) => {
if (suggestion) {
field.onChange(suggestion.value)
}
}}
/>
</div>
<FormControl>
<div>
<Autocomplete
maxHeight={window.innerHeight < 600 ? 120 : 240}
portal
suggestions={suggestions}
{...(field as any)}
onSuggestionSelected={(suggestion) => {
if (suggestion) {
field.onChange(suggestion.value)
}
}}
/>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="isPrivate"
@@ -365,18 +351,6 @@ const FeedInnerForm = ({
</FormItem>
)}
/>
{isList && !!feed.fee && !isSubscribed && (
<div>
<FormLabel className="flex items-center gap-1">
{t("feed_form.fee")}{" "}
<div className="ml-2 flex scale-[0.85] items-center gap-1">
{feed.fee}
<i className="i-mgc-power size-4 text-accent" />
</div>
</FormLabel>
<FormDescription className="mt-0.5">{t("feed_form.fee_description")}</FormDescription>
</div>
)}
<div className="flex flex-1 items-end justify-end gap-4">
{isSubscribed && (
<Button
@@ -391,13 +365,7 @@ const FeedInnerForm = ({
</Button>
)}
<Button ref={buttonRef} type="submit" isLoading={followMutation.isPending}>
{isSubscribed
? t("feed_form.update")
: isList && feed.fee
? t("feed_form.follow_with_fee", {
fee: feed.fee,
})
: t("feed_form.follow")}
{isSubscribed ? t("feed_form.update") : t("feed_form.follow")}
</Button>
</div>
</form>
+29 -16
View File
@@ -30,6 +30,7 @@ import type { FeedViewType } from "~/lib/enum"
import { FollowSummary } from "../../components/feed-summary"
import { FeedForm } from "./feed-form"
import { ListForm } from "./list-form"
const formSchema = z.object({
keyword: z.string().min(1),
@@ -63,7 +64,7 @@ const info: Record<
}
type DiscoverSearchData = Awaited<ReturnType<typeof apiClient.discover.$post>>["data"]
export function DiscoverForm({ type }: { type: string }) {
export function DiscoverForm({ type = "search" }: { type?: string }) {
const { prefix, default: defaultValue } = info[type]
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
@@ -320,21 +321,33 @@ const SearchCard: FC<{
onClick={() => {
present({
title: "Add Feed",
content: ({ dismiss }) => (
<FeedForm
asWidget
url={item.feed?.url}
id={item.feed?.id || item.list?.id}
isList={!!item.list?.id}
defaultValues={{
view: getSidebarActiveView().toString(),
}}
onSuccess={() => {
onSuccess(item)
dismiss()
}}
/>
),
content: ({ dismiss }) =>
item.list?.id ? (
<ListForm
asWidget
id={item.list?.id}
defaultValues={{
view: getSidebarActiveView().toString(),
}}
onSuccess={() => {
onSuccess(item)
dismiss()
}}
/>
) : (
<FeedForm
asWidget
url={item.feed?.url}
id={item.feed?.id}
defaultValues={{
view: getSidebarActiveView().toString(),
}}
onSuccess={() => {
onSuccess(item)
dismiss()
}}
/>
),
})
}}
>
@@ -0,0 +1,202 @@
import { env } from "@follow/shared/env"
import { zodResolver } from "@hookform/resolvers/zod"
import { useMutation } from "@tanstack/react-query"
import { useForm } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { z } from "zod"
import { FollowSummary } from "~/components/feed-summary"
import { Logo } from "~/components/icons/logo"
import { Button } from "~/components/ui/button"
import { Card, CardHeader } from "~/components/ui/card"
import {
Form,
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "~/components/ui/form"
import { Input } from "~/components/ui/input"
import { apiClient } from "~/lib/api-fetch"
import { FeedViewType } from "~/lib/enum"
import { cn } from "~/lib/utils"
import type { InboxModel } from "~/models"
import { useInbox } from "~/queries/inboxes"
import { useInboxById } from "~/store/inbox"
import { subscriptionActions } from "~/store/subscription"
export const InboxForm: Component<{
id?: string
asWidget?: boolean
onSuccess?: () => void
}> = ({ id: _id, asWidget, onSuccess }) => {
const queryParams = { id: _id }
const feedQuery = useInbox(queryParams)
const id = feedQuery.data?.id || _id
const inbox = useInboxById(id)
const isSubscribed = true
const { t } = useTranslation()
return (
<div
className={cn(
"flex h-full flex-col",
asWidget ? "min-h-[210px] w-[550px] max-w-full" : "px-[18px] pb-[18px] pt-12",
)}
>
{!asWidget && (
<div className="mb-4 mt-2 flex items-center gap-2 text-[22px] font-bold">
<Logo className="size-8" />
{isSubscribed ? t("feed_form.update_follow") : t("feed_form.add_follow")}
</div>
)}
<InboxInnerForm
{...{
onSuccess,
inbox,
}}
/>
</div>
)
}
const inboxHandleSchema = z
.string()
.min(3)
.max(32)
.regex(/^[a-z0-9_-]+$/)
const formSchema = z.object({
handle: inboxHandleSchema,
title: z.string(),
})
const InboxInnerForm = ({
onSuccess,
inbox,
}: {
onSuccess?: () => void
inbox?: Nullable<InboxModel>
}) => {
const { t } = useTranslation()
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
handle: inbox?.id,
title: inbox?.title || "",
},
})
const mutationCreate = useMutation({
mutationFn: async ({ handle, title }: { handle: string; title: string }) => {
await apiClient.inboxes.$post({
json: {
handle,
title,
},
})
onSuccess?.()
},
onSuccess: (_) => {
subscriptionActions.fetchByView(FeedViewType.Articles)
toast.success(t("discover.inbox_create_success"))
},
onError: () => {
toast.error(t("discover.inbox_create_error"))
},
})
const mutationChange = useMutation({
mutationFn: async ({ handle, title }: { handle: string; title: string }) => {
await apiClient.inboxes.$put({
json: {
handle,
title,
},
})
onSuccess?.()
},
onSuccess: () => {
subscriptionActions.fetchByView(FeedViewType.Articles)
toast.success(t("discover.inbox_update_success"))
},
onError: () => {
toast.error(t("discover.inbox_update_error"))
},
})
function onSubmit(values: z.infer<typeof formSchema>) {
if (inbox) {
mutationChange.mutate({ handle: values.handle, title: values.title })
} else {
mutationCreate.mutate({ handle: values.handle, title: values.title })
}
}
return (
<div className="flex flex-1 flex-col gap-y-4">
{inbox && (
<Card>
<CardHeader>
<FollowSummary feed={inbox} />
</CardHeader>
</Card>
)}
<>
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className={cn("space-y-4")}
data-testid="discover-form"
>
{!inbox && (
<FormField
control={form.control}
name="handle"
render={({ field }) => (
<FormItem>
<FormLabel>{t("discover.inbox_handle")}</FormLabel>
<FormControl>
<div className={cn("flex w-64 items-center gap-2")}>
<Input autoFocus {...field} />
<span className="text-zinc-500">{env.VITE_INBOXES_EMAIL}</span>
</div>
</FormControl>
<FormMessage />
</FormItem>
)}
/>
)}
<FormField
control={form.control}
name="title"
render={({ field }) => (
<FormItem>
<FormLabel>{t("discover.inbox_title")}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<div
className={cn("center flex justify-end gap-4")}
data-testid="discover-form-actions"
>
<Button type="submit" isLoading={mutationCreate.isPending}>
{t(inbox ? "discover.inbox_update" : "discover.inbox_create")}
</Button>
</div>
</form>
</Form>
</>
</div>
)
}
@@ -0,0 +1,157 @@
import { env } from "@follow/shared/env"
import { useMutation } from "@tanstack/react-query"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { Button } from "~/components/ui/button"
import { CopyButton } from "~/components/ui/code-highlighter"
import { useModalStack } from "~/components/ui/modal"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "~/components/ui/table"
import { apiClient } from "~/lib/api-fetch"
import { FeedViewType } from "~/lib/enum"
import { inboxActions, useInboxByView } from "~/store/inbox"
import { InboxForm } from "./inbox-form"
export function DiscoverInboxList() {
const { t } = useTranslation()
const inboxes = useInboxByView(FeedViewType.Articles)
const { present } = useModalStack()
return (
<>
<div className="mb-4 flex items-center gap-2 text-sm text-zinc-500">
<span>{t("discover.inbox.description")}</span>
<a
href="https://github.com/RSSNext/Follow/wiki/Inbox#webhooks"
className="text-zinc-600 underline"
target="_blank"
rel="noopener noreferrer"
>
{t("discover.inbox.webhooks_docs")}
</a>
</div>
<Table className="mb-8 w-[600px]">
<TableHeader>
<TableRow>
<TableHead className="pl-0 pr-6">{t("discover.inbox.handle")}</TableHead>
<TableHead className="pl-0 pr-6">{t("discover.inbox.email")}</TableHead>
<TableHead className="pl-0 pr-6">{t("discover.inbox.title")}</TableHead>
<TableHead className="pl-0 pr-6">{t("discover.inbox.secret")}</TableHead>
<TableHead className="px-0">{t("discover.inbox.actions")}</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{inboxes.map((inbox) => (
<TableRow key={inbox.id}>
<TableCell size="sm">{inbox.id}</TableCell>
<TableCell size="sm">
<div className="group relative flex w-fit items-center gap-2">
<span className="shrink-0">
{inbox.id}
{env.VITE_INBOXES_EMAIL}
</span>
<CopyButton
value={`${inbox.id}${env.VITE_INBOXES_EMAIL}`}
className="absolute -right-6 p-1 opacity-0 group-hover:opacity-100 [&_i]:size-3"
/>
</div>
</TableCell>
<TableCell size="sm">{inbox.title}</TableCell>
<TableCell size="sm">
<div className="group relative flex w-fit items-center gap-2 font-mono">
<span className="shrink-0">****</span>
<CopyButton
value={inbox.secret}
className="absolute -right-6 p-1 opacity-0 group-hover:opacity-100 [&_i]:size-3"
/>
</div>
</TableCell>
<TableCell size="sm">
<Button
variant="ghost"
onClick={() =>
present({
title: t("discover.inbox_destroy_confirm"),
content: ({ dismiss }) => (
<ConfirmDestroyModalContent id={inbox.id} dismiss={dismiss} />
),
})
}
>
<i className="i-mgc-delete-2-cute-re" />
</Button>
<Button
variant="ghost"
onClick={() => {
present({
title: t("sidebar.feed_actions.edit_inbox"),
content: ({ dismiss }) => (
<InboxForm asWidget id={inbox.id} onSuccess={dismiss} />
),
})
}}
>
<i className="i-mgc-edit-cute-re" />
</Button>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
<div className="center flex">
<Button
className="flex items-center gap-2"
onClick={() =>
present({
title: t("sidebar.feed_actions.new_inbox"),
content: ({ dismiss }) => <InboxForm asWidget onSuccess={dismiss} />,
})
}
>
<i className="i-mgc-add-cute-re" />
{t("discover.inbox_create")}
</Button>
</div>
</>
)
}
const ConfirmDestroyModalContent = ({ id, dismiss }: { id: string; dismiss: () => void }) => {
const { t } = useTranslation()
const mutationDestroy = useMutation({
mutationFn: async (id: string) => {
await apiClient.inboxes.$delete({
json: {
handle: id,
},
})
},
onSuccess: (_, handle) => {
inboxActions.clearByInboxId(handle)
toast.success(t("discover.inbox_destroy_success"))
dismiss()
},
onError: () => {
toast.error(t("discover.inbox_destroy_error"))
},
})
return (
<div className="w-[512px]">
<div className="mb-4 text-red-600">{t("discover.inbox_destroy_warning")}</div>
<div className="flex justify-end">
<Button onClick={() => mutationDestroy.mutate(id)}>{t("words.confirm")}</Button>
</div>
</div>
)
}
@@ -0,0 +1,356 @@
import { zodResolver } from "@hookform/resolvers/zod"
import { useMutation } from "@tanstack/react-query"
import { useEffect, useRef } from "react"
import { useForm } from "react-hook-form"
import { useTranslation } from "react-i18next"
import { toast } from "sonner"
import { z } from "zod"
import { FollowSummary } from "~/components/feed-summary"
import { Logo } from "~/components/icons/logo"
import { Button } from "~/components/ui/button"
import { Card, CardHeader } from "~/components/ui/card"
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
} from "~/components/ui/form"
import { Input } from "~/components/ui/input"
import { LoadingCircle } from "~/components/ui/loading"
import { useCurrentModal } from "~/components/ui/modal"
import { Switch } from "~/components/ui/switch"
import { useI18n } from "~/hooks/common"
import { apiClient } from "~/lib/api-fetch"
import { tipcClient } from "~/lib/client"
import { FeedViewType } from "~/lib/enum"
import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser"
import { getNewIssueUrl } from "~/lib/issues"
import { cn } from "~/lib/utils"
import type { ListModel } from "~/models"
import { lists as listsQuery, useList } from "~/queries/lists"
import { subscription as subscriptionQuery } from "~/queries/subscriptions"
import { useListById } from "~/store/list"
import { useSubscriptionByFeedId } from "~/store/subscription"
import { feedUnreadActions } from "~/store/unread"
import { ViewSelectorRadioGroup } from "../shared/ViewSelectorRadioGroup"
const formSchema = z.object({
view: z.string(),
category: z.string().nullable().optional(),
isPrivate: z.boolean().optional(),
title: z.string().optional(),
})
const defaultValue = { view: FeedViewType.Articles.toString() } as z.infer<typeof formSchema>
export const ListForm: Component<{
id?: string
defaultValues?: z.infer<typeof formSchema>
asWidget?: boolean
onSuccess?: () => void
}> = ({ id: _id, defaultValues = defaultValue, asWidget, onSuccess }) => {
const queryParams = { id: _id }
const feedQuery = useList(queryParams)
const id = feedQuery.data?.list.id || _id
const list = useListById(id)
const hasSub = useSubscriptionByFeedId(list?.id || "")
const isSubscribed = !!feedQuery.data?.subscription || hasSub
const { t } = useTranslation()
return (
<div
className={cn(
"flex h-full flex-col",
asWidget ? "min-h-[420px] w-[550px] max-w-full" : "px-[18px] pb-[18px] pt-12",
)}
>
{!asWidget && (
<div className="mb-4 mt-2 flex items-center gap-2 text-[22px] font-bold">
<Logo className="size-8" />
{isSubscribed ? t("feed_form.update_follow") : t("feed_form.add_follow")}
</div>
)}
{list ? (
<ListInnerForm
{...{
defaultValues,
id,
asWidget,
onSuccess,
subscriptionData: feedQuery.data?.subscription,
list,
}}
/>
) : feedQuery.isLoading ? (
<div className="flex flex-1 items-center justify-center">
<LoadingCircle size="large" />
</div>
) : feedQuery.error ? (
<div className="center grow flex-col gap-3">
<i className="i-mgc-close-cute-re size-7 text-red-500" />
<p>{t("feed_form.error_fetching_feed")}</p>
<p className="cursor-text select-text break-all px-8 text-center">
{getFetchErrorMessage(feedQuery.error)}
</p>
<div className="flex items-center gap-4">
<Button
variant="text"
onClick={() => {
feedQuery.refetch()
}}
>
{t("feed_form.retry")}
</Button>
<Button
variant="primary"
onClick={() => {
window.open(
getNewIssueUrl({
body: [
"### Info:",
"",
"List ID:",
"```",
id,
"```",
"",
"Error:",
"```",
getFetchErrorMessage(feedQuery.error),
"```",
].join("\n"),
title: `Error in fetching list: ${id}`,
}),
"_blank",
)
}}
>
{t("feed_form.feedback")}
</Button>
</div>
</div>
) : (
<div className="center h-full grow flex-col">
<i className="i-mgc-question-cute-re mb-6 size-12 text-zinc-500" />
<p>{t("feed_form.feed_not_found")}</p>
<p>{id}</p>
</div>
)}
</div>
)
}
const ListInnerForm = ({
defaultValues,
id,
asWidget,
onSuccess,
subscriptionData,
list,
}: {
defaultValues?: z.infer<typeof formSchema>
id?: string
asWidget?: boolean
onSuccess?: () => void
subscriptionData?: {
view?: number
category?: string | null
isPrivate?: boolean
title?: string | null
}
list: ListModel
}) => {
const subscription = useSubscriptionByFeedId(id || "") || subscriptionData
const isSubscribed = !!subscription
const buttonRef = useRef<HTMLButtonElement>(null)
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
...defaultValues,
view: list.view.toString(),
},
})
const { setClickOutSideToDismiss, dismiss } = useCurrentModal()
useEffect(() => {
setClickOutSideToDismiss(!form.formState.isDirty)
}, [form.formState.isDirty])
useEffect(() => {
if (subscription) {
form.setValue("view", `${subscription?.view}`)
form.setValue("isPrivate", subscription?.isPrivate || false)
form.setValue("title", subscription?.title || "")
}
}, [subscription])
const followMutation = useMutation({
mutationFn: async (values: z.infer<typeof formSchema>) => {
const body = {
listId: list.id,
view: Number.parseInt(values.view),
category: values.category,
isPrivate: values.isPrivate,
title: values.title,
}
const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post
return $method({
json: body,
})
},
onSuccess: (_, variables) => {
if (isSubscribed && variables.view !== `${subscription?.view}`) {
subscriptionQuery.byView(subscription?.view).invalidate()
tipcClient?.invalidateQuery(subscriptionQuery.byView(subscription?.view).key)
feedUnreadActions.fetchUnreadByView(subscription?.view)
}
subscriptionQuery.byView(Number.parseInt(variables.view)).invalidate()
tipcClient?.invalidateQuery(subscriptionQuery.byView(Number.parseInt(variables.view)).key)
feedUnreadActions.fetchUnreadByView(Number.parseInt(variables.view))
const listId = list.id
if (listId) {
listsQuery.byId({ id: listId }).invalidate()
tipcClient?.invalidateQuery(listsQuery.byId({ id: listId }).key)
}
toast(isSubscribed ? t("feed_form.updated") : t("feed_form.followed"), {
duration: 1000,
})
if (!asWidget && !isSubscribed) {
window.close()
}
onSuccess?.()
},
async onError(err) {
toastFetchError(err)
},
})
function onSubmit(values: z.infer<typeof formSchema>) {
followMutation.mutate(values)
}
const t = useI18n()
return (
<div className="flex flex-1 flex-col gap-y-4">
<Card>
<CardHeader>
<FollowSummary feed={list} />
</CardHeader>
</Card>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)} className="flex flex-1 flex-col gap-y-4">
<FormField
control={form.control}
name="view"
render={() => (
<FormItem>
<FormLabel>{t("feed_form.view")}</FormLabel>
<ViewSelectorRadioGroup
{...form.register("view")}
disabled={true}
className="opacity-60"
/>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="title"
render={({ field }) => (
<FormItem>
<div>
<FormLabel>{t("feed_form.title")}</FormLabel>
<FormDescription>{t("feed_form.title_description")}</FormDescription>
</div>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="isPrivate"
render={({ field }) => (
<FormItem>
<div className="flex items-center justify-between">
<div>
<FormLabel>{t("feed_form.private_follow")}</FormLabel>
<FormDescription>{t("feed_form.private_follow_description")}</FormDescription>
</div>
<FormControl>
<Switch
className="shrink-0"
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
</div>
</FormItem>
)}
/>
{!!list.fee && !isSubscribed && (
<div>
<FormLabel className="flex items-center gap-1">
{t("feed_form.fee")}{" "}
<div className="ml-2 flex scale-[0.85] items-center gap-1">
{list.fee}
<i className="i-mgc-power size-4 text-accent" />
</div>
</FormLabel>
<FormDescription className="mt-0.5">{t("feed_form.fee_description")}</FormDescription>
</div>
)}
<div className="flex flex-1 items-end justify-end gap-4">
{isSubscribed && (
<Button
type="button"
ref={buttonRef}
variant="text"
onClick={() => {
dismiss()
}}
>
{t.common("cancel")}
</Button>
)}
<Button ref={buttonRef} type="submit" isLoading={followMutation.isPending}>
{isSubscribed
? t("feed_form.update")
: list.fee
? t("feed_form.follow_with_fee", {
fee: list.fee,
})
: t("feed_form.follow")}
</Button>
</div>
</form>
</Form>
</div>
)
}
@@ -8,7 +8,7 @@ import { useRouteParams, useRouteParamsSelector } from "~/hooks/biz/useRoutePara
import { useAuthQuery } from "~/hooks/common"
import { entries, useEntries } from "~/queries/entries"
import { entryActions, useEntryIdsByFeedIdOrView } from "~/store/entry"
import { isListSubscription, useFolderFeedsByFeedId } from "~/store/subscription"
import { useFolderFeedsByFeedId } from "~/store/subscription"
import { feedUnreadActions } from "~/store/unread"
export const useEntryMarkReadHandler = (entriesIds: string[]) => {
@@ -59,8 +59,7 @@ export const useEntriesByView = ({
const routeParams = useRouteParams()
const unreadOnly = useGeneralSettingKey("unreadOnly")
const { feedId, view, isAllFeeds, isCollection } = routeParams
const isList = isListSubscription(feedId)
const { feedId, view, isAllFeeds, isCollection, listId, inboxId } = routeParams
const folderIds = useFolderFeedsByFeedId({
feedId,
@@ -68,11 +67,12 @@ export const useEntriesByView = ({
})
const entriesOptions = {
id: folderIds?.join(",") || feedId,
feedId: folderIds?.join(",") || feedId,
inboxId,
listId,
view,
...(unreadOnly === true && { read: false }),
isArchived,
isList,
}
const query = useEntries(entriesOptions)
@@ -169,10 +169,10 @@ export const useEntriesByView = ({
() =>
isCollection
? sortEntriesIdByStarAt(mergedEntries[view])
: isList
: listId
? sortEntriesIdByEntryInsertedAt(mergedEntries[view])
: sortEntriesIdByEntryPublishedAt(mergedEntries[view]),
[isCollection, isList, mergedEntries, view],
[isCollection, listId, mergedEntries, view],
)
const groupByDate = useGeneralSettingKey("groupByDate")
@@ -192,7 +192,7 @@ export const useEntriesByView = ({
continue
}
const date = new Date(
isList ? entry.entries.insertedAt : entry.entries.publishedAt,
listId ? entry.entries.insertedAt : entry.entries.publishedAt,
).toDateString()
if (date !== lastDate) {
counts.push(1)
@@ -99,7 +99,7 @@ function EntryColumnImpl() {
!isCollection &&
routeFeedId !== ROUTE_FEED_PENDING &&
entries.totalCount < 40 &&
feed?.type !== "list"
feed?.type === "feed"
const scrollRef = useRef<HTMLDivElement>(null)
const virtuosoOptions = {
@@ -46,7 +46,9 @@ export function ListItem({
const handlePrefetchEntry = useDebounceCallback(
() => {
Queries.entries.byId(entryId).prefetch()
feed?.type === "inbox"
? Queries.entries.byInboxId(entryId).prefetch()
: Queries.entries.byId(entryId).prefetch()
},
300,
{ leading: false },
+62 -4
View File
@@ -9,7 +9,7 @@ import { FeedIcon } from "~/components/feed-icon"
import { OouiUserAnonymous } from "~/components/icons/OouiUserAnonymous"
import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "~/components/ui/tooltip"
import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography"
import { useFeedActions, useListActions } from "~/hooks/biz/useFeedActions"
import { useFeedActions, useInboxActions, useListActions } from "~/hooks/biz/useFeedActions"
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams"
import { useAnyPointDown } from "~/hooks/common"
@@ -19,6 +19,7 @@ import { getNewIssueUrl } from "~/lib/issues"
import { showNativeMenu } from "~/lib/native-menu"
import { cn } from "~/lib/utils"
import { getPreferredTitle, useFeedById } from "~/store/feed"
import { useInboxById } from "~/store/inbox"
import { useListById } from "~/store/list"
import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription"
import { useFeedUnreadStore } from "~/store/unread"
@@ -173,7 +174,7 @@ const ListItemImpl: Component<{
}> = ({ view, listId, className }) => {
const list = useListById(listId)
const isActive = useRouteParamsSelector((routerParams) => routerParams.feedId === listId)
const isActive = useRouteParamsSelector((routerParams) => routerParams.listId === listId)
const { items } = useListActions({ listId, view })
const listUnread = useFeedUnreadStore((state) => state.data[listId] || 0)
@@ -189,7 +190,7 @@ const ListItemImpl: Component<{
e.stopPropagation()
navigate({
feedId: listId,
listId,
entryId: null,
view,
})
@@ -220,7 +221,7 @@ const ListItemImpl: Component<{
<div className={"flex min-w-0 items-center"}>
<FeedIcon fallback feed={list} size={28} />
<EllipsisHorizontalTextWithTooltip className="truncate">
{list.title}
{getPreferredTitle(list)}
</EllipsisHorizontalTextWithTooltip>
{subscription.isPrivate && (
@@ -240,3 +241,60 @@ const ListItemImpl: Component<{
}
export const ListItem = memo(ListItemImpl)
const InboxItemImpl: Component<{
inboxId: string
view: FeedViewType
}> = ({ view, inboxId, className }) => {
const inbox = useInboxById(inboxId)
const isActive = useRouteParamsSelector((routerParams) => routerParams.inboxId === inboxId)
const { items } = useInboxActions({ inboxId })
const inboxUnread = useFeedUnreadStore((state) => state.data[inboxId] || 0)
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
useAnyPointDown(() => {
setIsContextMenuOpen(false)
})
const navigate = useNavigateEntry()
const handleNavigate = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
e.stopPropagation()
navigate({
inboxId,
entryId: null,
view,
})
},
[inboxId, navigate, view],
)
if (!inbox) return null
return (
<div
data-inbox-id={inboxId}
className={cn(
"flex w-full cursor-menu items-center justify-between rounded-md pr-2.5 text-sm font-medium leading-loose",
(isActive || isContextMenuOpen) && "bg-native-active",
"py-[2px] pl-2.5",
className,
)}
onClick={handleNavigate}
onContextMenu={(e) => {
setIsContextMenuOpen(true)
showNativeMenu(items, e)
}}
>
<div className={"flex min-w-0 items-center"}>
<FeedIcon fallback feed={inbox} size={16} />
<EllipsisHorizontalTextWithTooltip className="truncate">
{getPreferredTitle(inbox)}
</EllipsisHorizontalTextWithTooltip>
</div>
<UnreadNumber unread={inboxUnread} className="ml-2" />
</div>
)
}
export const InboxItem = memo(InboxItemImpl)
+41 -8
View File
@@ -22,7 +22,7 @@ import {
import { useFeedUnreadStore } from "~/store/unread"
import { getFeedListSort, setFeedListSortBy, setFeedListSortOrder, useFeedListSort } from "./atom"
import { SortableFeedList, SortByAlphabeticalList } from "./sort-by"
import { SortableFeedList, SortByAlphabeticalInbox, SortByAlphabeticalList } from "./sort-by"
import { UnreadNumber } from "./unread-number"
const useFeedsGroupedData = (view: FeedViewType) => {
@@ -57,12 +57,32 @@ const useListsGroupedData = (view: FeedViewType) => {
return useMemo(() => {
if (!data || data.length === 0) return {}
const lists = data.filter((s) => "listId" in s)
const groupFolder = {} as Record<string, string[]>
for (const subscription of data) {
if (!subscription.category && !subscription.defaultCategory) {
groupFolder[subscription.feedId] = [subscription.feedId]
}
for (const subscription of lists) {
groupFolder[subscription.feedId] = [subscription.feedId]
}
return groupFolder
}, [data])
}
const useInboxesGroupedData = (view: FeedViewType) => {
const { data: remoteData } = useAuthQuery(Queries.subscription.byView(view))
const data = useSubscriptionByView(view) || remoteData
return useMemo(() => {
if (!data || data.length === 0) return {}
const inboxes = data.filter((s) => "inboxId" in s)
const groupFolder = {} as Record<string, string[]>
for (const subscription of inboxes) {
groupFolder[subscription.feedId] = [subscription.feedId]
}
return groupFolder
@@ -78,6 +98,7 @@ const useUpdateUnreadCount = () => {
function FeedListImpl({ className, view }: { className?: string; view: number }) {
const feedsData = useFeedsGroupedData(view)
const listsData = useListsGroupedData(view)
const inboxesData = useInboxesGroupedData(view)
const categoryOpenStateData = useCategoryOpenStateByView(view)
const expansion = Object.values(categoryOpenStateData).every((value) => value === true)
useUpdateUnreadCount()
@@ -93,7 +114,10 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
return unread
})
const hasData = Object.keys(feedsData).length > 0 || Object.keys(listsData).length > 0
const hasData =
Object.keys(feedsData).length > 0 ||
Object.keys(listsData).length > 0 ||
Object.keys(inboxesData).length > 0
const feedId = useRouteFeedId()
const navigateEntry = useNavigateEntry()
@@ -104,6 +128,8 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
useAuthQuery(Queries.lists.list())
const hasListData = Object.keys(listsData).length > 0
const hasInboxData = Object.keys(inboxesData).length > 0
return (
<div className={cn(className, "font-medium")}>
<div onClick={stopPropagation} className="mx-3 flex items-center justify-between px-2.5 py-1">
@@ -164,11 +190,18 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
<div className="mt-1 flex h-6 w-full shrink-0 items-center rounded-md px-2.5 text-xs font-semibold text-theme-vibrancyFg transition-colors">
{t("words.lists")}
</div>
<SortByAlphabeticalList view={view} />
</>
)}
{hasListData && hasData && (
{hasInboxData && (
<>
<div className="mt-1 flex h-6 w-full shrink-0 items-center rounded-md px-2.5 text-xs font-semibold text-theme-vibrancyFg transition-colors">
{t("words.inbox")}
</div>
<SortByAlphabeticalInbox view={view} />
</>
)}
{(hasListData || hasInboxData) && (
<div
className={cn(
"mb-1 flex h-6 w-full shrink-0 items-center rounded-md px-2.5 text-xs font-semibold text-theme-vibrancyFg transition-colors",
@@ -2,12 +2,13 @@ import { Fragment, useMemo } from "react"
import { sortByAlphabet } from "~/lib/utils"
import { getPreferredTitle, useFeedStore } from "~/store/feed"
import { useInboxByView } from "~/store/inbox"
import { useListByView } from "~/store/list"
import { getSubscriptionByFeedId } from "~/store/subscription"
import { useFeedListSortSelector } from "../atom"
import { FeedCategory } from "../category"
import { ListItem } from "../item"
import { InboxItem, ListItem } from "../item"
import type { FeedListProps, ListListProps } from "./types"
export const SortByAlphabeticalFeedList = ({
@@ -84,3 +85,25 @@ export const SortByAlphabeticalListList = ({ view }: ListListProps) => {
</div>
)
}
export const SortByAlphabeticalInboxList = ({ view }: ListListProps) => {
const isDesc = useFeedListSortSelector((s) => s.order === "desc")
const inboxes = useInboxByView(view)
const sortedInboxes = useMemo(() => {
const res = inboxes.sort((a, b) => {
return sortByAlphabet(a.title ?? "", b.title ?? "")
})
return isDesc ? res.reverse() : res
}, [isDesc, inboxes])
return (
<div>
{sortedInboxes.map((inbox) => (
<InboxItem key={inbox.id} inboxId={inbox.id} view={view} />
))}
</div>
)
}
@@ -1,5 +1,9 @@
import { useFeedListSortSelector } from "../atom"
import { SortByAlphabeticalFeedList, SortByAlphabeticalListList } from "./SortByAlphabeticalList"
import {
SortByAlphabeticalFeedList,
SortByAlphabeticalInboxList,
SortByAlphabeticalListList,
} from "./SortByAlphabeticalList"
import { SortByUnreadFeedList } from "./SortByUnreadList"
import type { FeedListProps, ListListProps } from "./types"
@@ -25,3 +29,13 @@ export const SortByAlphabeticalList = (props: ListListProps) => {
}
}
}
export const SortByAlphabeticalInbox = (props: ListListProps) => {
const by = useFeedListSortSelector((s) => s.by)
switch (by) {
default: {
return <SortByAlphabeticalInboxList {...props} />
}
}
}
@@ -5,6 +5,7 @@ import { useSearchParams } from "react-router-dom"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs"
import { DiscoverForm } from "~/modules/discover/form"
import { DiscoverImport } from "~/modules/discover/import"
import { DiscoverInboxList } from "~/modules/discover/inbox-list-form"
import { Recommendations } from "~/modules/discover/recommendations"
import { DiscoverRSS3 } from "~/modules/discover/rss3-form"
import { DiscoverUser } from "~/modules/discover/user-form"
@@ -28,6 +29,10 @@ const tabs: {
name: "words.rsshub",
value: "rsshub",
},
{
name: "words.inbox",
value: "inbox",
},
{
name: "words.rss3",
value: "rss3",
@@ -36,11 +41,6 @@ const tabs: {
name: "words.user",
value: "user",
},
{
name: "words.email",
value: "email",
disabled: true,
},
{
name: "words.import",
value: "import",
@@ -84,9 +84,10 @@ export function Component() {
)
}
const TabComponent: Record<string, React.FC<{ type: string }>> = {
const TabComponent: Record<string, React.FC<{ type?: string }>> = {
import: DiscoverImport,
rss3: DiscoverRSS3,
inbox: DiscoverInboxList,
user: DiscoverUser,
default: DiscoverForm,
}
@@ -8,6 +8,7 @@ import { getGeneralSettings } from "~/atoms/settings/general"
import { getUISettings } from "~/atoms/settings/ui"
import { useModalStack } from "~/components/ui/modal"
import { FeedForm } from "~/modules/discover/feed-form"
import { ListForm } from "~/modules/discover/list-form"
import { usePresentUserProfileModal } from "~/modules/profile/hooks"
export const ExtensionExposeProvider = () => {
@@ -38,15 +39,12 @@ export const ExtensionExposeProvider = () => {
title: options?.isList
? t("sidebar.feed_actions.edit_list")
: t("sidebar.feed_actions.edit_feed"),
content: ({ dismiss }) => (
<FeedForm
asWidget
id={options?.id}
url={options?.url}
onSuccess={dismiss}
isList={options?.isList}
/>
),
content: ({ dismiss }) =>
options?.isList ? (
<ListForm asWidget id={options?.id} onSuccess={dismiss} />
) : (
<FeedForm asWidget id={options?.id} url={options?.url} onSuccess={dismiss} />
),
})
},
+35 -17
View File
@@ -7,23 +7,29 @@ import { entryHistoryActions } from "~/store/entry-history/action"
export const entries = {
entries: ({
id,
feedId,
inboxId,
listId,
view,
read,
limit,
isArchived,
}: {
id?: number | string
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
read?: boolean
limit?: number
isArchived?: boolean
}) =>
defineQuery(
["entries", id, view, read, limit],
["entries", inboxId || listId || feedId, view, read, limit],
async ({ pageParam }) =>
entryActions.fetchEntries({
id,
feedId,
inboxId,
listId,
view,
read,
limit,
@@ -31,7 +37,7 @@ export const entries = {
isArchived,
}),
{
rootKey: ["entries", id],
rootKey: ["entries", inboxId || listId || feedId],
structuralSharing: false,
},
),
@@ -39,6 +45,10 @@ export const entries = {
defineQuery(["entry", id], async () => entryActions.fetchEntryById(id), {
rootKey: ["entries"],
}),
byInboxId: (id: string) =>
defineQuery(["entry", id], async () => entryActions.fetchInboxEntryById(id), {
rootKey: ["entries"],
}),
preview: (id: string) =>
defineQuery(
["entries-preview", id],
@@ -57,22 +67,28 @@ export const entries = {
),
checkNew: ({
id,
feedId,
inboxId,
listId,
view,
read,
fetchedTime,
}: {
id?: number | string
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
read?: boolean
fetchedTime: number
}) =>
defineQuery(
["entry-checkNew", id, view, read, fetchedTime],
["entry-checkNew", inboxId || listId || feedId, view, read, fetchedTime],
async () => {
const query = {
...getEntriesParams({
id,
feedId,
inboxId,
listId,
view,
}),
read,
@@ -95,7 +111,7 @@ export const entries = {
},
{
rootKey: ["entry-checkNew", id],
rootKey: ["entry-checkNew", inboxId || listId || feedId],
},
),
@@ -110,22 +126,24 @@ export const entries = {
}
export const useEntries = ({
id,
feedId,
inboxId,
listId,
view,
read,
isArchived,
isList,
}: {
id?: number | string
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
read?: boolean
isArchived?: boolean
isList?: boolean
}) =>
useAuthInfiniteQuery(entries.entries({ id, view, read, isArchived }), {
enabled: id !== undefined,
useAuthInfiniteQuery(entries.entries({ feedId, inboxId, listId, view, read, isArchived }), {
enabled: feedId !== undefined || inboxId !== undefined || listId !== undefined,
getNextPageParam: (lastPage) =>
isList
inboxId
? lastPage.data?.at(-1)?.entries.insertedAt
: lastPage.data?.at(-1)?.entries.publishedAt,
initialPageParam: undefined,
+3 -5
View File
@@ -12,14 +12,13 @@ import { feedActions } from "~/store/feed"
import { entries } from "./entries"
export const feed = {
byId: ({ id, url, isList }: FeedQueryParams) =>
byId: ({ id, url }: FeedQueryParams) =>
defineQuery(
["feed", id, url],
async () =>
feedActions.fetchFeedById({
id,
url,
isList,
}),
{
rootKey: ["feed"],
@@ -41,12 +40,11 @@ export const feed = {
}),
}
export const useFeed = ({ id, url, isList }: FeedQueryParams) =>
export const useFeed = ({ id, url }: FeedQueryParams) =>
useAuthQuery(
feed.byId({
id,
url,
isList,
}),
{
enabled:
@@ -78,7 +76,7 @@ export const useRefreshFeedMutation = (feedId?: string) =>
if (!feedId) return
entries
.entries({
id: feedId!,
feedId: feedId!,
})
.invalidateRoot()
},
+15
View File
@@ -0,0 +1,15 @@
import { useAuthQuery } from "~/hooks/common"
import { defineQuery } from "~/lib/defineQuery"
import { inboxActions } from "~/store/inbox"
export const inboxes = {
byId: ({ id }: { id: string }) =>
defineQuery(["lists", id], async () => inboxActions.fetchInboxById(id), {
rootKey: ["lists"],
}),
}
export const useInbox = ({ id }: { id?: string }) =>
useAuthQuery(inboxes.byId({ id: id! }), {
enabled: !!id,
})
+2 -2
View File
@@ -13,7 +13,7 @@ export const lists = {
}),
}
export const useList = ({ id }: { id: string }) =>
useAuthQuery(lists.byId({ id }), {
export const useList = ({ id }: { id?: string }) =>
useAuthQuery(lists.byId({ id: id! }), {
enabled: !!id,
})
+33
View File
@@ -0,0 +1,33 @@
import { browserDB } from "~/database"
import type { InboxModel } from "~/models/types"
import { BaseService } from "./base"
import { CleanerService } from "./cleaner"
class ServiceStatic extends BaseService<{ id: string }> {
constructor() {
super(browserDB.inboxes)
}
override async upsertMany(data: InboxModel[]) {
CleanerService.reset(data.map((d) => ({ type: "feed", id: d.id! })))
return this.table.bulkPut(data)
}
override async findAll() {
return super.findAll() as unknown as InboxModel[]
}
override async upsert(data: InboxModel): Promise<string | null> {
if (!data.id) return null
CleanerService.reset([{ type: "feed", id: data.id }])
return this.table.put(data)
}
async bulkDelete(ids: string[]) {
return this.table.bulkDelete(ids)
}
}
export const InboxService = new ServiceStatic()
+1 -1
View File
@@ -27,7 +27,7 @@ class SubscriptionServiceStatic extends BaseService<SubscriptionModelWithId> {
override async upsertMany(data: SubscriptionFlatModel[]) {
return this.table.bulkPut(
data.map(({ feeds, ...d }: any) => ({
data.map(({ feeds, lists, inboxes, ...d }: any) => ({
...d,
id: this.uniqueId(d.userId, d.feedId),
})),
+49 -17
View File
@@ -10,6 +10,7 @@ import { EntryService } from "~/services"
import { feedActions } from "../feed"
import { imageActions } from "../image"
import { inboxActions } from "../inbox"
import { feedUnreadActions } from "../unread"
import { createZustandStore, doMutationAndTransaction } from "../utils/helper"
import { internal_batchMarkRead } from "./helper"
@@ -67,34 +68,65 @@ class EntryActions {
return data
}
async fetchInboxEntryById(entryId: string) {
const { data } = await apiClient.entries.inbox.$get({
query: {
id: entryId,
},
})
if (data) {
this.upsertMany([
// patch data, should omit `read` because the network race condition or server cache
omit(data, "read") as any,
])
inboxActions.upsertMany([data.feeds])
}
return data
}
async fetchEntries({
id,
feedId,
inboxId,
listId,
view,
read,
limit,
pageParam,
isArchived,
}: {
id?: number | string
feedId?: number | string
inboxId?: number | string
listId?: number | string
view?: number
read?: boolean
limit?: number
pageParam?: string
isArchived?: boolean
}) {
const data = await apiClient.entries.$post({
json: {
publishedAfter: pageParam,
read,
limit,
isArchived,
// withContent: true,
...getEntriesParams({
id,
view,
}),
},
})
const data = inboxId
? await apiClient.entries.inbox.$post({
json: {
publishedAfter: pageParam,
limit,
inboxId: `${inboxId}`,
},
})
: await apiClient.entries.$post({
json: {
publishedAfter: pageParam,
read,
limit,
isArchived,
// withContent: true,
...getEntriesParams({
feedId,
inboxId,
listId,
view,
}),
},
})
if (data.data) {
this.upsertMany(data.data)
@@ -226,7 +258,7 @@ class EntryActions {
// Push entryFeedMap
entryFeedMap[item.entries.id] = item.feeds.id
// Push entryCollection
if (item.collections) {
if ("collections" in item) {
entryCollection[item.entries.id] = item.collections
}
@@ -294,7 +326,7 @@ class EntryActions {
)
// Push entryCollection
if (item.collections) {
if ("collections" in item) {
entryCollection[item.entries.id] = item.collections
}
}
+4
View File
@@ -133,6 +133,10 @@ export const getPreferredTitle = (feed?: FeedOrListRespModel | null) => {
return feed?.title
}
if (feed.type === "inbox") {
return feed.title || `${feed.id.slice(0, 1).toUpperCase()}${feed.id.slice(1)}'s Inbox`
}
const subscription = getSubscriptionByFeedId(feed.id)
return subscription?.title || feed.title
}
+1 -1
View File
@@ -5,4 +5,4 @@ type FeedId = string
export interface FeedState {
feeds: Record<FeedId, FeedOrListModel>
}
export type FeedQueryParams = { id?: string; url?: string; isList?: boolean }
export type FeedQueryParams = { id?: string; url?: string }
+11
View File
@@ -0,0 +1,11 @@
import type { FeedViewType } from "~/lib/enum"
import type { InboxModel } from "~/models"
import { useInboxStore } from "./store"
export const useInboxById = (inboxId: Nullable<string>): InboxModel | null =>
useInboxStore((state) => (inboxId ? state.inboxes[inboxId] : null))
export const useInboxByView = (view: FeedViewType) => {
return useInboxStore((state) => (view === 0 ? Object.values(state.inboxes) : []))
}
+3
View File
@@ -0,0 +1,3 @@
export * from "./hooks"
export * from "./store"
export * from "./types"
+52
View File
@@ -0,0 +1,52 @@
import { runTransactionInScope } from "~/database"
import { apiClient } from "~/lib/api-fetch"
import type { InboxModel } from "~/models"
import { InboxService } from "~/services/inbox"
import { createImmerSetter, createZustandStore } from "../utils/helper"
import type { InboxState } from "./types"
export const useInboxStore = createZustandStore<InboxState>("inbox")(() => ({
inboxes: {},
}))
const set = createImmerSetter(useInboxStore)
class InboxActionStatic {
upsertMany(inboxs: InboxModel[]) {
if (inboxs.length === 0) return
set((state) => {
for (const inbox of inboxs) {
state.inboxes[inbox.id] = inbox
}
return state
})
runTransactionInScope(() => InboxService.upsertMany(inboxs))
}
async fetchInboxById(id: string) {
const res = await apiClient.inboxes.$get({
query: {
handle: id,
},
})
this.upsertMany([res.data])
return res.data
}
clear() {
set((state) => {
state.inboxes = {}
})
}
clearByInboxId(id: string) {
set((state) => {
delete state.inboxes[id]
})
}
}
export const inboxActions = new InboxActionStatic()
+7
View File
@@ -0,0 +1,7 @@
import type { InboxModel } from "~/models"
type InboxId = string
export interface InboxState {
inboxes: Record<InboxId, InboxModel>
}
+13 -4
View File
@@ -7,12 +7,13 @@ import { runTransactionInScope } from "~/database"
import { apiClient } from "~/lib/api-fetch"
import { FeedViewType } from "~/lib/enum"
import { capitalizeFirstLetter } from "~/lib/utils"
import type { FeedModel, ListModelPoplutedFeeds, SubscriptionModel } from "~/models"
import type { FeedModel, InboxModel, ListModelPoplutedFeeds, SubscriptionModel } from "~/models"
import { SubscriptionService } from "~/services"
import { entryActions } from "../entry"
import { feedActions, getFeedById } from "../feed"
import { listActions } from "../list/store"
import { inboxActions } from "../inbox"
import { listActions } from "../list"
import { feedUnreadActions } from "../unread"
import { createZustandStore, doMutationAndTransaction } from "../utils/helper"
@@ -120,16 +121,20 @@ class SubscriptionActions {
const feeds = [] as FeedModel[]
const lists = [] as ListModelPoplutedFeeds[]
const inboxes = [] as InboxModel[]
for (const subscription of res.data) {
if ("feeds" in subscription) {
feeds.push(subscription.feeds)
} else {
} else if ("lists" in subscription) {
lists.push(subscription.lists)
} else if ("inboxes" in subscription) {
inboxes.push(subscription.inboxes)
}
}
this.updateCategoryOpenState(transformedData.filter((s) => s.category || s.defaultCategory))
feedActions.upsertMany(feeds)
listActions.upsertMany(lists)
inboxActions.upsertMany(inboxes)
return res.data
}
@@ -141,7 +146,11 @@ class SubscriptionActions {
set((state) =>
produce(state, (state) => {
subscriptions.forEach((subscription) => {
state.data[subscription.feedId] = omit(subscription, "feeds")
state.data[subscription.feedId] = omit(subscription, [
"feeds",
"lists",
"inboxes",
]) as SubscriptionFlatModel
state.feedIdByView[subscription.view].push(subscription.feedId)
return state
})
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path fill="#10161F" fill-rule="evenodd" d="M11.093 4h1.814c1.09 0 1.982 0 2.714.072.765.076 1.435.237 2.067.603.633.367 1.105.87 1.55 1.497.426.6.868 1.373 1.409 2.32l.836 1.463c.339.593.57.991.726 1.426.093.262.165.53.214.804.096.542.077 1.1.077 1.647 0 1.229 0 2.22-.074 3.018-.076.823-.236 1.542-.62 2.192a5 5 0 0 1-1.764 1.763c-.65.384-1.369.545-2.192.621-.799.074-1.79.074-3.018.074H9.168c-1.229 0-2.22 0-3.018-.074-.823-.076-1.542-.236-2.192-.62a5 5 0 0 1-1.763-1.764c-.384-.65-.545-1.369-.621-2.192-.074-.799-.074-1.79-.074-3.018 0-.548-.019-1.105.078-1.647.048-.273.12-.542.213-.804.155-.435.387-.833.726-1.426l.836-1.463c.541-.947.983-1.72 1.41-2.32.445-.627.916-1.13 1.549-1.497.632-.366 1.302-.527 2.067-.603C9.112 4 10.003 4 11.093 4M8.576 6.063c-.6.06-.962.169-1.26.342-.3.174-.574.433-.923.925-.363.51-.756 1.197-1.328 2.197l-.812 1.42c-.343.602-.475.839-.558 1.053H6.5a3 3 0 0 1 3 3 1 1 0 0 0 1 1h3a1 1 0 0 0 1-1 3 3 0 0 1 3-3h2.805c-.083-.214-.215-.451-.558-1.053l-.812-1.42c-.572-1-.965-1.687-1.327-2.197-.35-.492-.625-.751-.924-.925-.298-.173-.66-.283-1.26-.342C14.802 6 14.01 6 12.858 6h-1.715c-1.153 0-1.945.001-2.567.063" clip-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

-1
View File
@@ -188,7 +188,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "استكشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "العناصر",
"words.language": "اللغة",
-1
View File
@@ -192,7 +192,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "اكتشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "عناصر",
"words.language": "اللغة",
-1
View File
@@ -192,7 +192,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "استكشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "عناصر",
"words.language": "اللغة",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "استكشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "عناصر",
"words.language": "اللغة",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "استكشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "عناصر",
"words.language": "اللغة",
-1
View File
@@ -192,7 +192,6 @@
"words.add": "إضافة",
"words.confirm": "تأكيد",
"words.discover": "استكشاف",
"words.email": "البريد الإلكتروني",
"words.import": "استيراد",
"words.items": "عناصر",
"words.language": "اللغة",
-1
View File
@@ -192,7 +192,6 @@
"words.add": "Hinzufügen",
"words.confirm": "Bestätigen",
"words.discover": "Entdecken",
"words.email": "E-Mail",
"words.import": "Importieren",
"words.items": "Elemente",
"words.language": "Sprache",
+25 -1
View File
@@ -21,6 +21,27 @@
"discover.import.parsedErrorItems": "Parsed Error Items",
"discover.import.result": "<SuccessfulNum /> feeds were successfully imported, <ConflictNum /> were already subscribed to, and <ErrorNum /> failed to import.",
"discover.import.successfulItems": "Successful Items",
"discover.inbox.actions": "Actions",
"discover.inbox.description": "You can receive information via email and webhooks through the inbox.",
"discover.inbox.email": "Email",
"discover.inbox.handle": "Handle",
"discover.inbox.secret": "Secret",
"discover.inbox.title": "Title",
"discover.inbox.webhooks_docs": "Webhooks docs.",
"discover.inbox_create": "New Inbox",
"discover.inbox_create_description": "You don't have an inbox yet. Create an inbox to receive information via inbox.",
"discover.inbox_create_error": "Failed to create inbox.",
"discover.inbox_create_success": "Inbox created successfully.",
"discover.inbox_destroy": "Destroy",
"discover.inbox_destroy_confirm": "Confirm destroy the inbox?",
"discover.inbox_destroy_error": "Failed to destroy inbox.",
"discover.inbox_destroy_success": "Inbox destroyed successfully.",
"discover.inbox_destroy_warning": "Warning: once destroyed, the email will no longer be available, and all content will be permanently deleted and unrecoverable.",
"discover.inbox_handle": "Handle",
"discover.inbox_title": "Title",
"discover.inbox_update": "Update",
"discover.inbox_update_error": "Failed to change inbox.",
"discover.inbox_update_success": "Inbox updated successfully.",
"discover.popular": "Popular",
"discover.preview": "Preview",
"discover.rss_hub_route": "RSSHub Route",
@@ -168,18 +189,21 @@
"sidebar.category_remove_dialog.title": "Remove Category",
"sidebar.feed_actions.claim": "Claim",
"sidebar.feed_actions.claim_feed": "Claim Feed",
"sidebar.feed_actions.copy_email_address": "Copy email address",
"sidebar.feed_actions.copy_feed_id": "Copy feed ID",
"sidebar.feed_actions.copy_feed_url": "Copy feed URL",
"sidebar.feed_actions.copy_list_id": "Copy list ID",
"sidebar.feed_actions.copy_list_url": "Copy list URL",
"sidebar.feed_actions.edit": "Edit",
"sidebar.feed_actions.edit_feed": "Edit feed",
"sidebar.feed_actions.edit_inbox": "Edit inbox",
"sidebar.feed_actions.edit_list": "Edit list",
"sidebar.feed_actions.feed_owned_by_you": "This feed is owned by you",
"sidebar.feed_actions.list_owned_by_you": "This list is owned by you",
"sidebar.feed_actions.mark_all_as_read": "Mark all as read",
"sidebar.feed_actions.navigate_to_feed": "Navigate to feed",
"sidebar.feed_actions.navigate_to_list": "Navigate to list",
"sidebar.feed_actions.new_inbox": "New inbox",
"sidebar.feed_actions.open_feed_in_browser": "Open feed in {{which}}",
"sidebar.feed_actions.open_list_in_browser": "Open list in {{which}}",
"sidebar.feed_actions.open_site_in_browser": "Open site in {{which}}",
@@ -227,9 +251,9 @@
"words.browser": "Browser",
"words.confirm": "Confirm",
"words.discover": "Discover",
"words.email": "Email",
"words.feeds": "Feeds",
"words.import": "Import",
"words.inbox": "Inbox",
"words.items": "Items",
"words.language": "Language",
"words.lists": "Lists",
-1
View File
@@ -121,7 +121,6 @@
"words.add": "Añadir",
"words.confirm": "Confirmar",
"words.discover": "Descubrir",
"words.email": "Correo electrónico",
"words.import": "Importar",
"words.items": "Contenido",
"words.language": "Idioma",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "Lisää",
"words.confirm": "Vahvista",
"words.discover": "Löydä",
"words.email": "Sähköposti",
"words.import": "Tuo",
"words.items": "Kohteet",
"words.language": "Kieli",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "Ajouter",
"words.confirm": "Confirmer",
"words.discover": "Découvrir",
"words.email": "Email",
"words.import": "Importer",
"words.items": "Éléments",
"words.language": "Langue",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "Aggiungi",
"words.confirm": "Conferma",
"words.discover": "Scopri",
"words.email": "Email",
"words.import": "Importa",
"words.items": "Elementi",
"words.language": "Lingua",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "追加",
"words.confirm": "確認",
"words.discover": "発見",
"words.email": "メール",
"words.import": "インポート",
"words.items": "アイテム",
"words.language": "言語",
-1
View File
@@ -220,7 +220,6 @@
"words.add": "추가",
"words.confirm": "확인",
"words.discover": "찾아보기",
"words.email": "이메일",
"words.feeds": "피드",
"words.import": "가져오기",
"words.items": "항목",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "追加",
"words.confirm": "確認",
"words.discover": "発見",
"words.email": "メール",
"words.import": "インポート",
"words.items": "アイテム",
"words.language": "言語",
-1
View File
@@ -188,7 +188,6 @@
"words.add": "Добавить",
"words.confirm": "Подтвердить",
"words.discover": "Открыть",
"words.email": "Электронная почта",
"words.import": "Импорт",
"words.items": "Элементы",
"words.language": "Язык",
-1
View File
@@ -221,7 +221,6 @@
"words.add": "Ekle",
"words.confirm": "Onayla",
"words.discover": "Keşfet",
"words.email": "E-posta",
"words.feeds": "Beslemeler",
"words.import": "İçe Aktar",
"words.items": "Öğeler",
-1
View File
@@ -227,7 +227,6 @@
"words.browser": "浏览器",
"words.confirm": "确认",
"words.discover": "发现",
"words.email": "邮箱",
"words.feeds": "订阅源",
"words.import": "导入",
"words.items": "内容",
-1
View File
@@ -226,7 +226,6 @@
"words.browser": "瀏覽器",
"words.confirm": "確認",
"words.discover": "探索",
"words.email": "電子郵件",
"words.feeds": "訂閱源",
"words.import": "匯入",
"words.items": "項目",
-1
View File
@@ -226,7 +226,6 @@
"words.browser": "瀏覽器",
"words.confirm": "確認",
"words.discover": "發現",
"words.email": "Email",
"words.feeds": "摘要",
"words.import": "匯入",
"words.items": "內容",
+4 -1
View File
@@ -32,5 +32,8 @@
"8002": "List limit exceeded",
"8003": "Feed already added to list",
"9000": "Achievement not completed",
"9001": "Achievement already received"
"9001": "Achievement already received",
"10000": "Inbox not found",
"10001": "Inbox already exists",
"10002": "Inbox limit exceeded"
}
+1
View File
@@ -10,6 +10,7 @@ export const env = createEnv({
VITE_IMGPROXY_URL: z.string().url(),
VITE_SENTRY_DSN: z.string().optional(),
VITE_POSTHOG_KEY: z.string().optional(),
VITE_INBOXES_EMAIL: z.string().default("@follow.re"),
},
emptyStringAsUndefined: true,
File diff suppressed because it is too large Load Diff