Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/import-forms #365

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: naming
danielo515 committed Dec 20, 2024
commit 54a1d4bff8baae2e0b10a55d6034b6b58ef44803
6 changes: 3 additions & 3 deletions src/views/FormImport.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as J from "fp-ts/Json";
import { O, type Option, ensureError, pipe } from "@std";
import * as E from "fp-ts/Either";
import * as J from "fp-ts/Json";
import { FormDefinition } from "src/core/formDefinition";
import { InvalidData, MigrationError, migrateToLatest } from "src/core/formDefinitionSchema";
import { Readable, writable } from "svelte/store";
import { FormDefinition } from "src/core/formDefinition";

type State = E.Either<string[], Option<FormDefinition>>;
type UiState = {
@@ -44,7 +44,7 @@ function matchState<T>(state: State, matchers: Matchers<T>): T {

function noop() {}

export function makeFormInputModel({ createForm }: FormImportDeps): FormImportModel {
export function makeFormImportModel({ createForm }: FormImportDeps): FormImportModel {
const state = writable<State>(E.of(O.none));
const setErrors = (errors: string[]) => state.set(E.left(errors));
const resetState = () => state.set(E.of(O.none));
4 changes: 2 additions & 2 deletions src/views/FormImportView.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App, Modal } from "obsidian";
import { FormImportDeps, makeFormImportModel } from "./FormImport";
import FormImport from "./FormImport.svelte";
import { FormImportDeps, makeFormInputModel } from "./FormImport";
/**
* This class is just the minimum glue code to bind our core logic
* with the svelte UI and obsidian API modal.
@@ -23,7 +23,7 @@ export class FormImportModal extends Modal {
const { contentEl } = this;
this._component = new FormImport({
target: contentEl,
props: { model: makeFormInputModel(this.deps) },
props: { model: makeFormImportModel(this.deps) },
});
}
}