Skip to content

Commit

Permalink
Adjust UI
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Dec 23, 2023
1 parent 372a3f3 commit 59a58a0
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 29 deletions.
5 changes: 2 additions & 3 deletions src/screens/deck-catalog/deck-catalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import { NoDecksMatchingFilters } from "./no-decks-matching-filters.tsx";
import { deckListStore } from "../../store/deck-list-store.ts";
import { DeckAddedLabel } from "./deck-added-label.tsx";
import { t, translateCategory } from "../../translations/t.ts";
import { util } from "zod";
import objectValues = util.objectValues;
import { enumValues } from "../../lib/typescript/enum-values.ts";

export const DeckCatalog = observer(() => {
const store = useDeckCatalogStore();
Expand Down Expand Up @@ -69,7 +68,7 @@ export const DeckCatalog = observer(() => {
<Select<LanguageFilter>
value={store.filters.language.value}
onChange={store.filters.language.onChange}
options={objectValues(LanguageFilter).map((key) => ({
options={enumValues(LanguageFilter).map((key) => ({
value: key,
label: languageFilterToNativeName(key),
}))}
Expand Down
16 changes: 2 additions & 14 deletions src/screens/deck-review/deck-finished.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { useMount } from "../../lib/react/use-mount.ts";
import { screenStore } from "../../store/screen-store.ts";
import { useMainButton } from "../../lib/telegram/use-main-button.tsx";
import { useTelegramProgress } from "../../lib/telegram/use-telegram-progress.tsx";
import { theme } from "../../ui/theme.tsx";
import { t } from "../../translations/t.ts";
import { translateNewCardsCount } from "../../translations/translate-new-cards-count.tsx";
import { getEncouragingMessage } from "../../translations/get-encouraging-message.tsx";
import { WantMoreCardsButton } from "./want-more-cards-button.tsx";

type Props = {
type: "deck" | "repeat_all";
Expand Down Expand Up @@ -43,18 +42,7 @@ export const DeckFinished = observer((props: Props) => {
</p>
{type === "repeat_all" && newCardsCount ? (
<p>
{t("review_finished_want_more")}{" "}
<span
className={css({
color: theme.linkColor,
})}
onClick={() => {
screenStore.go({ type: "main" });
}}
>
{newCardsCount} {translateNewCardsCount(newCardsCount)}
</span>{" "}
{t("review_finished_to_review")}
<WantMoreCardsButton newCardsCount={newCardsCount} />
</p>
) : (
<p>{getEncouragingMessage()} 😊</p>
Expand Down
7 changes: 6 additions & 1 deletion src/screens/deck-review/repeat-all-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { Review } from "./review.tsx";
import React from "react";
import { Hint } from "../../ui/hint.tsx";
import { t } from "../../translations/t.ts";
import { WantMoreCardsButton } from "./want-more-cards-button.tsx";
import { css } from "@emotion/css";

export const RepeatAllScreen = observer(() => {
const reviewStore = useReviewStore();
Expand All @@ -30,8 +32,11 @@ export const RepeatAllScreen = observer(() => {
}

return (
<div>
<div className={css({ display: "flex", flexDirection: "column", gap: 8 })}>
<Hint>{t("no_cards_to_review_all")}</Hint>
<Hint>
<WantMoreCardsButton newCardsCount={deckListStore.newCardsCount} />
</Hint>
</div>
);
});
31 changes: 31 additions & 0 deletions src/screens/deck-review/want-more-cards-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { observer } from "mobx-react-lite";
import { t } from "../../translations/t.ts";
import { css } from "@emotion/css";
import { theme } from "../../ui/theme.tsx";
import { screenStore } from "../../store/screen-store.ts";
import { translateNewCardsCount } from "../../translations/translate-new-cards-count.tsx";
import React from "react";

type Props = { newCardsCount: number };

export const WantMoreCardsButton = observer((props: Props) => {
const { newCardsCount } = props;

return (
<>
{t("review_finished_want_more")}{" "}
<span
className={css({
color: theme.linkColor,
cursor: "pointer",
})}
onClick={() => {
screenStore.go({ type: "main" });
}}
>
{newCardsCount} {translateNewCardsCount(newCardsCount)}
</span>{" "}
{t("review_finished_to_review")}
</>
);
});
22 changes: 11 additions & 11 deletions src/translations/t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ const ru: Translation = {
cards: "Карточки",
search_card: "Поиск карточки",
card_sort_by_date: "Дата",
card_sort_by_front: "Лицевая сторона",
card_sort_by_back: "Обратная сторона",
sort_by: "Сортировать",
card_sort_by_front: "Вопрос",
card_sort_by_back: "Ответ",
sort_by: "Сортировка",
title: "Название",
description: "Описание",
speaking_cards: "Озвучка карточек",
voice_language: "Язык озвучки",
card_speak_side: "Озвучить сторону",
card_speak_side_front: "Лицевую",
card_speak_side_back: "Обратную",
card_speak_side: "Сторона карточки",
card_speak_side_front: "Лицевая",
card_speak_side_back: "Обратная",
card_speak_description: "Позволяет улучшить произношение",
review_deck_finished: `Вы прошли эту колоду 🎉`,
review_all_cards: `Вы повторили все карточки на сегодня 🎉`,
review_finished_want_more: "Хотите больше? У вас есть",
review_finished_to_review: "для повторения",
review_finished_want_more: "Хотите ещё? У вас есть",
review_finished_to_review: "для изучения",
review_deck: "Повторить колоду",
cards_to_repeat: "Карточек для повторения",
cards_new: "Новых",
Expand All @@ -154,9 +154,9 @@ const ru: Translation = {
"Вы уверены, что хотите удалить колоду из своей коллекции? Это действие нельзя отменить",
delete: "Удалить",
no_cards_to_review_in_deck: `Отличная работа! 🌟 Вы прошли все карточки в этой колоде. Возвращайтесь позже за новыми.`,
no_cards_to_review_all: `Отличная работа! 🌟 Вы повторили все карточки на сегодня. Возвращайтесь позже за новыми.`,
review_need_to_repeat: "Нужно повторить",
review_right: "Помню",
no_cards_to_review_all: `Отличная работа! 🌟 Вы повторили все карточки на сегодня`,
review_need_to_repeat: "Не помню",
review_right: "Помню хорошо",
review_show_answer: "Показать ответ",
share: "Поделиться",
warning_telegram_outdated_title: "Ваш Телеграм устарел",
Expand Down

0 comments on commit 59a58a0

Please sign in to comment.