From 59e8eb893a6b53f730d921caf69996044b185cad Mon Sep 17 00:00:00 2001 From: Egor Gorbachev <7gorbachevm@gmail.com> Date: Wed, 10 Jan 2024 10:13:02 +0700 Subject: [PATCH] Cards stats for each deck inside folder; autosize textarea (#38) --- package-lock.json | 25 +++++++++++++++---- package.json | 6 +++-- src/screens/deck-catalog/deck-catalog.tsx | 2 +- src/screens/deck-form/card-list.tsx | 7 ++++-- src/screens/deck-form/card-preview.tsx | 2 +- src/screens/deck-list/main-screen.tsx | 8 +++--- src/screens/deck-review/review.tsx | 2 +- .../deck-review/want-more-cards-button.tsx | 4 ++- src/screens/folder-review/folder-preview.tsx | 9 +++---- .../card}/card-field-view.tsx | 2 +- .../card}/card-speaker.tsx | 6 ++--- .../{deck-review => shared/card}/card.tsx | 6 ++--- .../{deck-list => shared}/deck-loading.tsx | 0 .../cards-to-review-count.tsx | 0 .../deck-row-with-cards-to-review.tsx} | 8 +++--- src/ui/button-side-aligned.tsx | 3 +++ src/ui/centered-unstyled-button.tsx | 3 +++ src/ui/deck-category-logo.tsx | 5 +++- src/ui/input.tsx | 12 +++++++-- 19 files changed, 74 insertions(+), 36 deletions(-) rename src/screens/{deck-review => shared/card}/card-field-view.tsx (76%) rename src/screens/{deck-review => shared/card}/card-speaker.tsx (82%) rename src/screens/{deck-review => shared/card}/card.tsx (90%) rename src/screens/{deck-list => shared}/deck-loading.tsx (100%) rename src/screens/{deck-list => shared/deck-row-with-cards-to-review}/cards-to-review-count.tsx (100%) rename src/screens/{deck-list/my-deck-row.tsx => shared/deck-row-with-cards-to-review/deck-row-with-cards-to-review.tsx} (85%) diff --git a/package-lock.json b/package-lock.json index 28afc52f..ad4ca56d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,7 @@ "@mdi/font": "^5.9.55", "@supabase/supabase-js": "^2.38.0", "@twa-dev/sdk": "^6.9.0", - "@types/luxon": "^3.3.2", - "@types/sanitize-html": "^2.9.5", + "autosize": "^6.0.1", "colord": "^2.9.3", "framer-motion": "^10.16.4", "grammy": "^1.19.1", @@ -37,9 +36,12 @@ "devDependencies": { "@cloudflare/workers-types": "^4.20231002.0", "@peculiar/webcrypto": "^1.4.3", + "@types/autosize": "^4.0.3", + "@types/luxon": "^3.4.0", "@types/node": "^20.8.0", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/sanitize-html": "^2.9.5", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", @@ -1393,6 +1395,12 @@ "resolved": "https://registry.npmjs.org/@twa-dev/types/-/types-6.9.0.tgz", "integrity": "sha512-hBkIuJgVtkLAPPhKsNfgyBpgS+15spzUScy5jgpfPJPqXPaaUVDTaWHbeEUU+lUgHmryeQjWyz+UjS7987Pyaw==" }, + "node_modules/@types/autosize": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/autosize/-/autosize-4.0.3.tgz", + "integrity": "sha512-o0ZyU3ePp3+KRbhHsY4ogjc+ZQWgVN5h6j8BHW5RII4cFKi6PEKK9QPAcphJVkD0dGpyFnD3VRR0WMvHVjCv9w==", + "dev": true + }, "node_modules/@types/babel__core": { "version": "7.20.2", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.2.tgz", @@ -1462,9 +1470,10 @@ "dev": true }, "node_modules/@types/luxon": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.3.2.tgz", - "integrity": "sha512-l5cpE57br4BIjK+9BSkFBOsWtwv6J9bJpC7gdXIzZyI0vuKvNTk0wZZrkQxMGsUAuGW9+WMNWF2IJMD7br2yeQ==" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.4.0.tgz", + "integrity": "sha512-PEVoA4MOfSsFNaPrZjIUGUZujBDxnO/tj2A2N9KfzlR+pNgpBdDuk0TmRvSMAVUP5q4q8IkMEZ8UOp3MIr+QgA==", + "dev": true }, "node_modules/@types/node": { "version": "20.8.0", @@ -1511,6 +1520,7 @@ "version": "2.9.5", "resolved": "https://registry.npmjs.org/@types/sanitize-html/-/sanitize-html-2.9.5.tgz", "integrity": "sha512-2Sr1vd8Dw+ypsg/oDDfZ57OMSG2Befs+l2CMyCC5bVSK3CpE7lTB2aNlbbWzazgVA+Qqfuholwom6x/mWd1qmw==", + "dev": true, "dependencies": { "htmlparser2": "^8.0.0" } @@ -2035,6 +2045,11 @@ "node": "*" } }, + "node_modules/autosize": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/autosize/-/autosize-6.0.1.tgz", + "integrity": "sha512-f86EjiUKE6Xvczc4ioP1JBlWG7FKrE13qe/DxBCpe8GCipCq2nFw73aO8QEBKHfSbYGDN5eB9jXWKen7tspDqQ==" + }, "node_modules/babel-plugin-macros": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", diff --git a/package.json b/package.json index 99c501db..b572c996 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,7 @@ "@mdi/font": "^5.9.55", "@supabase/supabase-js": "^2.38.0", "@twa-dev/sdk": "^6.9.0", - "@types/luxon": "^3.3.2", - "@types/sanitize-html": "^2.9.5", + "autosize": "^6.0.1", "colord": "^2.9.3", "framer-motion": "^10.16.4", "grammy": "^1.19.1", @@ -54,9 +53,12 @@ "devDependencies": { "@cloudflare/workers-types": "^4.20231002.0", "@peculiar/webcrypto": "^1.4.3", + "@types/autosize": "^4.0.3", + "@types/luxon": "^3.4.0", "@types/node": "^20.8.0", "@types/react": "^18.2.15", "@types/react-dom": "^18.2.7", + "@types/sanitize-html": "^2.9.5", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "@vitejs/plugin-react": "^4.0.3", diff --git a/src/screens/deck-catalog/deck-catalog.tsx b/src/screens/deck-catalog/deck-catalog.tsx index c6f2e18b..99fab0d5 100644 --- a/src/screens/deck-catalog/deck-catalog.tsx +++ b/src/screens/deck-catalog/deck-catalog.tsx @@ -13,7 +13,7 @@ import { } from "./store/deck-catalog-store.ts"; import { DeckListItemWithDescription } from "../../ui/deck-list-item-with-description.tsx"; import { range } from "../../lib/array/range.ts"; -import { DeckLoading } from "../deck-list/deck-loading.tsx"; +import { DeckLoading } from "../shared/deck-loading.tsx"; import { NoDecksMatchingFilters } from "./no-decks-matching-filters.tsx"; import { deckListStore } from "../../store/deck-list-store.ts"; import { DeckAddedLabel } from "./deck-added-label.tsx"; diff --git a/src/screens/deck-form/card-list.tsx b/src/screens/deck-form/card-list.tsx index 361a8825..01a3209c 100644 --- a/src/screens/deck-form/card-list.tsx +++ b/src/screens/deck-form/card-list.tsx @@ -11,6 +11,8 @@ import React from "react"; import { reset } from "../../ui/reset.ts"; import { t } from "../../translations/t.ts"; import { Screen } from "../shared/screen.tsx"; +import { motion } from "framer-motion"; +import { whileTap } from "../../ui/animations.ts"; export const CardList = observer(() => { const deckFormStore = useDeckFormStore(); @@ -82,7 +84,8 @@ export const CardList = observer(() => { )} {deckFormStore.filteredCards.map((cardForm, i) => ( -
{ deckFormStore.editCardFormById(cardForm.id); }} @@ -98,7 +101,7 @@ export const CardList = observer(() => {
{cardForm.back.value}
-
+ ))}