Skip to content

Commit

Permalink
tooltip on disabled flashcard btn
Browse files Browse the repository at this point in the history
  • Loading branch information
hj940709 committed Jul 23, 2024
1 parent 45cbcd2 commit a836798
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 52 deletions.
32 changes: 19 additions & 13 deletions client/components/LibraryView/StoryListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const StoryTitle = ({
trigger={
<span className="space-between" style={{ overflow: 'hidden', width: '100%' }}>
<Icon color="grey" name="ellipsis vertical" className="story-item-dots" />
{story.flashcardsOnly && (<Icon size="small" name="question" bordered />)}
<h5
className="story-item-title"
style={{ marginBottom: '.5rem', ...getTextStyle(learningLanguage) }}
Expand Down Expand Up @@ -117,7 +118,7 @@ const StoryFunctionsDropdown = ({
trigger={<React.Fragment />}
>
<Dropdown.Menu className="story-item-dropdown">
{!isTeacher && (
{!isTeacher && !story.flashcardsOnly && (
<Dropdown.Item
text={<FormattedMessage id="practice" />}
as={Link}
Expand All @@ -144,7 +145,7 @@ const StoryFunctionsDropdown = ({
className='library-tour-mobile-review-button'
/>
)}
{!isTeacher && (<Dropdown.Item
{!isTeacher && story.flashcard_count && (<Dropdown.Item
text={<FormattedMessage id="Flashcards" />}
as={Link}
to={`/flashcards/fillin/story/${story._id}/`}
Expand Down Expand Up @@ -187,24 +188,29 @@ const StoryActions = ({
if (width >= 700) {
return (
<div className="story-actions">
{!isTeacher && (
{!isTeacher && !story.flashcardsOnly && (
<Link to={practiceLink}>
<Button className='library-tour-practice-button' variant='primary'>
<FormattedMessage id="practice" />
</Button>
</Link>
)}

{!isTeacher && (
<Link to={`/flashcards/fillin/story/${story._id}/`}>
<Button
variant='primary'
disabled={enableOnlyPractice}
>
<FormattedMessage id="Flashcards" />
</Button>
</Link>
)}
{!isTeacher && (<Popup
content={<FormattedMessage id="disabled-flashcard-btn-explanation" />}
trigger={
<Link to={`/flashcards/fillin/story/${story._id}/`}>
<Button
variant='primary'
disabled={enableOnlyPractice || story.flashcard_count === 0}
>
<FormattedMessage id="Flashcards" />
</Button>
</Link>
}
disabled={story.flashcard_count > 0}
position="top center"
/>)}
{isTeacher && (inGroupLibrary ? (
<Link to={`/stories/${story._id}/group/preview`}>
<Button
Expand Down
22 changes: 16 additions & 6 deletions client/components/StoryView/StoryDetailsModal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Modal } from 'semantic-ui-react'
import { Modal, Popup } from 'semantic-ui-react'
import { Button } from 'react-bootstrap'
import { Link } from 'react-router-dom'
import { FormattedMessage } from 'react-intl'
Expand Down Expand Up @@ -72,17 +72,27 @@ const StoryDetailsModal = ({
<Modal.Actions>
<div>
<div className="flex wrap" style={{ gap: '5px' }}>
{!isTeacher && (<LinkButton
{!isTeacher && !story.flashcardOnly && (<LinkButton
variant={isTeacher && inGroupLibrary ? 'secondary' : 'primary'}
to={`/stories/${story._id}/preview`}
translationId="practice"
/>)}
{!enableOnlyPractice && (
<>
{!isTeacher && (<LinkButton
variant={isTeacher && inGroupLibrary ? 'secondary' : 'primary'}
to={`/flashcards/fillin/story/${story._id}/`}
translationId="Flashcards"
{!isTeacher && (<Popup
content={<FormattedMessage id="disabled-flashcard-btn-explanation" />}
trigger={
<Link to={`/flashcards/fillin/story/${story._id}/`}>
<Button
variant='primary'
disabled={enableOnlyPractice || story.flashcard_count === 0}
>
<FormattedMessage id="Flashcards" />
</Button>
</Link>
}
disabled={story.flashcard_count > 0}
position="top center"
/>)}
{isTeacher && inGroupLibrary ? (
<LinkButton
Expand Down
9 changes: 6 additions & 3 deletions client/util/translations/revita/en/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@
"click-to-remove-exercise": "Click to remove this exercise",
"click-to-add-exercise": "Click to add this exercise",
"create-controlled-exercise": "Create controlled story",
"controlled-story-saved": "Tailored story saved successfully",
"controlled-story-saved": "Tailored story saved!",
"refresh": "Refresh",
"save-and-go-to-next-snippet": "Save chosen exercises and go to next snippet",
"regenerate-exercises": "Regenerate exercises",
Expand Down Expand Up @@ -1525,7 +1525,7 @@
"encouragements-default-4": "Great job!",
"have-a-break": "Have a break and go to {link} page",
"show preview-HIDE-FOR-LATER": "Highlight exercises and difficulty levels",
"selected-lesson-themes": "Selected Lesson Themes",
"selected-lesson-themes": "Lesson Themes",
"select-lesson-themes": "Select lesson themes",
"select-lesson-vocab": "Choose level of vocabulary for lesson",
"select-lesson-grammar": "Select grammar topics",
Expand Down Expand Up @@ -1615,5 +1615,8 @@
"group-test-summary": "Test Performance Summary",
"select-lesson-themes-and-vocabulary": "Select lesson themes and level of vocabulary for lesson",
"Recommended vocabulary difficulty": "Recommended vocabulary difficulty",
"submit-chat-message": "Send"
"submit-chat-message": "Send",
"click-here-to-configure-lesson": "Click here to configure your lesson →",
"restart-reading-test": "Restart Test",
"disabled-flashcard-btn-explanation": "This story has no flashcards yet, click on words to add flashcards"
}
17 changes: 10 additions & 7 deletions client/util/translations/revita/fi/LC_MESSAGES/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
},
"practice-mode-enable-exercise-types-7983e37a4d50e27b3b2bb3673948ac71": "Tehtävät",
"fill-the-correct-form": "Täydennä oikea muoto",
"multiple-choice": "Monivalinta",
"multiple-choice": "Monivalintatehtäviä",
"type-the-word-you-hear": "Kirjoita kuulemasi sana",
"second-chance-when-practicing-stories": "Uusi yritys harjoitellessa",
"flashcards-how-many-cards-per-practice-session": "Kysymyskortit: Kuinka monta korttia per sessio",
Expand Down Expand Up @@ -726,7 +726,7 @@
"download-csv": "Lataa csv",
"completed-exercises": "Suoritetut tehtävät",
"join-group-message": "Liity opettajan hallinnoimaan ryhmään, niin saat pääsyn ryhmän jaettuihin tarinoihin.",
"create-group": "Luo",
"create-group": "Luo ryhmä",
"create-group-message": "Luo ryhmä, niin voit jakaa tarinoita ja seurata ryhmäläistesi edistymistä.",
"post-answers-error": "Jotain meni vikaan vastausten tarkistamisen yhteydessä. Ole hyvä ja yritä uudelleen.",
"token-copied": "Koodi kopioitu leikepöydälle",
Expand Down Expand Up @@ -1022,7 +1022,7 @@
"apologies-no-translation": "(Valitettavasti emme löytäneet sanalle käännöksiä, joita käyttää vihjeinä)",
"following": "Seuratut",
"dictionaryhelp-loading-please-wait": "Ladataan, odota",
"dictionaryhelp-no-translation-available": "Käännöstä ei löydy",
"dictionaryhelp-no-translation-available": "Käännöstä ei saatavilla",
"restart-competition": "Sama kilpailu uudellleen",
"tie-try-again": "Tasapeli! Se oli lähellä, kokeile uudestaan!",
"better-luck-next-time": "Parempi onni ensi kerralla",
Expand Down Expand Up @@ -1138,7 +1138,7 @@
"click-to-remove-exercise": "Klikkaa poistaaksesi tehtävän",
"click-to-add-exercise": "Klikkaa lisätäksesi tehtävän",
"create-controlled-exercise": "Luo ohjattu harjoitus",
"controlled-story-saved": "Räätälöity tarina tallennettu onnistuneesti",
"controlled-story-saved": "Räätälöity tarina tallennettu!",
"refresh": "Päivitä",
"save-and-go-to-next-snippet": "Save chosen exercises and go to next snippet",
"regenerate-exercises": "Regeneroi tehtävät",
Expand Down Expand Up @@ -1523,7 +1523,7 @@
"encouragements-default-4": "Hieno suoritus!",
"show preview-HIDE-FOR-LATER": "Korosta harjoitukset ja vaikeustasot",
"have-a-break": "Pidä tauko ja siirry sivulle {link}",
"selected-lesson-themes": "Valitut oppituntiteemat",
"selected-lesson-themes": "Oppituntien teemat",
"select-lesson-themes": "Valitse oppitunnin teemat",
"select-lesson-vocab": "Valitse oppitunnin sanaston taso",
"select-lesson-grammar": "Valitse kieliopin aiheet",
Expand All @@ -1540,7 +1540,7 @@
"next-reading-question": "Seuraava",
"reset-lesson-message": "Järjestä oppitunti",
"Reset Lesson": "Järjestä oppitunti",
"lessons-ready-for-practice": "Oppituntisi on valmis harjoiteltavaksi!",
"lessons-ready-for-practice": "Muokkaa tästä oppituntisi →",
"start-practice-lesson": "Aloita harjoittelu",
"practice-button-story-mode": "Aloita harjoittelu",
"continue-streak-explanation": "Harjoitteluputkisi laskee kuinka monta päivää harjoittelit ilman keskeytyksiä",
Expand Down Expand Up @@ -1614,5 +1614,8 @@
"group-test-summary": "Testisuoritukset",
"select-lesson-themes-and-vocabulary": "Valitse oppitunnin teemat ja sanaston taso",
"Recommended vocabulary difficulty": "Suositeltu sanaston vaikeusaste",
"submit-chat-message": "Lähetä"
"submit-chat-message": "Lähetä",
"click-here-to-configure-lesson": "Muokkaa tästä oppituntisi →",
"restart-reading-test": "Restart Test",
"disabled-flashcard-btn-explanation": "This story has no flashcards yet, click on words to add flashcards"
}
Loading

0 comments on commit a836798

Please sign in to comment.