forked from github/plane
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:
parent
23b4145565
commit
3b103da6a3
@ -17,6 +17,10 @@ import { Input, Spinner, PrimaryButton } from "components/ui";
|
|||||||
// hooks
|
// hooks
|
||||||
import useOutsideClickDetector from "hooks/use-outside-click-detector";
|
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 = [
|
const tabOptions = [
|
||||||
{
|
{
|
||||||
key: "unsplash",
|
key: "unsplash",
|
||||||
@ -56,6 +60,8 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, onChange })
|
|||||||
onChange(images[0].urls.regular);
|
onChange(images[0].urls.regular);
|
||||||
}, [value, onChange, images]);
|
}, [value, onChange, images]);
|
||||||
|
|
||||||
|
if (!unsplashEnabled) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover className="relative z-[2]" ref={ref}>
|
<Popover className="relative z-[2]" ref={ref}>
|
||||||
<Popover.Button
|
<Popover.Button
|
||||||
@ -92,9 +98,7 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, onChange })
|
|||||||
</Tab.List>
|
</Tab.List>
|
||||||
<Tab.Panels className="h-full w-full flex-1 overflow-y-auto overflow-x-hidden">
|
<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">
|
<Tab.Panel className="h-full w-full space-y-4">
|
||||||
<div
|
<div className="flex gap-x-2 pt-7">
|
||||||
className="flex gap-x-2 pt-7"
|
|
||||||
>
|
|
||||||
<Input
|
<Input
|
||||||
name="search"
|
name="search"
|
||||||
className="text-sm"
|
className="text-sm"
|
||||||
@ -103,7 +107,12 @@ export const ImagePickerPopover: React.FC<Props> = ({ label, value, onChange })
|
|||||||
onChange={(e) => setFormData({ ...formData, search: e.target.value })}
|
onChange={(e) => setFormData({ ...formData, search: e.target.value })}
|
||||||
placeholder="Search for images"
|
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
|
Search
|
||||||
</PrimaryButton>
|
</PrimaryButton>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,7 +41,8 @@ const defaultValues: Partial<IProject> = {
|
|||||||
description: "",
|
description: "",
|
||||||
network: 2,
|
network: 2,
|
||||||
icon: getRandomEmoji(),
|
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<{
|
const IsGuestCondition: React.FC<{
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
"NEXT_PUBLIC_ENABLE_SENTRY",
|
"NEXT_PUBLIC_ENABLE_SENTRY",
|
||||||
"NEXT_PUBLIC_ENABLE_OAUTH",
|
"NEXT_PUBLIC_ENABLE_OAUTH",
|
||||||
"NEXT_PUBLIC_UNSPLASH_ACCESS",
|
"NEXT_PUBLIC_UNSPLASH_ACCESS",
|
||||||
|
"NEXT_PUBLIC_UNSPLASH_ENABLED",
|
||||||
"NEXT_PUBLIC_TRACK_EVENTS",
|
"NEXT_PUBLIC_TRACK_EVENTS",
|
||||||
"TRACKER_ACCESS_KEY",
|
"TRACKER_ACCESS_KEY",
|
||||||
"NEXT_PUBLIC_CRISP_ID",
|
"NEXT_PUBLIC_CRISP_ID",
|
||||||
|
Loading…
Reference in New Issue
Block a user