import { useMemo } from "react";
import { Intent } from "@blueprintjs/core";
import { Definition, RowCol, RowGroup, RowGroupOption, SingleInput, TextAreaInput, TextWithSelect, SettingsManager } from "Components/UserSettings";
const { Provider: AnnotationsProvider, useSettings: useAnnotationsSettings } = new SettingsManager<"annotations">({
/* istanbul ignore next */
afterUpdate: (_prevState, update) => {
window?.zoteroRoam?.updateSetting?.("annotations", update);
}
});
const GROUP_BY_OPTIONS = [
{ label: "Group by date added", value: "dateAdded" },
{ label: "Don't group annotations", value: false }
];
const USE_OPTIONS = {
"default": "Default formatter",
"function": "Custom function"
};
const WITH_OPTIONS = [
{ label: "Use raw metadata", value: "raw" },
{ label: "Use simplified data", value: "formatted" }
];
const COMMENT_REPLACEMENTS = (
<>
Replacements available:
>
);
const HIGHLIGHT_REPLACEMENTS = (
<>
Replacements available:
>
);
function AnnotationsWidget(){
const [
{
func,
group_by,
template_comment,
template_highlight,
use,
__with
},
setOpts
] = useAnnotationsSettings();
const handlers = useMemo(() => {
/* istanbul ignore next */
function updateSingleValue(op, val){
setOpts(prevState => ({
...prevState,
[op]: val
}));
}
return {
updateFuncName: (val) => updateSingleValue("func", val),
updateGroupBy: (val) => updateSingleValue("group_by", val),
updateTemplateComment: (val) => updateSingleValue("template_comment", val),
updateTemplateHighlight: (val) => updateSingleValue("template_highlight", val),
updateUseType: (val) => updateSingleValue("use", val),
updateWithFormat: (val) => updateSingleValue("__with", val)
};
}, [setOpts]);
const customFuncButtonProps = useMemo(() => ({
intent: Intent.PRIMARY
}), []);
return <>
>;
}
export {
AnnotationsProvider,
AnnotationsWidget,
useAnnotationsSettings
};