Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add discover feed form from rsshub #89

Merged
merged 14 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ jobs:
run: |
pnpm run typecheck
npm run lint
pnpm run test
- name: Run test
run: pnpm test
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@
"lodash-es": "4.17.21",
"lowdb": "7.0.1",
"lucide-react": "0.396.0",
"markdown-it": "14.1.0",
"markdown-it-container": "4.0.0",
"ofetch": "1.3.4",
"path-to-regexp": "7.0.0",
"react-error-boundary": "4.0.13",
"react-helmet-async": "2.0.5",
"react-hook-form": "7.52.0",
"react-hotkeys-hook": "4.5.0",
Expand Down Expand Up @@ -108,6 +112,8 @@
"@tailwindcss/container-queries": "0.1.1",
"@tailwindcss/typography": "0.5.13",
"@types/lodash-es": "4.17.12",
"@types/markdown-it": "14.1.1",
"@types/markdown-it-container": "2.0.10",
"@types/node": "^20.14.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand Down
100 changes: 100 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const registerAppMenu = () => {
label: "follow https://rsshub.app/twitter/user/DIYgod",
click: () => {
createWindow({
extraPath: `/add?url=${encodeURIComponent(
extraPath: `#add?url=${encodeURIComponent(
"https://rsshub.app/twitter/user/DIYgod",
)}`,
width: 800,
Expand All @@ -55,7 +55,7 @@ export const registerAppMenu = () => {
label: "follow https://diygod.me/feed",
click: () => {
createWindow({
extraPath: `/add?url=${encodeURIComponent(
extraPath: `#add?url=${encodeURIComponent(
"https://diygod.me/feed",
)}`,
width: 800,
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/src/atoms/sidebar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createAtomHooks } from "@renderer/lib/jotai"
import { atom } from "jotai"

export const [
,
useSidebarActiveView,
useSidebarActiveViewValue,
useSetSidebarActiveView,
getSidebarActiveView,
setSidebarActiveView,
] = createAtomHooks(atom(0))
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const CopyButton: Component<{
}, [value])
return (
<MotionButtonBase
type="button"
onClick={handleCopy}
className={cn(
"center flex text-xs",
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/components/ui/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const FormItem = React.forwardRef<
const id = React.useId()

return (
<FormItemContext.Provider value={{ id }}>
<FormItemContext.Provider value={React.useMemo(() => ({ id }), [id])}>
<div ref={ref} className={cn("space-y-2", className)} {...props} />
</FormItemContext.Provider>
)
Expand Down
28 changes: 28 additions & 0 deletions src/renderer/src/components/ui/markdown/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* eslint-disable @eslint-react/dom/no-dangerously-set-innerhtml */
import { cn } from "@renderer/lib/utils"
import markdownit from "markdown-it"
import { useMemo } from "react"

import styles from "./index.module.css"
import { createContainer } from "./plugins/container"

const md = markdownit()
.use(...createContainer("tip", "TIP", () => md))
.use(...createContainer("info", "INFO", () => md))
.use(...createContainer("warning", "WARNING", () => md))
.use(...createContainer("danger", "DANGER", () => md))
.use(...createContainer("details", "Details", () => md))

export const Markdown: Component<{
children: string
}> = (props) => (
<div
className={cn(styles.markdown, props.className, "prose")}
dangerouslySetInnerHTML={useMemo(
() => ({
__html: md.render(props.children as string),
}),
[props.children],
)}
/>
)
Loading
Loading