Skip to content

Commit

Permalink
todo
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Nov 17, 2023
1 parent 5656fd7 commit 6028ab5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/screens/deck-form/deck-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const DeckForm = observer(() => {
})}
>
<h3 className={css({ textAlign: "center" })}>
{screen.deckFormId ? "Edit deck" : "Add deck"}
{screen.deckId ? "Edit deck" : "Add deck"}
</h3>
<Label text={"Title"} isRequired>
<Input {...deckFormStore.form.title.props} />
Expand Down
4 changes: 2 additions & 2 deletions src/screens/deck-review/deck-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const DeckPreview = observer(() => {
onClick={() => {
screenStore.go({
type: "cardQuickAddForm",
cardQuickAddDeckId: deck.id,
deckId: deck.id,
});
}}
>
Expand All @@ -109,7 +109,7 @@ export const DeckPreview = observer(() => {
noPseudoClasses
outline
onClick={() => {
screenStore.go({ type: "deckForm", deckFormId: deck.id });
screenStore.go({ type: "deckForm", deckId: deck.id });
}}
>
Edit
Expand Down
6 changes: 3 additions & 3 deletions src/store/deck-form-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export class DeckFormStore {
const screen = screenStore.screen;
assert(screen.type === "deckForm");

if (screen.deckFormId) {
if (screen.deckId) {
const deck = deckListStore.myDecks.find(
(myDeck) => myDeck.id === screen.deckFormId,
(myDeck) => myDeck.id === screen.deckId,
);
assert(deck, "Deck not found in deckListStore");
this.form = {
Expand Down Expand Up @@ -154,7 +154,7 @@ export class DeckFormStore {
assert(screen.type === "deckForm");

return upsertDeckRequest({
id: screen.deckFormId,
id: screen.deckId,
title: this.form.title.value,
description: this.form.description.value,
cards: this.form.cards.map((card) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/store/quick-add-card-form-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class QuickAddCardFormStore {
this.isSending = true;

const body: AddCardRequest = {
deckId: screen.cardQuickAddDeckId,
deckId: screen.deckId,
card: {
back: this.form.back.value,
front: this.form.front.value,
Expand Down
6 changes: 2 additions & 4 deletions src/store/screen-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ type Route =
| { type: "main" }
| { type: "deckMine"; deckId: number }
| { type: "deckPublic"; deckId: number }
// TODO: rename to deck id
| { type: "deckForm"; deckFormId?: number }
// TODO: rename to deck id
| { type: "cardQuickAddForm"; cardQuickAddDeckId: number }
| { type: "deckForm"; deckId?: number }
| { type: "cardQuickAddForm"; deckId: number }
| { type: "userSettings" };

export class ScreenStore {
Expand Down

0 comments on commit 6028ab5

Please sign in to comment.