mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-04 14:32:15 +08:00
Enhancement: Add Repositories field to Gitea (#5053)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
@@ -8,17 +8,21 @@ export default function Component({ service }) {
|
||||
|
||||
const { data: giteaNotifications, error: giteaNotificationsError } = useWidgetAPI(widget, "notifications");
|
||||
const { data: giteaIssues, error: giteaIssuesError } = useWidgetAPI(widget, "issues");
|
||||
const { data: giteaRepositories, error: giteaRepositoriesError } = useWidgetAPI(widget, "repositories");
|
||||
|
||||
if (giteaNotificationsError || giteaIssuesError) {
|
||||
return <Container service={service} error={giteaNotificationsError ?? giteaIssuesError} />;
|
||||
if (giteaNotificationsError || giteaIssuesError || giteaRepositoriesError) {
|
||||
return (
|
||||
<Container service={service} error={giteaNotificationsError ?? giteaIssuesError ?? giteaRepositoriesError} />
|
||||
);
|
||||
}
|
||||
|
||||
if (!giteaNotifications || !giteaIssues) {
|
||||
if (!giteaNotifications || !giteaIssues || !giteaRepositories) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="gitea.notifications" />
|
||||
<Block label="gitea.issues" />
|
||||
<Block label="gitea.pulls" />
|
||||
<Block label="gitea.repositories" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@@ -28,6 +32,7 @@ export default function Component({ service }) {
|
||||
<Block label="gitea.notifications" value={giteaNotifications.length} />
|
||||
<Block label="gitea.issues" value={giteaIssues.issues.length} />
|
||||
<Block label="gitea.pulls" value={giteaIssues.pulls.length} />
|
||||
<Block label="gitea.repositories" value={giteaRepositories.data.length} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ const widget = {
|
||||
issues: asJson(data).filter((issue) => !issue.pull_request),
|
||||
}),
|
||||
},
|
||||
repositories: {
|
||||
endpoint: "repos/search",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user