import React from "react";
import { Form } from "react-bootstrap";
import { useIntl } from "react-intl";
import { DurationInput, LoadingIndicator } from "src/components/Shared";
import { CheckboxGroup } from "./CheckboxGroup";
import { SettingSection } from "../SettingSection";
import {
BooleanSetting,
ModalSetting,
NumberSetting,
SelectSetting,
StringSetting,
} from "../Inputs";
import { SettingStateContext } from "../context";
import { DurationUtils } from "src/utils";
const allMenuItems = [
{ id: "scenes", headingID: "scenes" },
{ id: "images", headingID: "images" },
{ id: "movies", headingID: "movies" },
{ id: "markers", headingID: "markers" },
{ id: "galleries", headingID: "galleries" },
{ id: "performers", headingID: "performers" },
{ id: "studios", headingID: "studios" },
{ id: "tags", headingID: "tags" },
];
export const SettingsInterfacePanel: React.FC = () => {
const intl = useIntl();
const { interface: iface, saveInterface, loading, error } = React.useContext(
SettingStateContext
);
if (error) return
{error.message}
;
if (loading) return ;
return (
<>
saveInterface({ language: v })}
>
{intl.formatMessage({
id: "config.ui.menu_items.heading",
})}
{intl.formatMessage({ id: "config.ui.menu_items.description" })}
saveInterface({ menuItems: v })}
/>
saveInterface({ noBrowser: v })}
/>
saveInterface({ notificationsEnabled: v })}
/>
saveInterface({ wallShowTitle: v })}
/>
saveInterface({ soundOnPreview: v })}
/>
saveInterface({ wallPlayback: v })}
>
saveInterface({ showStudioAsText: v })}
/>
saveInterface({ showScrubber: v })}
/>
saveInterface({ autostartVideo: v })}
/>
saveInterface({ autostartVideoOnPlaySelected: v })}
/>
saveInterface({ continuePlaylistDefault: v })}
/>
id="max-loop-duration"
headingID="config.ui.max_loop_duration.heading"
subHeadingID="config.ui.max_loop_duration.description"
value={iface.maximumLoopDuration ?? undefined}
onChange={(v) => saveInterface({ maximumLoopDuration: v })}
renderField={(value, setValue) => (
setValue(duration ?? 0)}
/>
)}
renderValue={(v) => {
return {DurationUtils.secondsToString(v ?? 0)};
}}
/>
saveInterface({ slideshowDelay: v })}
/>
{intl.formatMessage({
id: "config.ui.editing.disable_dropdown_create.heading",
})}
{intl.formatMessage({
id: "config.ui.editing.disable_dropdown_create.description",
})}
saveInterface({
disableDropdownCreate: {
...iface.disableDropdownCreate,
performer: v,
},
})
}
/>
saveInterface({
disableDropdownCreate: {
...iface.disableDropdownCreate,
studio: v,
},
})
}
/>
saveInterface({
disableDropdownCreate: {
...iface.disableDropdownCreate,
tag: v,
},
})
}
/>
saveInterface({ cssEnabled: v })}
/>
id="custom-css"
headingID="config.ui.custom_css.heading"
subHeadingID="config.ui.custom_css.description"
value={iface.css ?? undefined}
onChange={(v) => saveInterface({ css: v })}
renderField={(value, setValue) => (
) =>
setValue(e.currentTarget.value)
}
rows={16}
className="text-input code"
/>
)}
renderValue={() => {
return <>>;
}}
/>
saveInterface({ handyKey: v })}
/>
saveInterface({ funscriptOffset: v })}
/>
>
);
};