Skip to content

Commit

Permalink
feat: replace all follow dialog with native new window
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed May 31, 2024
1 parent 2491d00 commit 4be62e6
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 342 deletions.
10 changes: 8 additions & 2 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ app.whenReady().then(() => {
})
mainWindow.reload()
}
} else {
createWindow({
extraPath: url.replace("follow:/", ""),
width: 800,
height: 600,
})
}
}

Expand Down Expand Up @@ -137,7 +143,7 @@ Menu.setApplicationMenu(
label: "follow https://rsshub.app/twitter/user/DIYgod",
click: () => {
createWindow({
extraPath: `/follow?url=${encodeURIComponent("https://rsshub.app/twitter/user/DIYgod")}`,
extraPath: `/add?url=${encodeURIComponent("https://rsshub.app/twitter/user/DIYgod")}`,
width: 800,
height: 600,
})
Expand All @@ -147,7 +153,7 @@ Menu.setApplicationMenu(
label: "follow https://diygod.me/feed",
click: () => {
createWindow({
extraPath: `/follow?url=${encodeURIComponent("https://diygod.me/feed")}`,
extraPath: `/add?url=${encodeURIComponent("https://diygod.me/feed")}`,
width: 800,
height: 600,
})
Expand Down
37 changes: 0 additions & 37 deletions src/renderer/src/components/discover/button.tsx

This file was deleted.

192 changes: 0 additions & 192 deletions src/renderer/src/components/discover/dialog.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions src/renderer/src/components/discover/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import { useForm } from "react-hook-form"
import { z } from "zod"

import { FollowSummary } from "../feed-summary"
import { DiscoverButton } from "./button"

const formSchema = z.object({
keyword: z.string().min(1),
Expand Down Expand Up @@ -186,7 +185,7 @@ export function DiscoverForm({ type }: { type: string }) {
</Button>
) :
(
<DiscoverButton feed={item.feed} />
<Button onClick={() => window.open(`follow://add${item.feed.id ? `?id=${item.feed.id}` : `?url=${item.feed.url}`}`)}>Follow</Button>
)}
<div className="ml-6 text-zinc-500">
<span className="font-medium text-zinc-800">
Expand Down
Loading

0 comments on commit 4be62e6

Please sign in to comment.