From 187bc8436508edef6a2064ab753dbdaf51432343 Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Thu, 12 Jun 2025 19:45:15 -0700 Subject: [PATCH] Create assets helper Signed-off-by: Sacha Al Himdani --- .../src/pages/organizations/assets/AssetDetailsPage.tsx | 2 +- apps/console2/src/pages/organizations/assets/AssetsPage.tsx | 2 +- .../utils/badgeVariants.ts => packages/helpers/src/assets.ts | 2 +- packages/helpers/src/index.ts | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) rename apps/console2/src/pages/organizations/assets/utils/badgeVariants.ts => packages/helpers/src/assets.ts (94%) diff --git a/apps/console2/src/pages/organizations/assets/AssetDetailsPage.tsx b/apps/console2/src/pages/organizations/assets/AssetDetailsPage.tsx index d70b23e76..644ba3768 100644 --- a/apps/console2/src/pages/organizations/assets/AssetDetailsPage.tsx +++ b/apps/console2/src/pages/organizations/assets/AssetDetailsPage.tsx @@ -25,7 +25,7 @@ import { PeopleSelectField } from "/components/form/PeopleSelectField"; import { VendorsMultiSelectField } from "/components/form/VendorsMultiSelectField"; import { useFormWithSchema } from "/hooks/useFormWithSchema"; import z from "zod"; -import { getAssetTypeVariant, getCriticityVariant } from "./utils/badgeVariants"; +import { getAssetTypeVariant, getCriticityVariant } from "@probo/helpers"; const updateAssetSchema = z.object({ name: z.string().min(1, "Name is required"), diff --git a/apps/console2/src/pages/organizations/assets/AssetsPage.tsx b/apps/console2/src/pages/organizations/assets/AssetsPage.tsx index b68e77d45..56a6008ba 100644 --- a/apps/console2/src/pages/organizations/assets/AssetsPage.tsx +++ b/apps/console2/src/pages/organizations/assets/AssetsPage.tsx @@ -23,7 +23,7 @@ import { useDeleteAsset, useAssets } from "../../../hooks/graph/AssetGraph"; import type { AssetGraphListQuery } from "/hooks/graph/__generated__/AssetGraphListQuery.graphql"; import { faviconUrl } from "@probo/helpers"; import type { NodeOf } from "/types"; -import { getAssetTypeVariant, getCriticityVariant } from "./utils/badgeVariants"; +import { getAssetTypeVariant, getCriticityVariant } from "@probo/helpers"; type AssetEntry = NodeOf["assets"]>>; diff --git a/apps/console2/src/pages/organizations/assets/utils/badgeVariants.ts b/packages/helpers/src/assets.ts similarity index 94% rename from apps/console2/src/pages/organizations/assets/utils/badgeVariants.ts rename to packages/helpers/src/assets.ts index 24f04c8a3..f2eb284e8 100644 --- a/apps/console2/src/pages/organizations/assets/utils/badgeVariants.ts +++ b/packages/helpers/src/assets.ts @@ -1,7 +1,7 @@ export const getAssetTypeVariant = (type: string) => { switch (type) { case "PHYSICAL": - return "warning"; + return "neutral"; case "VIRTUAL": return "info"; default: diff --git a/packages/helpers/src/index.ts b/packages/helpers/src/index.ts index afe36a9ae..921ce3752 100644 --- a/packages/helpers/src/index.ts +++ b/packages/helpers/src/index.ts @@ -14,5 +14,6 @@ export { getRole, getRoles, peopleRoles } from "./people"; export { certificationCategoryLabel, certifications } from "./certifications"; export { availableFrameworks } from "./frameworks"; export { getDocumentTypeLabel, documentTypes } from "./documents"; +export { getAssetTypeVariant, getCriticityVariant } from "./assets"; export { promisifyMutation } from "./relay"; export { fileType, fileSize } from "./file";