-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
169 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import { Screen } from "../shared/screen.tsx"; | ||
import { useBackButton } from "../../lib/telegram/use-back-button.tsx"; | ||
import { Card } from "../deck-review/card.tsx"; | ||
import { css } from "@emotion/css"; | ||
import { t } from "../../translations/t.ts"; | ||
import { CardFormType } from "./store/deck-form-store.ts"; | ||
|
||
type Props = { | ||
form: CardFormType; | ||
onBack: () => void; | ||
}; | ||
|
||
export const CardPreview = observer((props: Props) => { | ||
const { form, onBack } = props; | ||
|
||
useBackButton(() => { | ||
onBack(); | ||
}); | ||
|
||
return ( | ||
<Screen title={t("card_preview")}> | ||
<div className={css({ position: "relative", marginTop: 40 })}> | ||
<Card | ||
card={{ | ||
isOpened: true, | ||
back: form.back.value, | ||
front: form.front.value, | ||
example: form.example.value, | ||
speak: () => {}, | ||
deckSpeakField: "front", | ||
isSpeakingCardsEnabledSettings: false, | ||
}} | ||
animate={{}} | ||
style={{}} | ||
/> | ||
</div> | ||
</Screen> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import React, { useState } from "react"; | ||
import { QuickAddCardFormStore } from "./store/quick-add-card-form-store.ts"; | ||
import { CardPreview } from "./card-preview.tsx"; | ||
import { QuickAddForm } from "./quick-add-form.tsx"; | ||
|
||
export const QuickAddCardFormPage = observer(() => { | ||
const [quickAddCardStore] = useState(() => new QuickAddCardFormStore()); | ||
|
||
if (quickAddCardStore.isCardPreviewSelected.value) { | ||
return ( | ||
<CardPreview | ||
form={quickAddCardStore.form} | ||
onBack={quickAddCardStore.isCardPreviewSelected.setFalse} | ||
/> | ||
); | ||
} | ||
|
||
return <QuickAddForm quickAddCardStore={quickAddCardStore} />; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { css, cx } from "@emotion/css"; | ||
import { reset } from "./reset.ts"; | ||
import { theme } from "./theme.tsx"; | ||
import React, { ReactNode } from "react"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
onClick: () => void; | ||
}; | ||
|
||
export const CenteredUnstyledButton = (props: Props) => { | ||
const { children, onClick } = props; | ||
|
||
return ( | ||
<button | ||
className={cx( | ||
reset.button, | ||
css({ | ||
width: "100%", | ||
color: theme.linkColor, | ||
fontSize: 14, | ||
paddingTop: 6, | ||
textTransform: "uppercase", | ||
}), | ||
)} | ||
onClick={onClick} | ||
> | ||
{children} | ||
</button> | ||
); | ||
}; |