Skip to content

Commit

Permalink
Add cards to review when opening folder by link
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Jan 10, 2024
1 parent 98bd664 commit 0048727
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/screens/folder-review/folder-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,17 @@ export const FolderPreview = observer(() => {
{t("share")}
</ButtonSideAligned>
)}
{deckListStore.canEditFolder && (
<ButtonSideAligned
icon={"mdi-delete-circle mdi-24px"}
outline
onClick={() => {
showConfirm(t("delete_folder_confirm")).then(() => {
deckListStore.deleteFolder();
});
}}
>
{t("delete")}
</ButtonSideAligned>
)}
<ButtonSideAligned
icon={"mdi-delete-circle mdi-24px"}
outline
onClick={() => {
showConfirm(t("delete_folder_confirm")).then(() => {
deckListStore.deleteFolder();
});
}}
>
{t("delete")}
</ButtonSideAligned>
</div>
</div>
<div
Expand Down
10 changes: 10 additions & 0 deletions src/store/deck-list-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export class DeckListStore {
}

for (const deck of folder.decks) {
// Push new folders
this.myInfo.folders.push({
deck_id: deck.id,
folder_id: folder.id,
Expand All @@ -172,7 +173,16 @@ export class DeckListStore {
folder_share_id: folder.share_id,
folder_title: folder.title,
});
// Push new decks
this.myInfo.myDecks.push(deck);
// Push new cards
this.myInfo.cardsToReview = this.myInfo.cardsToReview.concat(
deck.deck_card.map((card) => ({
id: card.id,
deck_id: deck.id,
type: "new",
})),
);
}
screenStore.go({ type: "folderPreview", folderId: folder.id });
}
Expand Down

0 comments on commit 0048727

Please sign in to comment.