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
This commit is contained in:
Dakshesh Jain 2023-04-14 16:52:31 +05:30 committed by GitHub
parent 23b4145565
commit 3b103da6a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View File

@ -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<Props> = ({ label, value, onChange })
onChange(images[0].urls.regular);
}, [value, onChange, images]);
if (!unsplashEnabled) return null;
return (
<Popover className="relative z-[2]" ref={ref}>
<Popover.Button
@ -92,9 +98,7 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, onChange })
</Tab.List>
<Tab.Panels className="h-full w-full flex-1 overflow-y-auto overflow-x-hidden">
<Tab.Panel className="h-full w-full space-y-4">
<div
className="flex gap-x-2 pt-7"
>
<div className="flex gap-x-2 pt-7">
<Input
name="search"
className="text-sm"
@ -103,7 +107,12 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, onChange })
onChange={(e) => setFormData({ ...formData, search: e.target.value })}
placeholder="Search for images"
/>
<PrimaryButton type="button" onClick={()=>setSearchParams(formData.search)} className="bg-indigo-600" size="sm">
<PrimaryButton
type="button"
onClick={() => setSearchParams(formData.search)}
className="bg-indigo-600"
size="sm"
>
Search
</PrimaryButton>
</div>

View File

@ -41,7 +41,8 @@ const defaultValues: Partial<IProject> = {
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<{

View File

@ -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",