From 45a7f9a885f1371ca044dae9dc8bfa73c0c48015 Mon Sep 17 00:00:00 2001 From: Egor Gorbachev <7gorbachevm@gmail.com> Date: Mon, 5 Feb 2024 22:05:02 +0700 Subject: [PATCH] Prioritize new forgotten cards (#12) * Prioritize new forgotten cards --- .gitignore | 1 - src/lib/mobx-form/persistable-field.ts | 2 +- src/screens/component-catalog/components.tsx | 11 +- .../component-catalog/select-story.tsx | 23 ++ .../store/card-under-review-store.ts | 7 +- .../deck-review/store/review-store.test.ts | 340 +++++++++++++----- src/screens/deck-review/store/review-store.ts | 27 +- src/store/deck-list-store.ts | 9 +- src/store/user-store.ts | 12 +- 9 files changed, 318 insertions(+), 114 deletions(-) create mode 100644 src/screens/component-catalog/select-story.tsx diff --git a/.gitignore b/.gitignore index b90522f5..4d9c3d23 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,3 @@ ngrok .dev.vars dumper/dump.sql -gitexporter.config.json diff --git a/src/lib/mobx-form/persistable-field.ts b/src/lib/mobx-form/persistable-field.ts index 52e70aa9..19fe371e 100644 --- a/src/lib/mobx-form/persistable-field.ts +++ b/src/lib/mobx-form/persistable-field.ts @@ -2,7 +2,7 @@ import { makePersistable } from "mobx-persist-store"; import { FieldWithValue } from "./field-with-value.ts"; import { storageAdapter } from "../telegram/storage-adapter.ts"; -export const persistableField = >( +export const persistableField = >( field: T, storageKey: string, expireIn?: number, diff --git a/src/screens/component-catalog/components.tsx b/src/screens/component-catalog/components.tsx index adb4b87b..8fd2b847 100644 --- a/src/screens/component-catalog/components.tsx +++ b/src/screens/component-catalog/components.tsx @@ -1,15 +1,18 @@ import { Button } from "../../ui/button.tsx"; import { ReactNode } from "react"; import { CardPreviewStory } from "./card-preview-story.tsx"; +import { SelectStory } from "./select-story.tsx"; -export type Component = { name: string; component: ReactNode }; +export type Component = { + name: string; + component: ReactNode; +}; export const components: Array = [ { name: "Button", component: , }, - { name: "Button - outline", component: , @@ -39,4 +42,8 @@ export const components: Array = [ /> ), }, + { + name: "Select", + component: , + }, ]; diff --git a/src/screens/component-catalog/select-story.tsx b/src/screens/component-catalog/select-story.tsx new file mode 100644 index 00000000..7943192e --- /dev/null +++ b/src/screens/component-catalog/select-story.tsx @@ -0,0 +1,23 @@ +import { Select } from "../../ui/select.tsx"; +import { useState } from "react"; + +const countries = [ + { value: "us", label: "United States" }, + { value: "fr", label: "France" }, + { value: "de", label: "Germany" }, +]; + +type Country = (typeof countries)[number]["value"]; + +export const SelectStory = () => { + const [value, setValue] = useState("us"); + return ( +