From aabf1d146d81e56aa05d89f12cfb6dfa1f28ff91 Mon Sep 17 00:00:00 2001 From: Gorbachev Egor <7gorbachevm@gmail.com> Date: Mon, 8 Jan 2024 20:20:46 +0700 Subject: [PATCH] Support chat link --- .env | 1 - src/screens/deck-form/deck-form.tsx | 10 +++---- .../deck-form/store/deck-form-store.test.ts | 2 +- src/screens/deck-list/main-screen.tsx | 7 ++--- src/screens/folder-form/folder-form.tsx | 10 +++---- src/screens/folder-review/folder-preview.tsx | 6 ++-- .../share-deck/share-deck-settings.tsx | 14 ++++----- src/screens/shared/links.ts | 4 +++ src/screens/shared/screen.tsx | 2 +- .../user-settings/user-settings-main.tsx | 30 ++++++++++++++----- .../settings-row.tsx => ui/card-row.tsx} | 4 +-- 11 files changed, 53 insertions(+), 37 deletions(-) create mode 100644 src/screens/shared/links.ts rename src/{screens/user-settings/settings-row.tsx => ui/card-row.tsx} (85%) diff --git a/.env b/.env index aca37592..773f99c4 100644 --- a/.env +++ b/.env @@ -1,4 +1,3 @@ VITE_API_URL=/api -VITE_CHANNEL_LINK= VITE_BOT_APP_URL= diff --git a/src/screens/deck-form/deck-form.tsx b/src/screens/deck-form/deck-form.tsx index 5ae66223..2d9a6f47 100644 --- a/src/screens/deck-form/deck-form.tsx +++ b/src/screens/deck-form/deck-form.tsx @@ -10,7 +10,7 @@ import { useMount } from "../../lib/react/use-mount.ts"; import { useBackButton } from "../../lib/telegram/use-back-button.tsx"; import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx"; import { assert } from "../../lib/typescript/assert.ts"; -import { SettingsRow } from "../user-settings/settings-row.tsx"; +import { CardRow } from "../../ui/card-row.tsx"; import { Button } from "../../ui/button.tsx"; import { HintTransparent } from "../../ui/hint-transparent.tsx"; import { RadioSwitcher } from "../../ui/radio-switcher.tsx"; @@ -90,23 +90,23 @@ export const DeckForm = observer(() => { {deckFormStore.form.cards.length > 0 && ( - { deckFormStore.goToCardList(); }} > {t("cards")} {deckFormStore.form.cards.length} - + )} - + {t("speaking_cards")} - + {deckFormStore.isSpeakingCardEnabled ? (
{ diff --git a/src/screens/deck-list/main-screen.tsx b/src/screens/deck-list/main-screen.tsx index 85ca2d8b..bb200a9e 100644 --- a/src/screens/deck-list/main-screen.tsx +++ b/src/screens/deck-list/main-screen.tsx @@ -11,12 +11,12 @@ import { screenStore } from "../../store/screen-store.ts"; import { Button } from "../../ui/button.tsx"; import { DeckLoading } from "./deck-loading.tsx"; import WebApp from "@twa-dev/sdk"; -import { assert } from "../../lib/typescript/assert.ts"; import { ListHeader } from "../../ui/list-header.tsx"; import { range } from "../../lib/array/range.ts"; import { reset } from "../../ui/reset.ts"; import { ViewMoreDecksToggle } from "./view-more-decks-toggle.tsx"; import { t } from "../../translations/t.ts"; +import { links } from "../shared/links.ts"; export const MainScreen = observer(() => { useMount(() => { @@ -181,10 +181,7 @@ export const MainScreen = observer(() => { - + ); })} @@ -85,7 +85,7 @@ export const FolderForm = observer(() => { ) : null} {folderStore.decksMineFiltered.map((deck) => { return ( - + {deck.name} - + ); })} diff --git a/src/screens/folder-review/folder-preview.tsx b/src/screens/folder-review/folder-preview.tsx index 68b1b8a6..39e13001 100644 --- a/src/screens/folder-review/folder-preview.tsx +++ b/src/screens/folder-review/folder-preview.tsx @@ -12,7 +12,7 @@ import { ButtonSideAligned } from "../../ui/button-side-aligned.tsx"; import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx"; import { t } from "../../translations/t.ts"; import { useReviewStore } from "../deck-review/store/review-store-context.tsx"; -import { SettingsRow } from "../user-settings/settings-row.tsx"; +import { CardRow } from "../../ui/card-row.tsx"; import { ListHeader } from "../../ui/list-header.tsx"; import { assert } from "../../lib/typescript/assert.ts"; import { userStore } from "../../store/user-store.ts"; @@ -187,14 +187,14 @@ export const FolderPreview = observer(() => { {folder.decks.map((deck, i) => { return ( - { deckListStore.goDeckById(deck.id); }} > {deck.name} - + ); })} {folder.cardsToReview.length === 0 && ( diff --git a/src/screens/share-deck/share-deck-settings.tsx b/src/screens/share-deck/share-deck-settings.tsx index 28db7b9d..5dcdb841 100644 --- a/src/screens/share-deck/share-deck-settings.tsx +++ b/src/screens/share-deck/share-deck-settings.tsx @@ -4,7 +4,7 @@ import { screenStore } from "../../store/screen-store.ts"; import { useMainButton } from "../../lib/telegram/use-main-button.tsx"; import { t } from "../../translations/t.ts"; import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx"; -import { SettingsRow } from "../user-settings/settings-row.tsx"; +import { CardRow } from "../../ui/card-row.tsx"; import { RadioSwitcher } from "../../ui/radio-switcher.tsx"; import { HintTransparent } from "../../ui/hint-transparent.tsx"; import { Label } from "../../ui/label.tsx"; @@ -36,25 +36,25 @@ export const ShareDeckSettings = observer(() => { return ( - + {t("share_one_time_access_link")} - + {t("share_one_time_access_link_description")} {store.form.isOneTime.value && ( <> - + {t("share_access_duration")} - + )} {store.form.isOneTime.value && store.form.isAccessDuration.value && ( @@ -64,13 +64,13 @@ export const ShareDeckSettings = observer(() => { )} - { store.isDeckAccessesOpen.setTrue(); }} > {t("share_one_time_links_usage")} - + ); }); diff --git a/src/screens/shared/links.ts b/src/screens/shared/links.ts new file mode 100644 index 00000000..15bc0914 --- /dev/null +++ b/src/screens/shared/links.ts @@ -0,0 +1,4 @@ +export const links = { + botChannel: "https://t.me/memo_card_bot_channel", + supportChat: "https://t.me/memocard_support", +}; diff --git a/src/screens/shared/screen.tsx b/src/screens/shared/screen.tsx index dba1c2d2..be4e989a 100644 --- a/src/screens/shared/screen.tsx +++ b/src/screens/shared/screen.tsx @@ -21,7 +21,7 @@ export const Screen = observer((props: Props) => { })} >
-

{title}

+

{title}

{subtitle}
{children} diff --git a/src/screens/user-settings/user-settings-main.tsx b/src/screens/user-settings/user-settings-main.tsx index 65d8378b..f7c992cb 100644 --- a/src/screens/user-settings/user-settings-main.tsx +++ b/src/screens/user-settings/user-settings-main.tsx @@ -6,7 +6,7 @@ import { useMount } from "../../lib/react/use-mount.ts"; import { generateTimeRange } from "./generate-time-range.tsx"; import { useMainButton } from "../../lib/telegram/use-main-button.tsx"; import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx"; -import { SettingsRow } from "./settings-row.tsx"; +import { CardRow } from "../../ui/card-row.tsx"; import { RadioSwitcher } from "../../ui/radio-switcher.tsx"; import { theme } from "../../ui/theme.tsx"; import { Select } from "../../ui/select.tsx"; @@ -16,6 +16,8 @@ import { screenStore } from "../../store/screen-store.ts"; import { HintTransparent } from "../../ui/hint-transparent.tsx"; import { t } from "../../translations/t.ts"; import { Screen } from "../shared/screen.tsx"; +import WebApp from "@twa-dev/sdk"; +import { links } from "../shared/links.ts"; export const timeRanges = generateTimeRange(); @@ -45,7 +47,7 @@ export const UserSettingsMain = observer(() => { return ( - + {t("settings_review_notifications")} { onToggle={isRemindNotifyEnabled.toggle} /> - + {isRemindNotifyEnabled.value && ( - + {t("settings_time")}