Skip to content

Commit

Permalink
feat: add discover feed form from rsshub (#89)
Browse files Browse the repository at this point in the history
* feat: regexp path parser

Signed-off-by: Innei <i@innei.in>

* feat: markdown

Signed-off-by: Innei <i@innei.in>

* fix: shirk

Signed-off-by: Innei <i@innei.in>

* feat: discover form

Signed-off-by: Innei <i@innei.in>

* fix: modal overlay zindex

Signed-off-by: Innei <i@innei.in>

* feat: fill path

Signed-off-by: Innei <i@innei.in>

* feat: modal

Signed-off-by: Innei <i@innei.in>

* fix: card style

Signed-off-by: Innei <i@innei.in>

* fix: parser

Signed-off-by: Innei <i@innei.in>

* feat: add maintainers

Signed-off-by: Innei <i@innei.in>

* fix: select zindex

Signed-off-by: Innei <i@innei.in>

* fix: dismiss all

Signed-off-by: Innei <i@innei.in>

* feat: optimize a11y

Signed-off-by: Innei <i@innei.in>

* fix: dark mode style

Signed-off-by: Innei <i@innei.in>

---------

Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei authored Jun 26, 2024
1 parent 43e7d12 commit 57b643f
Show file tree
Hide file tree
Showing 38 changed files with 2,483 additions and 168 deletions.
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 dark:prose-invert prose-th:text-left")}
dangerouslySetInnerHTML={useMemo(
() => ({
__html: md.render(props.children as string),
}),
[props.children],
)}
/>
)
Loading

0 comments on commit 57b643f

Please sign in to comment.