diff --git a/client/src/containers/profile/file-upload/index.tsx b/client/src/containers/profile/file-upload/index.tsx index 39dac29a..1fc06b98 100644 --- a/client/src/containers/profile/file-upload/index.tsx +++ b/client/src/containers/profile/file-upload/index.tsx @@ -2,9 +2,12 @@ import React, { FC, useCallback, useState } from "react"; import { useDropzone } from "react-dropzone"; +import Link from "next/link"; + import { FileUpIcon, XIcon } from "lucide-react"; import { useSession } from "next-auth/react"; +import { TERMS_AND_CONDITIONS_URL } from "@/lib/constants"; import { client } from "@/lib/query-client"; import { cn } from "@/lib/utils"; @@ -173,6 +176,20 @@ const FileUpload: FC = () => { )} +
+ By sharing your data with us, you consent to being contacted for future + follow-ups. For more details, please review our + + . +
); }; diff --git a/client/src/hooks/use-feature-flags.ts b/client/src/hooks/use-feature-flags.ts index 4b747098..81cebc09 100644 --- a/client/src/hooks/use-feature-flags.ts +++ b/client/src/hooks/use-feature-flags.ts @@ -1,30 +1,60 @@ -const FEATURE_FLAGS = { +import { useMemo } from "react"; + +interface FeatureFlags { /** Controls whether users can edit project details and settings in: * - /projects/custom-project/details * - /projects/custom-project/summary */ - "edit-project": false, + "edit-project": boolean; /** Controls the visibility and sharing functionality in: * - /profile */ - "share-information": false, + "share-information": boolean; /** Controls the project comparison functionality in: * - /overview/project-details (scorecard ratings and cost estimates comparison) */ - "project-comparison": false, + "project-comparison": boolean; /** Controls the actions dropdown functionality in: * - /my-projects table */ - "update-selection": false, + "update-selection": boolean; /** Controls the visibility of the methodology page */ + "methodology-page": boolean; + "compare-with-other-project": boolean; +} + +const DEFAULT_FEATURE_FLAGS: FeatureFlags = { + "edit-project": false, + "share-information": false, + "project-comparison": false, + "update-selection": false, "methodology-page": false, "compare-with-other-project": false, -} as const; - -type FeatureFlags = typeof FEATURE_FLAGS; +}; +/** + * Hook to get the feature flags for the current user. + * Checks the environment variable FEATURE_FLAGS to see which flags are enabled. + * If the environment variable is not set, falls back to default flags. + * + * @returns The feature flags for the current user. + */ export function useFeatureFlags(): FeatureFlags { - // TODO: Implement feature flags with env variable - return FEATURE_FLAGS; + return useMemo(() => { + const enabledFeatures = new Set( + process.env.NEXT_PUBLIC_FEATURE_FLAGS?.split(",").map((f) => f.trim()) || + [], + ); + + return ( + Object.keys(DEFAULT_FEATURE_FLAGS) as Array