mirror of
https://github.com/fosrl/pangolin.git
synced 2026-09-06 11:13:09 +02:00
♻️ refactor
This commit is contained in:
@@ -5,6 +5,7 @@ import { FileBadge, RotateCw } from "lucide-react";
|
|||||||
import { useCertificate } from "@app/hooks/useCertificate";
|
import { useCertificate } from "@app/hooks/useCertificate";
|
||||||
import type { GetCertificateResponse } from "@server/routers/certificates/types";
|
import type { GetCertificateResponse } from "@server/routers/certificates/types";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { durationToMs } from "@app/lib/durationToMs";
|
||||||
|
|
||||||
export type CertificateStatusContentProps = {
|
export type CertificateStatusContentProps = {
|
||||||
cert: GetCertificateResponse | null;
|
cert: GetCertificateResponse | null;
|
||||||
@@ -32,8 +33,7 @@ export function CertificateStatusContent({
|
|||||||
|
|
||||||
const labelClass =
|
const labelClass =
|
||||||
"inline-flex shrink-0 items-center self-center text-sm font-medium leading-normal";
|
"inline-flex shrink-0 items-center self-center text-sm font-medium leading-normal";
|
||||||
const valueClass =
|
const valueClass = "inline-flex items-center gap-2 text-sm leading-normal";
|
||||||
"inline-flex items-center gap-2 text-sm leading-normal";
|
|
||||||
|
|
||||||
const handleRefresh = async () => {
|
const handleRefresh = async () => {
|
||||||
await refreshCert();
|
await refreshCert();
|
||||||
@@ -202,7 +202,7 @@ export default function CertificateStatus({
|
|||||||
className = "",
|
className = "",
|
||||||
onRefresh,
|
onRefresh,
|
||||||
polling = false,
|
polling = false,
|
||||||
pollingInterval = 5000
|
pollingInterval = durationToMs(5, "seconds")
|
||||||
}: CertificateStatusProps) {
|
}: CertificateStatusProps) {
|
||||||
const hook = useCertificate({
|
const hook = useCertificate({
|
||||||
orgId,
|
orgId,
|
||||||
|
|||||||
@@ -142,8 +142,6 @@ export default function PublicResourcesTable({
|
|||||||
const [selectedResource, setSelectedResource] =
|
const [selectedResource, setSelectedResource] =
|
||||||
useState<ResourceRow | null>();
|
useState<ResourceRow | null>();
|
||||||
|
|
||||||
const { isPaidUser } = usePaidStatus();
|
|
||||||
|
|
||||||
const [isRefreshing, startTransition] = useTransition();
|
const [isRefreshing, startTransition] = useTransition();
|
||||||
const [isNavigatingToAddPage, startNavigation] = useTransition();
|
const [isNavigatingToAddPage, startNavigation] = useTransition();
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
useState,
|
useState,
|
||||||
type ReactNode
|
type ReactNode
|
||||||
} from "react";
|
} from "react";
|
||||||
|
import { durationToMs } from "@app/lib/durationToMs";
|
||||||
|
|
||||||
type ResourceAccessCertIndicatorProps = {
|
type ResourceAccessCertIndicatorProps = {
|
||||||
orgId: string;
|
orgId: string;
|
||||||
@@ -58,7 +59,7 @@ export function ResourceAccessCertIndicator({
|
|||||||
fullDomain,
|
fullDomain,
|
||||||
initialCertValue,
|
initialCertValue,
|
||||||
polling: open,
|
polling: open,
|
||||||
pollingInterval: 5000
|
pollingInterval: durationToMs(5, "seconds")
|
||||||
});
|
});
|
||||||
|
|
||||||
const { cert, certLoading, certError, refreshing, fetchCert } = certificate;
|
const { cert, certLoading, certError, refreshing, fetchCert } = certificate;
|
||||||
|
|||||||
Reference in New Issue
Block a user