Skip to content

Commit

Permalink
fix: add feed from url, close #686
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Sep 29, 2024
1 parent 553ba7d commit fd30789
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 4 additions & 3 deletions apps/main/src/lib/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
10 changes: 8 additions & 2 deletions apps/renderer/src/providers/extension-expose-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
),
})
},
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/src/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fd30789

Please sign in to comment.