Skip to content

Commit b044713

Browse files
committed
feat: rsshub add modal loading status
1 parent 6ebe99b commit b044713

File tree

2 files changed

+44
-37
lines changed

2 files changed

+44
-37
lines changed

apps/renderer/src/modules/rsshub/add-modal-content.tsx

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
FormMessage,
99
} from "@follow/components/ui/form/index.jsx"
1010
import { Input } from "@follow/components/ui/input/Input.js"
11+
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
1112
import type { RSSHubModel } from "@follow/models"
1213
import { zodResolver } from "@hookform/resolvers/zod"
1314
import { useEffect } from "react"
@@ -79,41 +80,47 @@ FOLLOW_PRICE=${instance?.price || 100} # The monthly price of yo
7980
FOLLOW_USER_LIMIT=${instance?.userLimit || 1000} # The user limit of your instance, set it to 0 or 1 can make your instance private, leaving it empty means no restriction`}
8081
language="dotenv"
8182
/>
82-
<Form {...form}>
83-
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
84-
<FormField
85-
control={form.control}
86-
name="baseUrl"
87-
render={({ field }) => (
88-
<FormItem>
89-
<FormLabel>{t("rsshub.addModal.base_url_label")}</FormLabel>
90-
<FormControl>
91-
<Input placeholder="https://" {...field} />
92-
</FormControl>
93-
<FormMessage />
94-
</FormItem>
95-
)}
96-
/>
97-
<FormField
98-
control={form.control}
99-
name="accessKey"
100-
render={({ field }) => (
101-
<FormItem>
102-
<FormLabel>{t("rsshub.addModal.access_key_label")}</FormLabel>
103-
<FormControl>
104-
<Input {...field} />
105-
</FormControl>
106-
<FormMessage />
107-
</FormItem>
108-
)}
109-
/>
110-
<div className="flex items-center justify-end">
111-
<Button type="submit" isLoading={addRSSHubMutation.isPending}>
112-
{t("rsshub.addModal.add")}
113-
</Button>
114-
</div>
115-
</form>
116-
</Form>
83+
{details.isLoading ? (
84+
<div className="center mt-12 flex w-full flex-col gap-8">
85+
<LoadingCircle size="large" />
86+
</div>
87+
) : (
88+
<Form {...form}>
89+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
90+
<FormField
91+
control={form.control}
92+
name="baseUrl"
93+
render={({ field }) => (
94+
<FormItem>
95+
<FormLabel>{t("rsshub.addModal.base_url_label")}</FormLabel>
96+
<FormControl>
97+
<Input placeholder="https://" {...field} />
98+
</FormControl>
99+
<FormMessage />
100+
</FormItem>
101+
)}
102+
/>
103+
<FormField
104+
control={form.control}
105+
name="accessKey"
106+
render={({ field }) => (
107+
<FormItem>
108+
<FormLabel>{t("rsshub.addModal.access_key_label")}</FormLabel>
109+
<FormControl>
110+
<Input {...field} />
111+
</FormControl>
112+
<FormMessage />
113+
</FormItem>
114+
)}
115+
/>
116+
<div className="flex items-center justify-end">
117+
<Button type="submit" isLoading={addRSSHubMutation.isPending}>
118+
{t("rsshub.addModal.add")}
119+
</Button>
120+
</div>
121+
</form>
122+
</Form>
123+
)}
117124
</div>
118125
)
119126
}

apps/renderer/src/pages/(main)/(layer)/(subview)/rsshub/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function List({ data }: { data?: RSSHubModel[] }) {
6464
const { present } = useModalStack()
6565

6666
return (
67-
<Table containerClassName="mt-2">
67+
<Table containerClassName="mt-2 overflow-x-auto">
6868
<TableHeader>
6969
<TableRow>
7070
<TableHead className="font-bold" size="sm" />
@@ -149,7 +149,7 @@ function List({ data }: { data?: RSSHubModel[] }) {
149149
<TableCell>{instance.userCount}</TableCell>
150150
<TableCell>{instance.userLimit || t("rsshub.table.unlimited")}</TableCell>
151151
<TableCell>
152-
<div className="flex items-center gap-2">
152+
<div className="flex w-max items-center gap-2">
153153
<Button
154154
className="shrink-0"
155155
variant={status?.data?.usage?.rsshubId === instance.id ? "outline" : "primary"}

0 commit comments

Comments
 (0)