mirror of
https://github.com/hanzo-apps/dataroom.git
synced 2026-10-30 14:47:36 +00:00
hanzo-build-linux-amd64 is the only ARC runner pool installed on hanzo-k8s today (arm64 pool is paused until DigitalOcean ships arm64 droplets, per ~/work/hanzo/.github/RUNNERS.md). The arm64 job was waiting on spark-hanzoai-arm64 — not provisioned in this cluster — so every build sat in queue forever and the amd64 leg got cancelled. Set platforms: linux/amd64 on the reusable build call to skip arm64 entirely. Re-add arm64 if/when DO ships arm64 droplets and the spark runner pool comes back online.
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import { useTeam } from "@/context/team-context";
|
|
import useSWR from "swr";
|
|
import { z } from "zod";
|
|
|
|
import { usePlan } from "@/lib/swr/use-billing";
|
|
import { fetcher } from "@/lib/utils";
|
|
|
|
import { configSchema } from "./server";
|
|
|
|
export type LimitProps = z.infer<typeof configSchema> & {
|
|
usage: {
|
|
documents: number;
|
|
links: number;
|
|
users: number;
|
|
};
|
|
dataroomUpload: boolean;
|
|
};
|
|
|
|
export function useLimits() {
|
|
const teamInfo = useTeam();
|
|
const { isFree, isTrial, isPaused } = usePlan();
|
|
const teamId = teamInfo?.currentTeam?.id;
|
|
|
|
const { data, error } = useSWR<LimitProps | null>(
|
|
teamId && `/api/teams/${teamId}/limits`,
|
|
fetcher,
|
|
{
|
|
dedupingInterval: 30000,
|
|
},
|
|
);
|
|
|
|
const canAddDocuments = data?.documents
|
|
? data?.usage?.documents < data?.documents
|
|
: true;
|
|
const canAddLinks = data?.links ? data?.usage?.links < data?.links : true;
|
|
const canAddUsers = data?.users ? data?.usage?.users < data?.users : true;
|
|
const showUpgradePlanModal =
|
|
(isFree && !isTrial) || (isTrial && !canAddUsers);
|
|
|
|
return {
|
|
showUpgradePlanModal,
|
|
limits: data,
|
|
canAddDocuments,
|
|
canAddLinks,
|
|
canAddUsers,
|
|
isPaused,
|
|
error,
|
|
loading: !data && !error,
|
|
};
|
|
}
|