fix: add feed from url, close #686

This commit is contained in:
Stephen Zhou
2024-09-29 09:58:33 +08:00
parent 553ba7d61f
commit fd30789d86
3 changed files with 13 additions and 6 deletions
+4 -3
View File
@@ -24,10 +24,11 @@ export const handleUrlRouting = (url: string) => {
mainWindow.focus()
const caller = callWindowExpose(mainWindow)
const id = searchParams.get("id")
const id = searchParams.get("id") ?? undefined
const isList = searchParams.get("type") === "list"
if (!id) return
caller.follow(id, { isList })
const urlParam = searchParams.get("url") ?? undefined
if (!id && !url) return
caller.follow({ isList, id, url: urlParam })
return
}
default: {
@@ -33,13 +33,19 @@ export const ExtensionExposeProvider = () => {
const presentUserProfile = usePresentUserProfileModal("dialog")
useEffect(() => {
registerGlobalContext({
follow(id, options) {
follow(options) {
present({
title: options?.isList
? t("sidebar.feed_actions.edit_list")
: t("sidebar.feed_actions.edit_feed"),
content: ({ dismiss }) => (
<FeedForm asWidget id={id} onSuccess={dismiss} isList={options?.isList} />
<FeedForm
asWidget
id={options?.id}
url={options?.url}
onSuccess={dismiss}
isList={options?.isList}
/>
),
})
},
+1 -1
View File
@@ -21,7 +21,7 @@ interface RenderGlobalContext {
onWindowShow: () => void
/// Actions
follow: (id: string, options?: { isList: boolean }) => void
follow: (options?: { isList: boolean; id?: string; url?: string }) => void
profile: (id: string, variant?: "drawer" | "dialog") => void
/// Utils