import React from "react";
import { Autorenew, Check } from "@material-ui/icons";
import { constSelector, useRecoilState, useRecoilValue } from "recoil";
import * as atoms from "../../recoil/atoms";
import * as selectors from "../../recoil/selectors";
import * as viewAtoms from "../../recoil/view";
import Checkbox from "../Common/Checkbox";
import { PopoutSectionTitle, TabOption } from "../utils";
import { Button } from "../utils";
import Popout from "./Popout";
import { Slider } from "../Common/RangeSlider";
import { useTheme } from "@fiftyone/components";
export const RefreshButton = ({ modal }) => {
const [colorSeed, setColorSeed] = useRecoilState(
atoms.colorSeed(Boolean(modal))
);
return (
<>
>
);
};
const ColorBy = ({ modal }) => {
const [colorBy, setColorBy] = useRecoilState(
selectors.appConfigOption({ modal, key: "colorBy" })
);
return (
<>
Color by
{
return {
text: value,
title: `Color by ${value}`,
onClick: () => colorBy !== value && setColorBy(value),
};
})}
/>
>
);
};
const Keypoints = ({ modal }) => {
const [shown, setShown] = useRecoilState(
selectors.appConfigOption({ key: "showSkeletons", modal })
);
const [points, setPoints] = useRecoilState(
selectors.appConfigOption({ key: "multicolorKeypoints", modal })
);
return (
<>
setPoints(value)}
/>
setShown(value)}
/>
>
);
};
const Opacity = ({ modal }) => {
const theme = useTheme();
const [alpha, setAlpha] = useRecoilState(atoms.alpha(modal));
return (
<>
Label opacity
{alpha !== atoms.DEFAULT_ALPHA && (
setAlpha(atoms.DEFAULT_ALPHA)}
style={{ cursor: "pointer", margin: "0.25rem" }}
title={"Reset label opacity"}
>
)}
>
);
};
const ImageFilter = ({ modal, filter }: { modal: boolean; filter: string }) => {
const theme = useTheme();
const [value, setFilter] = useRecoilState(
atoms.imageFilters({ modal, filter })
);
return (
<>
Image {filter}
{value !== atoms.IMAGE_FILTERS[filter].default && (
setFilter(atoms.IMAGE_FILTERS[filter].default)}
style={{ cursor: "pointer", margin: "0.25rem" }}
title={"Reset label opacity"}
>
)}
>
);
};
const ImageFilters = ({ modal }) => {
return (
<>
{Object.keys(atoms.IMAGE_FILTERS).map((filter) => (
))}
>
);
};
const SortFilterResults = ({ modal }) => {
const [{ count, asc }, setSortFilterResults] = useRecoilState(
atoms.sortFilterResults(modal)
);
return (
<>
Sort sidebar contents by
!count && setSortFilterResults({ count: true, asc }),
},
{
text: "value",
title: "Sort by value",
onClick: () => count && setSortFilterResults({ count: false, asc }),
},
]}
/>
setSortFilterResults({ count, asc: !value })}
/>
>
);
};
const Patches = ({ modal }) => {
const isPatches = useRecoilValue(viewAtoms.isPatchesView);
const [crop, setCrop] = useRecoilState(atoms.cropToContent(modal));
if (!isPatches) {
return null;
}
return (
<>
Patches
setCrop(value)}
/>
>
);
};
type OptionsProps = {
modal: boolean;
bounds: [number, number];
};
const Options = ({ modal, bounds }: OptionsProps) => {
return (
);
};
export default React.memo(Options);