-
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
10 changed files
with
187 additions
and
43 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
19 changes: 19 additions & 0 deletions
19
src/screens/ai-mass-creation/cards-generated-screen-wrapper.tsx
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,19 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import { useAiMassCreationStore } from "./store/ai-mass-creation-store-provider.tsx"; | ||
import { assert } from "../../lib/typescript/assert.ts"; | ||
import { GeneratedCardPreviewScreen } from "./generated-card-preview-screen.tsx"; | ||
import React from "react"; | ||
import { CardsGeneratedScreen } from "./cards-generated-screen.tsx"; | ||
|
||
export const CardsGeneratedScreenWrapper = observer(() => { | ||
const store = useAiMassCreationStore(); | ||
assert(store.massCreationForm); | ||
|
||
if (store.massCreationFormPreviewCard) { | ||
return ( | ||
<GeneratedCardPreviewScreen card={store.massCreationFormPreviewCard} /> | ||
); | ||
} | ||
|
||
return <CardsGeneratedScreen />; | ||
}); |
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
27 changes: 27 additions & 0 deletions
27
src/screens/ai-mass-creation/generated-card-preview-screen.tsx
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,27 @@ | ||
import { observer } from "mobx-react-lite"; | ||
import { useAiMassCreationStore } from "./store/ai-mass-creation-store-provider.tsx"; | ||
import { assert } from "../../lib/typescript/assert.ts"; | ||
import { useState } from "react"; | ||
import { createMockCardPreviewForm } from "../deck-form/create-mock-card-preview-form.ts"; | ||
import { CardPreview } from "../deck-form/card-preview.tsx"; | ||
|
||
type Props = { | ||
card: { front: string; back: string; example?: string }; | ||
}; | ||
|
||
export const GeneratedCardPreviewScreen = observer((props: Props) => { | ||
const store = useAiMassCreationStore(); | ||
assert(store.massCreationForm); | ||
const { card } = props; | ||
const [form] = useState(createMockCardPreviewForm(card)); | ||
|
||
return ( | ||
<CardPreview | ||
form={form} | ||
onBack={() => { | ||
assert(store.massCreationForm); | ||
store.massCreationForm.selectedCardIndex.onChange(null); | ||
}} | ||
/> | ||
); | ||
}); |
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
62 changes: 62 additions & 0 deletions
62
src/screens/component-catalog/list-story-multiple-icons.tsx
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,62 @@ | ||
import { CardNumber } from "../../ui/card-number.tsx"; | ||
import { css, cx } from "@emotion/css"; | ||
import { theme } from "../../ui/theme.tsx"; | ||
import { reset } from "../../ui/reset.ts"; | ||
import { List } from "../../ui/list.tsx"; | ||
import React from "react"; | ||
import { Flex } from "../../ui/flex.tsx"; | ||
|
||
export const ListStoryMultipleIcons = () => { | ||
return ( | ||
<List | ||
animateTap={false} | ||
items={Array(3) | ||
.fill(null) | ||
.map((card, i) => ({ | ||
text: ( | ||
<div> | ||
<div> | ||
<CardNumber number={i + 1} /> | ||
Test title | ||
</div> | ||
<div | ||
className={css({ | ||
color: theme.hintColor, | ||
fontSize: 14, | ||
})} | ||
> | ||
Test description Test description Test description Test | ||
description Test description | ||
</div> | ||
</div> | ||
), | ||
right: ( | ||
<Flex gap={8}> | ||
<button | ||
className={cx(reset.button, css({ fontSize: 16 }))} | ||
onClick={() => {}} | ||
> | ||
<i | ||
className={cx( | ||
"mdi mdi-eye-check-outline mdi-24px", | ||
css({ color: theme.buttonColor }), | ||
)} | ||
/> | ||
</button> | ||
<button | ||
className={cx(reset.button, css({ fontSize: 16 }))} | ||
onClick={() => {}} | ||
> | ||
<i | ||
className={cx( | ||
"mdi mdi-delete-circle mdi-24px", | ||
css({ color: theme.danger }), | ||
)} | ||
/> | ||
</button> | ||
</Flex> | ||
), | ||
}))} | ||
/> | ||
); | ||
}; |
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,32 @@ | ||
import { | ||
CardFormStoreInterface, | ||
CardInnerScreenType, | ||
} from "./store/card-form-store-interface.ts"; | ||
import { ListField, TextField } from "mobx-form-lite"; | ||
import { CardAnswerType } from "../../../functions/db/custom-types.ts"; | ||
import { CardAnswerFormType } from "./store/deck-form-store.ts"; | ||
|
||
export const createMockCardPreviewForm = (card: { | ||
front: string; | ||
back: string; | ||
example?: string; | ||
}): CardFormStoreInterface => { | ||
return { | ||
cardForm: { | ||
front: new TextField<string>(card.front), | ||
back: new TextField<string>(card.back), | ||
example: new TextField<string>(card.example ?? ""), | ||
answerType: new TextField<CardAnswerType>("remember"), | ||
answerFormType: "new", | ||
options: null, | ||
answers: new ListField<CardAnswerFormType>([]), | ||
answerId: "0", | ||
}, | ||
form: undefined, | ||
cardInnerScreen: new TextField<CardInnerScreenType>(null), | ||
onBackCard: () => {}, | ||
onSaveCard: () => {}, | ||
isSending: false, | ||
markCardAsRemoved: () => {}, | ||
}; | ||
}; |
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