@@ -28,29 +25,16 @@ const SkeletonLoader = () => {
);
};
-const WebhooksView = () => {
- const { t } = useLocale();
- const session = useSession();
- const isAdmin = session.data?.user.role === UserPermissionRole.ADMIN;
-
- const { data, isPending } = trpc.viewer.webhook.getByViewer.useQuery(undefined, {
- enabled: session.status === "authenticated",
- });
-
- if (isPending || !data) {
- return
;
- }
+type Props = {
+ data: RouterOutputs["viewer"]["webhook"]["getByViewer"];
+ isAdmin: boolean;
+};
+const WebhooksView = ({ data, isAdmin }: Props) => {
return (
-
0 ? : null}
- borderInShellHeader={(data && data.profiles.length === 1) || !data?.webhookGroups?.length}>
-
-
-
-
+
+
+
);
};
@@ -70,59 +54,54 @@ const WebhooksList = ({
return (
<>
- {webhookGroups && (
- <>
- {!!webhookGroups.length && (
-
- {webhookGroups.map((group) => (
-
- {hasTeams && (
-
-
-
- {group.profile.name || ""}
-
-
- )}
-
-
- {group.webhooks.map((webhook, index) => (
-
- router.push(`${WEBAPP_URL}/settings/developer/webhooks/${webhook.id}`)
- }
- />
- ))}
-
+ {!!webhookGroups.length ? (
+
+ {webhookGroups.map((group) => (
+
+ {hasTeams && (
+
+
+
+ {group.profile.name || ""}
- ))}
+ )}
+
+
+ {group.webhooks.map((webhook, index) => (
+
+ router.push(`${WEBAPP_URL}/settings/developer/webhooks/${webhook.id}`)
+ }
+ />
+ ))}
+
+
- )}
- {!webhookGroups.length && (
-
}
- border={true}
- />
- )}
- >
+ ))}
+
+ ) : (
+
}
+ border={true}
+ />
)}
>
);