cleanup
This commit is contained in:
parent
6221099af8
commit
d5dfbd7aa4
8 changed files with 54 additions and 59 deletions
|
|
@ -3,37 +3,27 @@ import { useSettings, storeStartupScript } from '../../../settings.mjs';
|
|||
import { SpecialActionInput } from '../button/action-button';
|
||||
|
||||
async function importScript(script) {
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(script)
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(script);
|
||||
|
||||
reader.onload = () => {
|
||||
const text = reader.result;
|
||||
console.info(text)
|
||||
storeStartupScript(text)
|
||||
|
||||
};
|
||||
|
||||
reader.onerror = () => {
|
||||
errorLogger(new Error('failed to import prebake script'), 'ImportPrebakeScriptButton')
|
||||
}
|
||||
reader.onload = () => {
|
||||
const text = reader.result;
|
||||
storeStartupScript(text);
|
||||
};
|
||||
|
||||
reader.onerror = () => {
|
||||
errorLogger(new Error('failed to import prebake script'), 'importScript');
|
||||
};
|
||||
}
|
||||
export function ImportPrebakeScriptButton() {
|
||||
const settings = useSettings();
|
||||
const settings = useSettings();
|
||||
|
||||
return <SpecialActionInput type="file"
|
||||
label="import prebake script"
|
||||
accept=".strudel, .txt"
|
||||
onChange={(e) => importScript(e.target.files[0])} />
|
||||
|
||||
// return <label className="hover:opacity-50 cursor-pointer">
|
||||
// <input
|
||||
// style={{ display: 'none' }}
|
||||
// type="file"
|
||||
// // multiple
|
||||
// accept=".strudel, .txt"
|
||||
// onChange={(e) => importScript(e.target.files[0])}
|
||||
// />
|
||||
// import prebake script
|
||||
// </label>
|
||||
}
|
||||
return (
|
||||
<SpecialActionInput
|
||||
type="file"
|
||||
label="import prebake script"
|
||||
accept=".strudel"
|
||||
onChange={(e) => importScript(e.target.files[0])}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ function PanelContent({ context, tab }) {
|
|||
case tabNames.reference:
|
||||
return <Reference />;
|
||||
case tabNames.settings:
|
||||
return <SettingsTab started={context.started} context={context} />;
|
||||
return <SettingsTab started={context.started} />;
|
||||
case tabNames.files:
|
||||
return <FilesTab />;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ function UserPatterns({ context }) {
|
|||
const activePattern = useActivePattern();
|
||||
const viewingPatternStore = useViewingPatternData();
|
||||
const viewingPatternData = parseJSON(viewingPatternStore);
|
||||
const { userPatterns, patternFilter, patternAutoStart, } = useSettings();
|
||||
const { userPatterns, patternFilter, patternAutoStart } = useSettings();
|
||||
const viewingPatternID = viewingPatternData?.id;
|
||||
return (
|
||||
<div className="flex flex-col gap-2 flex-grow overflow-hidden h-full pb-2 ">
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ const fontFamilyOptions = {
|
|||
|
||||
const RELOAD_MSG = 'Changing this setting requires the window to reload itself. OK?';
|
||||
|
||||
export function SettingsTab({ started,context }) {
|
||||
export function SettingsTab({ started }) {
|
||||
const {
|
||||
theme,
|
||||
keybindings,
|
||||
|
|
@ -208,7 +208,6 @@ export function SettingsTab({ started,context }) {
|
|||
</FormItem>
|
||||
</div>
|
||||
<ImportPrebakeScriptButton />
|
||||
{/* <SpecialActionButton label="edit startup script" onClick={() => context.editStartupScript(startupScript)}></SpecialActionButton> */}
|
||||
<FormItem label="Keybindings">
|
||||
<ButtonGroup
|
||||
value={keybindings}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue