From 3b103da6a33ef20f890c7257b793be15729b4ee9 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Fri, 14 Apr 2023 16:52:31 +0530 Subject: [PATCH] chore: added unsplash flag for self-hosted (#829) * chore: added unsplash flag for self hosted * fix: removed actual code and only using flag * refactor: removed extra variable --- .../components/core/image-picker-popover.tsx | 17 +++++++++++++---- .../components/project/create-project-modal.tsx | 3 ++- turbo.json | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/app/components/core/image-picker-popover.tsx b/apps/app/components/core/image-picker-popover.tsx index df7559e29..a6f2efb72 100644 --- a/apps/app/components/core/image-picker-popover.tsx +++ b/apps/app/components/core/image-picker-popover.tsx @@ -17,6 +17,10 @@ import { Input, Spinner, PrimaryButton } from "components/ui"; // hooks import useOutsideClickDetector from "hooks/use-outside-click-detector"; +const unsplashEnabled = + process.env.NEXT_PUBLIC_UNSPLASH_ENABLED === "true" || + process.env.NEXT_PUBLIC_UNSPLASH_ENABLED === "1"; + const tabOptions = [ { key: "unsplash", @@ -56,6 +60,8 @@ export const ImagePickerPopover: React.FC = ({ label, value, onChange }) onChange(images[0].urls.regular); }, [value, onChange, images]); + if (!unsplashEnabled) return null; + return ( = ({ label, value, onChange }) -
+
= ({ label, value, onChange }) onChange={(e) => setFormData({ ...formData, search: e.target.value })} placeholder="Search for images" /> - setSearchParams(formData.search)} className="bg-indigo-600" size="sm"> + setSearchParams(formData.search)} + className="bg-indigo-600" + size="sm" + > Search
diff --git a/apps/app/components/project/create-project-modal.tsx b/apps/app/components/project/create-project-modal.tsx index 1669032f7..88552825f 100644 --- a/apps/app/components/project/create-project-modal.tsx +++ b/apps/app/components/project/create-project-modal.tsx @@ -41,7 +41,8 @@ const defaultValues: Partial = { description: "", network: 2, icon: getRandomEmoji(), - cover_image: null, + cover_image: + "https://images.unsplash.com/photo-1575116464504-9e7652fddcb3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyODUyNTV8MHwxfHNlYXJjaHwxOHx8cGxhbmV8ZW58MHx8fHwxNjgxNDY4NTY5&ixlib=rb-4.0.3&q=80&w=1080", }; const IsGuestCondition: React.FC<{ diff --git a/turbo.json b/turbo.json index c75159980..fbf86f566 100644 --- a/turbo.json +++ b/turbo.json @@ -11,6 +11,7 @@ "NEXT_PUBLIC_ENABLE_SENTRY", "NEXT_PUBLIC_ENABLE_OAUTH", "NEXT_PUBLIC_UNSPLASH_ACCESS", + "NEXT_PUBLIC_UNSPLASH_ENABLED", "NEXT_PUBLIC_TRACK_EVENTS", "TRACKER_ACCESS_KEY", "NEXT_PUBLIC_CRISP_ID",