diff --git a/src/assets/CMPages/CM1.png b/src/assets/CMPages/CM1.png
new file mode 100644
index 00000000..14a7c322
Binary files /dev/null and b/src/assets/CMPages/CM1.png differ
diff --git a/src/assets/CMPages/CM2.png b/src/assets/CMPages/CM2.png
new file mode 100644
index 00000000..6ae4e6e4
Binary files /dev/null and b/src/assets/CMPages/CM2.png differ
diff --git a/src/assets/CMPages/CM3.png b/src/assets/CMPages/CM3.png
new file mode 100644
index 00000000..d3bbb04d
Binary files /dev/null and b/src/assets/CMPages/CM3.png differ
diff --git a/src/assets/ConceptsMasteredIntroPages/CM1.png b/src/assets/ConceptsMasteredIntroPages/CM1.png
deleted file mode 100644
index c43b2a5c..00000000
Binary files a/src/assets/ConceptsMasteredIntroPages/CM1.png and /dev/null differ
diff --git a/src/assets/ConceptsMasteredIntroPages/CM2.png b/src/assets/ConceptsMasteredIntroPages/CM2.png
deleted file mode 100644
index ef7ad303..00000000
Binary files a/src/assets/ConceptsMasteredIntroPages/CM2.png and /dev/null differ
diff --git a/src/assets/ConceptsMasteredIntroPages/CM3.png b/src/assets/ConceptsMasteredIntroPages/CM3.png
deleted file mode 100644
index 69673cf8..00000000
Binary files a/src/assets/ConceptsMasteredIntroPages/CM3.png and /dev/null differ
diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx
index 44282696..9d2ecb74 100644
--- a/src/components/navbar.tsx
+++ b/src/components/navbar.tsx
@@ -1,5 +1,5 @@
import React, { ReactElement } from 'react';
-import { useHistory } from 'react-router-dom';
+import { useHistory, useLocation } from 'react-router-dom';
import styled from 'styled-components';
import DumbellImage from '../assets/Dumbell.png';
import BooksImage from '../assets/Books.png';
@@ -19,9 +19,10 @@ import { ScoresComponent } from './scoresComponent';
import InfoIcon from '../../src/pages/test/components/InfoIcon';
import type { TrainingLevels } from '../../src/models/trainingLevels';
import Circle from './CircleHighlight';
-import AnalyticalDashboardButton from '../../src/pages/test/components/AnalyticalDashboardButton';
import HamburgerMenu from './hamburgerMenu';
-//import ConceptsPage from 'src/pages/concepts-page/concepts-page';
+import { useEffect } from 'react';
+import ImageSlider from '../pages/test/components/imageSlider';
+import { useState } from 'react';
const Navbar = (): ReactElement => {
const history = useHistory();
@@ -32,6 +33,7 @@ const Navbar = (): ReactElement => {
const setIsDisplayingIntroductionModal = useStoreActions(
(store: any) => store.setIsDisplayingIntroductionModal,
);
+
const setTrainingLevel = useStoreActions(
(store: any) => store.setTrainingLevel,
);
@@ -48,6 +50,29 @@ const Navbar = (): ReactElement => {
const chmTierPasswordBypass = useStoreState(
(store: any) => store.chmTierPasswordBypass,
);
+ const isDisplayingIntroductionModal = useStoreState(
+ (store: any) => store.isDisplayingIntroductionModal,
+ );
+ const [toggleValue, setToggleValue] = useState(false);
+
+ const location = useLocation();
+
+ const handleClick = () => {
+ if (trainingLevel === 'CM') {
+ console.log('ENTERED');
+ setIsDisplayingIntroductionModal(true);
+ if (location.pathname === '/concepts-page') {
+ console.log('already set to concepts page');
+ }
+ }
+ };
+
+ useEffect(() => {
+ console.log(
+ 'isDisplayingIntroductionModal after click:',
+ isDisplayingIntroductionModal,
+ );
+ }, [isDisplayingIntroductionModal]);
/* eslint-disable */
const maxWPM = useStoreState(
@@ -177,21 +202,36 @@ const Navbar = (): ReactElement => {
- {trainingLevel == 'CM' ? : ''}
+ {trainingLevel === 'CM' ? : ''}
CM
- (window.location.href = '#/concepts-page') &&
- TrainingPageFunction('CM', true)
- }
+ onClick={() => {
+ history.push('/concepts-page');
+ TrainingPageFunction('CM', true);
+ }}
/>
-
+ {trainingLevel === 'CM' && isDisplayingIntroductionModal && (
+
+
+ {
+ setToggleValue(!toggleValue);
+ setIsDisplayingIntroductionModal(false);
+ }}
+ >
+ ×
+
+
+
+
+ )}
{
setIsDisplayingIntroductionModal(true)}
+ onClick={() => {
+ setIsDisplayingIntroductionModal(true);
+ if (trainingLevel === 'CM') {
+ handleClick();
+ }
+ }}
>
@@ -404,3 +449,20 @@ const ConBtnLink = styled.a`
transition: 0.3s ease out;
}
`;
+const modal = {
+ position: 'absolute' as const,
+ zIndex: '1' as const,
+ left: '5%' as const,
+ width: '75%' as const,
+ textAlign: 'center' as const,
+ backgroundColor: 'rgba(0, 0, 0, 0.25)' as const,
+};
+
+const modal_content = {
+ backgroundColor: '#222424' as const,
+ position: 'absolute' as const,
+ top: '20%' as const,
+ left: '20%' as const,
+ borderRadius: '5px' as const,
+ border: '2px solid black' as const,
+};
diff --git a/src/components/router.tsx b/src/components/router.tsx
index a2bd36df..28987b9d 100644
--- a/src/components/router.tsx
+++ b/src/components/router.tsx
@@ -76,7 +76,6 @@ const Router = (): ReactElement => {
-
{/* This is the route to the Chara Piano page. */}
diff --git a/src/models/flashCardsModel.ts b/src/models/flashCardsModel.ts
index fc081d81..83e24963 100644
--- a/src/models/flashCardsModel.ts
+++ b/src/models/flashCardsModel.ts
@@ -1,7 +1,7 @@
import type { Action, Computed, Thunk } from 'easy-peasy';
export interface flashCard {
- type: 'text' | 'image' | 'translation';
+ //type: 'text' | 'image' | 'translation';
question: string;
answer: string;
imageSrc: string;
@@ -57,11 +57,7 @@ export interface flashCardActionModel {
// Actions to set and remove the selected tag
setSelectedTag: Action;
- // Actions to get and set the last daily training date of a set
- setNextDailyTraining: Action;
- loadNextDailyTraining: Action;
-
- setSessionTrainingData: Action;
+ setSessionTrainingData: Action;
setInfiniteSessionTrainingData: Action<
flashCardStoreStateModel,
activeFlashCard[]
@@ -81,9 +77,6 @@ export interface flashCardStoreStateModel {
selectedTags: string;
sessionTrainingData: sessionTrainingData[];
- nextTrainingDate: Date;
-
- // Number of flash cards to practice daily
numberOfDailyFlashCards: number;
activeFlashCards: Computed;
diff --git a/src/pages/concepts-page/ConceptsPage.styled.tsx b/src/pages/concepts-page/ConceptsPage.styled.tsx
index 908849bf..f7282d3b 100644
--- a/src/pages/concepts-page/ConceptsPage.styled.tsx
+++ b/src/pages/concepts-page/ConceptsPage.styled.tsx
@@ -13,11 +13,16 @@ export const ItemsContainer = styled.div`
background-color: #222424;
`;
-const height = 'height: calc(100vh - 64px);';
+const height = 'calc(100vh - 80px);';
export const PageContainer = styled.div.attrs({
- className: 'text-gray-600 body-font flex flex-row',
+ className: 'text-gray-600 body-font flex',
})`
+ flex-direction: column;
background-color: #222424;
+ height: calc(100% - 111px);
+`;
+
+export const ConceptsContainer = styled.div`
min-height: ${height};
`;
diff --git a/src/pages/concepts-page/ConceptsPage.tsx b/src/pages/concepts-page/ConceptsPage.tsx
index e8970598..8252fa2c 100644
--- a/src/pages/concepts-page/ConceptsPage.tsx
+++ b/src/pages/concepts-page/ConceptsPage.tsx
@@ -2,8 +2,13 @@ import React, { useEffect, useState } from 'react';
import { useStoreState, useStoreActions } from '../../store/store.js';
import { ManagerTier } from './manager-tier/ManagerTier.jsx';
import { DailyTrainingTier } from './daily-training-tier/DailyTrainingTier.jsx';
-import { ItemsContainer, PageContainer } from './ConceptsPage.styled';
import { CustomTrainingTier } from './custom-training-tier/CustomTrainingTier.jsx';
+import Footer from '../../components/footer.jsx';
+import {
+ ItemsContainer,
+ PageContainer,
+ ConceptsContainer,
+} from './ConceptsPage.styled';
const ConceptsPage = () => {
const loadedFromStorage = useStoreState((state) => state.loadedFromStorage);
@@ -29,7 +34,7 @@ const ConceptsPage = () => {
};
return (
- <>
+
{
{loadedFromStorage ? (
{viewCurrentTier()}
) : (
- Loading...
+
)}
- >
+
+
);
};
diff --git a/src/pages/concepts-page/custom-training-tier/CustomTrainingTier.styled.tsx b/src/pages/concepts-page/custom-training-tier/CustomTrainingTier.styled.tsx
index 33983906..e28bdcbb 100644
--- a/src/pages/concepts-page/custom-training-tier/CustomTrainingTier.styled.tsx
+++ b/src/pages/concepts-page/custom-training-tier/CustomTrainingTier.styled.tsx
@@ -1,8 +1,10 @@
import styled from 'styled-components';
export const FullWidthFullHeightContainer = styled.div.attrs({
- className: 'relative h-full w-full',
-})``;
+ className: 'relative w-full',
+})`
+ height: calc(100vh - 191px);
+`;
export const SmallScreenButtons = styled.div.attrs({
className: 'flex flex-row justify-between w-full mb-4',
diff --git a/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.styled.tsx b/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.styled.tsx
index 14687e6c..a951888b 100644
--- a/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.styled.tsx
+++ b/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.styled.tsx
@@ -6,7 +6,9 @@ export const FullWidthFullHeightContainer = styled.div.attrs({
export const DailyTrainingContainer = styled.div.attrs({
className: 'flex flex-col align-center w-full',
-})``;
+})`
+ height: calc(100vh - 191px);
+`;
export const SmallScreenButtons = styled.div.attrs({
className: 'flex flex-row justify-between w-full mb-4',
@@ -17,7 +19,7 @@ export const HelperContainer = styled.div.attrs({
})``;
export const ConceptsMasteredManagerPageContainer = styled.section.attrs({
- className: `text-white body-font min-h-screen bg-[#222424]`,
+ className: `text-white body-font bg-[#222424]`,
})``;
export const PageContainer = styled.section.attrs({
diff --git a/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.tsx b/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.tsx
index 0450475e..0b47ec0a 100644
--- a/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.tsx
+++ b/src/pages/concepts-page/daily-training-tier/DailyTrainingTier.tsx
@@ -22,28 +22,23 @@ interface DailyTrainingPageProps {
export const DailyTrainingTier = ({
setCurrentTier,
}: DailyTrainingPageProps) => {
- const nextTrainingDate = useStoreState((state) => state.nextTrainingDate);
const setSessionTrainingData = useStoreActions(
(actions) => actions.setSessionTrainingData,
);
- const setNextDailyTraining = useStoreActions(
- (actions) => actions.setNextDailyTraining,
- );
const updateLocalStorage = useStoreActions(
(actions) => actions.updateLocalStorage,
);
+ const activeFlashCards = useStoreState((state) => state.activeFlashCards);
+ console.log('Active Flashcards: ', activeFlashCards);
- const [activeTraining, setActiveTraining] = useState(
- new Date() < nextTrainingDate,
- );
+ const [activeTraining, setActiveTraining] = useState(false);
- const startTraining = () => {
- setSessionTrainingData();
+ const startTraining = (numberSelected: number) => {
+ setSessionTrainingData(numberSelected);
setActiveTraining(true);
};
const endTraining = () => {
- setNextDailyTraining();
updateLocalStorage();
setActiveTraining(false);
};
@@ -51,7 +46,7 @@ export const DailyTrainingTier = ({
return (
{activeTraining ? (
- <>
+
@@ -62,7 +57,7 @@ export const DailyTrainingTier = ({
- >
+
) : (
void;
+ setActiveTraining: (setNumberSelected: number) => void;
setCurrentTier: (tier: number) => void;
}
@@ -18,11 +20,10 @@ export const DailyTrainingWelcome = ({
}: DailyTrainingWelcomeProps) => {
const flashCards = useStoreState((state) => state.flashCards);
const activeFlashCards = useStoreState((state) => state.activeFlashCards);
- const nextTrainingDate = useStoreState((state) => state.nextTrainingDate);
- const idleFlashCards = flashCards.length - activeFlashCards.length;
+ const [numberSelected, setNumberSelected] = useState(1);
- const isTrainingAvailable = nextTrainingDate.getTime() < Date.now();
+ const idleFlashCards = flashCards.length - activeFlashCards.length;
const isActiveFlashCards = activeFlashCards.length != 0;
return (
@@ -41,29 +42,36 @@ export const DailyTrainingWelcome = ({
{idleFlashCards}
- {isTrainingAvailable ? (
-
- {isActiveFlashCards ? (
-
- Daily training available:
- setActiveTraining()}>
- Start Training
-
-
- ) : (
-
- No active flash cards:
- setCurrentTier(2)}>
- Go to Manager
-
-
- )}
+ {isActiveFlashCards ? (
+
+
+ How many flashcards would you like to train today?
+
+
+
+ Currently set to {numberSelected} out of {activeFlashCards.length}
+
+
+ setActiveTraining(numberSelected)}>
+ Start Training
+
+
) : (
- Next Available Training is: {nextTrainingDate.toDateString()}
- setCurrentTier(1)}>
- Train in custom
+ No active flash cards:
+ setCurrentTier(2)}>
+ Go to Manager
)}
diff --git a/src/pages/concepts-page/daily-training-tier/Slider.styled.tsx b/src/pages/concepts-page/daily-training-tier/Slider.styled.tsx
new file mode 100644
index 00000000..21b0bb4e
--- /dev/null
+++ b/src/pages/concepts-page/daily-training-tier/Slider.styled.tsx
@@ -0,0 +1,10 @@
+import styled from 'styled-components';
+
+export const SliderContainer = styled.div`
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ width: 400px;
+ height: 50px;
+`;
diff --git a/src/pages/concepts-page/daily-training-tier/Slider.tsx b/src/pages/concepts-page/daily-training-tier/Slider.tsx
new file mode 100644
index 00000000..62ff7927
--- /dev/null
+++ b/src/pages/concepts-page/daily-training-tier/Slider.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import { SliderContainer } from './Slider.styled';
+
+interface SliderProps {
+ max: number;
+ currentNumber: number;
+ setCurrentNumber: (number: number) => void;
+}
+
+export const Slider = ({
+ max,
+ currentNumber,
+ setCurrentNumber,
+}: SliderProps) => {
+ return (
+
+ setCurrentNumber(e.target.valueAsNumber)}
+ />
+
+ );
+};
diff --git a/src/pages/concepts-page/manager-tier/CustomDropDown.tsx b/src/pages/concepts-page/manager-tier/CustomDropDown.tsx
new file mode 100644
index 00000000..bcf08a34
--- /dev/null
+++ b/src/pages/concepts-page/manager-tier/CustomDropDown.tsx
@@ -0,0 +1,55 @@
+import React, { useState, Dispatch, SetStateAction } from 'react';
+import { useStoreState } from '../../../store/store';
+
+interface CustomDropDownProps {
+ setCustomTag: Dispatch
>;
+}
+
+const CustomDropDown: React.FC = ({ setCustomTag }) => {
+ const tags = useStoreState((state) => state.tags) || {};
+ const tagNames = Object.keys(tags);
+
+ const [activeElementType, setActiveElementType] = useState('dropdown');
+ const [customTag, setCustomTagLocal] = useState('');
+
+ const dropDownChanged = (e: React.ChangeEvent) => {
+ const selectedValue = e.target.value;
+
+ if (selectedValue === 'custom') {
+ setActiveElementType('input');
+ } else {
+ setActiveElementType('dropdown');
+ setCustomTagLocal(''); // Reset custom tag when selecting a predefined tag
+ }
+ };
+
+ const dropDownComp = () => (
+
+ {tagNames.map((tagName) => (
+
+ {tagName}
+
+ ))}
+ New Tag?
+
+ );
+
+ const inputFieldComp = () => (
+ {
+ setCustomTagLocal(e.target.value);
+ setCustomTag(e.target.value);
+ }}
+ />
+ );
+
+ return (
+
+ {activeElementType === 'dropdown' ? dropDownComp() : inputFieldComp()}
+
+ );
+};
+
+export default CustomDropDown;
diff --git a/src/pages/concepts-page/manager-tier/DialogPortal.tsx b/src/pages/concepts-page/manager-tier/DialogPortal.tsx
index 90536ad6..b3e4f9da 100644
--- a/src/pages/concepts-page/manager-tier/DialogPortal.tsx
+++ b/src/pages/concepts-page/manager-tier/DialogPortal.tsx
@@ -3,6 +3,7 @@ import { createPortal } from 'react-dom';
import { useStoreActions, useStoreState } from '../../../store/store';
import type { flashCard } from '../../../models/flashCardsModel';
import { FlashCard } from './FlashCard';
+import CustomDropDown from './CustomDropDown';
interface DialogPortalProps {
selectedFlashcardIndices: number[];
@@ -15,21 +16,21 @@ export const DialogPortal = ({
const updatedFlashCards = useStoreState((state) => state.flashCards);
const [showModal, setShowModal] = useState(false);
- const [input, setInput] = useState('');
+
+ const [customTag, setCustomTag] = useState('');
const windowHeight = window.innerHeight;
const windowWidth = window.innerWidth;
const modalHeight = 150;
const modalWidth = 300;
- const modalTop = windowHeight / 2 - modalHeight / 2;
+ const modalTop = windowHeight / 1.5 + modalHeight / 1.5;
const modalLeft = windowWidth / 2 - modalWidth / 2;
const handleAddTag = () => {
- console.log('Adding tag:', input);
- console.log('happening');
+ console.log('Adding tag:', customTag);
selectedFlashcardIndices.forEach((index) => {
- addTagFlashCard({ key: input, index });
+ addTagFlashCard({ key: customTag, index });
});
// Log flashcards and their tags
@@ -38,7 +39,7 @@ export const DialogPortal = ({
console.log('Tags:', flashCard.tags);
});
- setInput('');
+ setCustomTag('');
setShowModal(false);
};
@@ -49,7 +50,7 @@ export const DialogPortal = ({
color="pink"
onClick={() => setShowModal(true)}
>
- Add New Tag
+ Add Tag
{showModal &&
createPortal(
@@ -69,19 +70,14 @@ export const DialogPortal = ({
}}
>
New Tag:
- setInput(e.target.value)}
- placeholder="New Tag"
- />
+
{
setShowModal(false);
- setInput('');
+ setCustomTag('');
}}
>
Cancel
diff --git a/src/pages/concepts-page/manager-tier/FlashCard.tsx b/src/pages/concepts-page/manager-tier/FlashCard.tsx
index 9373fddb..7bda8969 100644
--- a/src/pages/concepts-page/manager-tier/FlashCard.tsx
+++ b/src/pages/concepts-page/manager-tier/FlashCard.tsx
@@ -1,7 +1,6 @@
import React, { useState, useEffect } from 'react';
import { useStoreActions } from '../../../store/store';
import type { flashCard } from '../../../models/flashCardsModel';
-import { Dropdown } from './Dropdown';
import {
FlashCardEditButton,
FlashCardSaveButton,
@@ -15,11 +14,12 @@ import {
FlashCardConfirmDeleteButton,
FlashCardCancelDeleteButton,
} from './FlashCardManagerCardColumn.styled';
+import LazyImage from './LazyImage';
interface FlashCardProps {
flashCard: flashCard;
index: number;
- selected: boolean;
+ selected: boolean[];
setSelected: (index: number) => void;
}
@@ -39,12 +39,21 @@ export const FlashCard = ({
const [deleteButtonProps, setDeleteButtonProps] = useState(false);
const [oldFlashCard, setOldFlashCard] = useState(flashCard);
const [newFlashCard, setNewFlashCard] = useState(flashCard);
+ const [showImageUrl, setShowImageUrl] = useState(
+ !!newFlashCard.imageSrc,
+ );
+ const [previewImage, setPreviewImage] = useState(false);
useEffect(() => {
- if (lockInputs && newFlashCard.type !== oldFlashCard.type) {
+ if (lockInputs && newFlashCard !== oldFlashCard) {
setInputs(false);
}
- });
+ }, [lockInputs, newFlashCard, oldFlashCard]);
+
+ useEffect(() => {
+ const img = new Image();
+ img.src = flashCard.imageSrc;
+ }, [flashCard.imageSrc]);
const onClickConfirmDeleteButton = () => {
setDeleteButtonProps(!deleteButtonProps);
@@ -69,24 +78,19 @@ export const FlashCard = ({
setInputs(!lockInputs);
};
+ const onToggleImageUrlButtonClick = () => {
+ setShowImageUrl(!showImageUrl);
+ };
+
+ const onToggleImagePreviewButtonClick = () => {
+ setPreviewImage(!previewImage);
+ };
+
const onSelectedChange = (selected: string) => {
- if (selected === 'text') {
- setNewFlashCard({
- ...newFlashCard,
- type: 'text',
- question: newFlashCard.answer,
- imageSrc: '',
- });
- } else if (selected === 'translation') {
- setNewFlashCard({
- ...newFlashCard,
- type: 'translation',
- question: newFlashCard.answer,
- imageSrc: '',
- });
- } else if (selected === 'image') {
- setNewFlashCard({ ...newFlashCard, type: 'image', question: '' });
- }
+ const commonProps = {
+ question: newFlashCard.answer,
+ imageSrc: '',
+ };
};
const onClickSaveButton = () => {
@@ -96,52 +100,13 @@ export const FlashCard = ({
setInputs(!lockInputs);
};
- const showCorrectInput = () => {
- if (newFlashCard.type === 'text') {
- return ;
- } else if (newFlashCard.type === 'translation') {
- return (
-
- Translation
-
- setNewFlashCard({ ...newFlashCard, question: e.target.value })
- }
- value={newFlashCard.question}
- />
-
- );
- } else if (newFlashCard.type === 'image') {
- return (
-
- URL
-
- setNewFlashCard({ ...newFlashCard, imageSrc: e.target.value })
- }
- value={newFlashCard.imageSrc}
- />
-
- );
- }
- };
-
return (
setSelected(index)}
- />
-
Term
@@ -149,21 +114,134 @@ export const FlashCard = ({
placeholder={newFlashCard.answer}
disabled={lockInputs}
onChange={(e) => {
- if (newFlashCard.type === 'text') {
- setNewFlashCard({
- ...newFlashCard,
- answer: e.target.value,
- question: e.target.value,
- });
- } else {
- setNewFlashCard({ ...newFlashCard, answer: e.target.value });
- }
+ setNewFlashCard({
+ ...newFlashCard,
+ answer: e.target.value,
+ question: e.target.value,
+ });
}}
value={newFlashCard.answer}
- //value = {questionInput}
/>
- {showCorrectInput()}
+
+ Translation
+
+ setNewFlashCard({ ...newFlashCard, question: e.target.value })
+ }
+ value={newFlashCard.question}
+ />
+
+
+ Image URL
+
+
+
+
+ {showImageUrl && (
+
+ setNewFlashCard({
+ ...newFlashCard,
+ imageSrc: e.target.value,
+ })
+ }
+ value={newFlashCard.imageSrc}
+ style={{
+ marginLeft: '10px',
+ }}
+ />
+ )}
+
+
+ {flashCard.imageSrc != '' && (
+
+ Preview
+
+
+
+ {flashCard.imageSrc !== '' && previewImage && (
+
+ )}
+
+
+
+ )}
void;
- selectedTag: string;
+ selectedTags: string[];
}
export function FlashCardColumn({
- //flashCards,
selected,
setSelected,
- selectedTag,
+ selectedTags = [],
}: FlashCardColumnProps): ReactElement {
const flashCards = useStoreState((state) => state.flashCards);
- //const selectedTag = useStoreState((state) => state.selectedTags);
- // Filter flashcards based on the selected tag
- const filteredFlashCards =
- selectedTag === 'All' || selectedTag === ''
- ? flashCards
- : flashCards.filter((flashCard) => flashCard.tags.includes(selectedTag));
+ const filteredFlashCards = flashCards.filter(
+ (flashCard) =>
+ selectedTags.length === 0 ||
+ selectedTags.some((tag) => flashCard.tags.includes(tag)),
+ );
const flashCardMap = filteredFlashCards.map((flashCard, index) => {
const originalIndex = flashCards.findIndex(
@@ -31,7 +28,7 @@ export function FlashCardColumn({
return (
void;
+ onRemove: () => void;
+}
+
+const Hashtag: React.FC = ({
+ text,
+ selected,
+ onClick,
+ onRemove,
+}) => {
+ const hashtagStyle = {
+ display: 'inline-flex',
+ alignItems: 'center',
+ margin: '5px',
+ padding: '5px',
+ borderRadius: '10px',
+ backgroundColor: selected ? '#3A5A42' : '#A3A3A3 ',
+ color: 'white',
+ cursor: 'pointer',
+ };
+
+ const closeStyle: React.CSSProperties = {
+ marginLeft: '5px',
+ cursor: 'pointer',
+ };
+
+ return (
+
+ {text}
+ {selected && (
+
+ {' '}
+ x
+
+ )}
+
+ );
+};
+
+interface HashTagProps {
+ selectedTags: string[];
+ setSelectedTags: (selectedTags: string[]) => void;
+}
+
+const HashTagMap: React.FC = ({
+ selectedTags,
+ setSelectedTags,
+}) => {
+ const tags = useStoreState((state) => state.tags) || {};
+ const tagNames = Object.keys(tags).filter((tagName) => tagName !== 'All');
+
+ const handleTagClick = (tagName) => {
+ if (tagName === 'All') {
+ } else {
+ const newSelectedTags = selectedTags.includes(tagName)
+ ? selectedTags.filter((tag) => tag !== tagName)
+ : [...selectedTags, tagName];
+ setSelectedTags(newSelectedTags);
+ }
+ };
+
+ return (
+
+ {tagNames.map((tagName) => (
+ handleTagClick(tagName)}
+ onRemove={() => handleTagClick(tagName)}
+ />
+ ))}
+
+ );
+};
+
+export default HashTagMap;
diff --git a/src/pages/concepts-page/manager-tier/LazyImage.tsx b/src/pages/concepts-page/manager-tier/LazyImage.tsx
new file mode 100644
index 00000000..66566aa9
--- /dev/null
+++ b/src/pages/concepts-page/manager-tier/LazyImage.tsx
@@ -0,0 +1,46 @@
+import React, { useState, useEffect } from 'react';
+
+const LazyImage = ({ src, alt, fixedSize }) => {
+ const [isLoaded, setIsLoaded] = useState(false);
+ const [isError, setIsError] = useState(false);
+
+ useEffect(() => {
+ const img = new Image();
+ img.src = src;
+
+ img.onload = () => {
+ setIsLoaded(true);
+ };
+
+ img.onerror = () => {
+ setIsError(true);
+ };
+
+ return () => {
+ img.onload = null;
+ img.onerror = null;
+ };
+ }, [src]);
+
+ return (
+ <>
+ {src && fixedSize && isLoaded && (
+
+ )}
+ {src && !fixedSize && isLoaded && (
+
+ )}
+ {isError && try a different png
}
+ >
+ );
+};
+
+export default LazyImage;
diff --git a/src/pages/concepts-page/manager-tier/ManagerTier.styled.tsx b/src/pages/concepts-page/manager-tier/ManagerTier.styled.tsx
index e2c42839..2b551ea5 100644
--- a/src/pages/concepts-page/manager-tier/ManagerTier.styled.tsx
+++ b/src/pages/concepts-page/manager-tier/ManagerTier.styled.tsx
@@ -25,8 +25,10 @@ export const ComingSoonContainer = styled.div.attrs({
})``;
export const ConceptsMasteredManagerPageContainer = styled.section.attrs({
- className: `text-white body-font min-h-screen bg-[#222424]`,
-})``;
+ className: `text-white body-font bg-[#222424]`,
+})`
+ height: 100%;
+`;
export const GManagerPageContainer = styled.section.attrs({
className: `body-font min-h-screen bg-[#121212]`,
diff --git a/src/pages/concepts-page/manager-tier/ManagerTier.tsx b/src/pages/concepts-page/manager-tier/ManagerTier.tsx
index 07a049dc..2d5b1356 100644
--- a/src/pages/concepts-page/manager-tier/ManagerTier.tsx
+++ b/src/pages/concepts-page/manager-tier/ManagerTier.tsx
@@ -6,9 +6,8 @@ import { ExportFlashCards } from './ExportFlashcards';
import { AddFlashCard } from './AddFlashcard';
import { FlashCardColumn } from './FlashCardColumn';
import { DialogPortal } from './DialogPortal';
-import { TagSetDropdown } from './TagSetDropdown';
+import HashTagMap from './Hashtags';
import { useStoreActions } from '../../../store/store';
-import ImageSlider from '../imageSlider';
import {
ConceptsMasteredManagerPageContainer,
Table,
@@ -22,13 +21,13 @@ import {
export const ManagerTier = (): ReactElement => {
const flashCards = useStoreState((state) => state.flashCards);
const tags = useStoreState((state) => state.tags);
+ console.log(tags);
+ console.log(flashCards);
const [selectedFlashCards, setSelectedFlashCards] = useState(
new Array(flashCards.length).fill(false),
);
- const [selectedTag, setSelectedTag] = useState('');
-
- const setTag = useStoreActions((actions) => actions.setSelectedTag); // Add this line
+ const [selectedTags, setSelectedTags] = useState([]);
useEffect(() => {
if (flashCards.length !== selectedFlashCards.length) {
@@ -54,13 +53,6 @@ export const ManagerTier = (): ReactElement => {
[],
);
- //filter tags
- /*const filteredTags =
- selectedTag === 'All' || selectedTag === ''
- ? flashCards
- : flashCards.filter((flashCard) => flashCard.tags.includes(selectedTag));
- console.log('filteredTags: ' + filteredTags);*/
-
return (
@@ -81,9 +73,9 @@ export const ManagerTier = (): ReactElement => {
-
@@ -92,7 +84,7 @@ export const ManagerTier = (): ReactElement => {
diff --git a/src/pages/concepts-page/manager-tier/TagSetDropdown.tsx b/src/pages/concepts-page/manager-tier/TagSetDropdown.tsx
deleted file mode 100644
index dd686557..00000000
--- a/src/pages/concepts-page/manager-tier/TagSetDropdown.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import React from 'react';
-import { useStoreState } from '../../../store/store';
-import { Dropdown } from './Dropdown';
-
-interface TagSetDropdownProps {
- selectedTag: string;
- setSelectedTag: (selectedTag: string) => void;
-}
-
-export const TagSetDropdown = ({
- selectedTag,
- setSelectedTag,
-}: TagSetDropdownProps) => {
- const tags = useStoreState((state) => state.tags);
-
- const setNames = ['All', ''].concat(Object.keys(tags));
-
- return (
- {
- //console.log('Selected Tag:', selectedTag);
- setSelectedTag(selectedTag);
- }}
- options={setNames}
- selected={selectedTag}
- />
- );
-};
diff --git a/src/pages/concepts-page/trainingComponent/TrainingComponent.tsx b/src/pages/concepts-page/trainingComponent/TrainingComponent.tsx
index de3ed027..21c07c76 100644
--- a/src/pages/concepts-page/trainingComponent/TrainingComponent.tsx
+++ b/src/pages/concepts-page/trainingComponent/TrainingComponent.tsx
@@ -38,7 +38,6 @@ export function TrainingComponent({
const filteredSessionData = sessionTrainingData.filter(
(item) => item.completed == false || item.completed == null,
);
- console.log(trainingData);
if (filteredSessionData.length != 0) {
if (itemsInSession != filteredSessionData.length) {
setTrainingData([
diff --git a/src/pages/test/components/SliderData.tsx b/src/pages/test/components/SliderData.tsx
index 43f60142..8d7620c0 100644
--- a/src/pages/test/components/SliderData.tsx
+++ b/src/pages/test/components/SliderData.tsx
@@ -12,9 +12,9 @@ import AnalyticalDashboard1 from '../../../assets/AnalyticalDashboardWelcomePage
import AnalyticalDashboard2 from '../../../assets/AnalyticalDashboardWelcomePages/Analytical_Dashboard_Welcome2.png';
import AnalyticalDashboard3 from '../../../assets/AnalyticalDashboardWelcomePages/Analytical_Dashboard_Welcome3.png';
import AnalyticalDashboard4 from '../../../assets/AnalyticalDashboardWelcomePages/Analytical_Dashboard_Welcome4.png';
-import CMPage1 from '../../../assets/ConceptsMasteredIntroPages/CM1.png';
-import CMPage2 from '../../../assets/ConceptsMasteredIntroPages/CM2.png';
-import CMPage3 from '../../../assets/ConceptsMasteredIntroPages/CM3.png';
+import CMPage1 from '../../../assets/CMPages/CM1.png';
+import CMPage2 from '../../../assets/CMPages/CM2.png';
+import CMPage3 from '../../../assets/CMPages/CM3.png';
export const SliderData = [
{
diff --git a/src/pages/test/components/imageSlider.tsx b/src/pages/test/components/imageSlider.tsx
index aaafb099..b4374457 100644
--- a/src/pages/test/components/imageSlider.tsx
+++ b/src/pages/test/components/imageSlider.tsx
@@ -15,6 +15,7 @@ const ImageSlider = () => {
// Reset current slide when training level changes
setCurrent(0);
}, [trainingLevel]);
+ console.log('From Image Slider the training level is ' + trainingLevel);
if (trainingLevel === 'CHM') {
slides = SliderDataForCHMTier;
diff --git a/src/store/flashCardStore/action.ts b/src/store/flashCardStore/action.ts
index a27ce69a..23f07019 100644
--- a/src/store/flashCardStore/action.ts
+++ b/src/store/flashCardStore/action.ts
@@ -85,29 +85,12 @@ const flashCardStoreActions: flashCardActionModel = {
}
}),
- setNextDailyTraining: action((state) => {
- const currentDate = new Date();
- currentDate.setHours(0, 0, 0, 0);
- currentDate.setDate(currentDate.getDate() + 1);
-
- state.nextTrainingDate = currentDate;
-
- localStorage.setItem('nextDailyTraining', currentDate.getTime().toString());
- }),
-
- loadNextDailyTraining: action((state, payload) => {
- state.nextTrainingDate = payload;
- }),
-
//Actions to generate training data
- setSessionTrainingData: action((state) => {
+ setSessionTrainingData: action((state, payload) => {
const activeFlashCards = state.activeFlashCards;
const sessionTrainingData: sessionTrainingData[] = [];
- while (
- sessionTrainingData.length < state.numberOfDailyFlashCards &&
- activeFlashCards.length != 0
- ) {
+ while (sessionTrainingData.length < payload) {
const randomIndex = Math.floor(Math.random() * activeFlashCards.length);
const randomFlashCard = activeFlashCards[randomIndex].flashCard;
@@ -211,12 +194,6 @@ const flashCardStoreActions: flashCardActionModel = {
});
}
}
- const nextDailyTrainingString = localStorage.getItem('nextDailyTraining');
- if (nextDailyTrainingString != null) {
- const nextDailyTraining = new Date(parseInt(nextDailyTrainingString));
- console.log('Loaded date: ' + nextDailyTraining);
- actions.loadNextDailyTraining(nextDailyTraining);
- }
actions.setLoadedFromStorage();
}),
};
diff --git a/src/store/flashCardStore/state.ts b/src/store/flashCardStore/state.ts
index e5f37831..079cf460 100644
--- a/src/store/flashCardStore/state.ts
+++ b/src/store/flashCardStore/state.ts
@@ -10,7 +10,6 @@ const flashCardStoreState: flashCardStoreStateModel = {
loadedFromStorage: false,
flashCards: [],
tags: {},
- nextTrainingDate: new Date(),
sessionTrainingData: [],
numberOfDailyFlashCards: 10,
selectedTags: '', // Add this line