@4alldigital/foundation-ui--core 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/package.json +35 -0
- package/src/__mocks__/_examples/cnbc.ts +146 -0
- package/src/__mocks__/_examples/nrg.ts +222 -0
- package/src/__mocks__/empty-module.js +0 -0
- package/src/__mocks__/fileMock.js +3 -0
- package/src/__mocks__/fileTransformer.js +8 -0
- package/src/__mocks__/mockSearchData.js +511 -0
- package/src/__mocks__/nrglogo.svg +74 -0
- package/src/__mocks__/styleMock.js +3 -0
- package/src/__mocks__/tempPolyFills.js +5 -0
- package/src/components/Accordion/Accordion.stories.tsx +33 -0
- package/src/components/Accordion/Accordion.tsx +53 -0
- package/src/components/Accordion/Accordion.types.ts +8 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/AnimationCounter/AnimationCounter.stories.tsx +22 -0
- package/src/components/AnimationCounter/AnimationCounter.tsx +51 -0
- package/src/components/AnimationCounter/AnimationCounter.types.ts +10 -0
- package/src/components/AnimationCounter/index.ts +1 -0
- package/src/components/AnimationSet1/AnimationSet1.stories.tsx +36 -0
- package/src/components/AnimationSet1/AnimationSet1.tsx +107 -0
- package/src/components/AnimationSet1/AnimationSet1.types.ts +12 -0
- package/src/components/AnimationSet1/index.ts +1 -0
- package/src/components/Authenticator/Authenticator.stories.tsx +37 -0
- package/src/components/Authenticator/Authenticator.tsx +84 -0
- package/src/components/Authenticator/Authenticator.types.ts +7 -0
- package/src/components/Authenticator/index.ts +1 -0
- package/src/components/Avatar/Avatar.stories.tsx +26 -0
- package/src/components/Avatar/Avatar.tsx +88 -0
- package/src/components/Avatar/Avatar.types.ts +8 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Banner/Banner.stories.tsx +59 -0
- package/src/components/Banner/Banner.tsx +60 -0
- package/src/components/Banner/Banner.types.ts +9 -0
- package/src/components/Banner/index.ts +1 -0
- package/src/components/Blockquote/Blockquote.stories.tsx +20 -0
- package/src/components/Blockquote/Blockquote.tsx +32 -0
- package/src/components/Blockquote/Blockquote.types.ts +8 -0
- package/src/components/Blockquote/index.ts +1 -0
- package/src/components/Button/Button.stories.tsx +50 -0
- package/src/components/Button/Button.tsx +117 -0
- package/src/components/Button/Button.types.ts +43 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/ButtonGroup/ButtonGroup.stories.tsx +59 -0
- package/src/components/ButtonGroup/ButtonGroup.tsx +35 -0
- package/src/components/ButtonGroup/ButtonGroup.types.ts +5 -0
- package/src/components/ButtonGroup/index.ts +1 -0
- package/src/components/Calendar/Calendar.stories.tsx +100 -0
- package/src/components/Calendar/Calendar.tsx +91 -0
- package/src/components/Calendar/Calendar.types.ts +10 -0
- package/src/components/Calendar/index.ts +2 -0
- package/src/components/Card/Card.stories.tsx +487 -0
- package/src/components/Card/Card.tsx +32 -0
- package/src/components/Card/Card.types.ts +79 -0
- package/src/components/Card/constants/index.ts +8 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Card/types/CardBasic/CardBasic.tsx +262 -0
- package/src/components/Card/types/CardBasic/CardBasic.types.ts +7 -0
- package/src/components/Card/types/CardBasic/index.ts +1 -0
- package/src/components/Card/types/CardData/CardData.tsx +68 -0
- package/src/components/Card/types/CardData/CardData.types.ts +21 -0
- package/src/components/Card/types/CardData/index.ts +1 -0
- package/src/components/Card/types/CardHorz/CardHorz.tsx +80 -0
- package/src/components/Card/types/CardHorz/CardHorz.types.ts +8 -0
- package/src/components/Card/types/CardHorz/index.ts +1 -0
- package/src/components/Card/types/CardIcon/CardIcon.tsx +76 -0
- package/src/components/Card/types/CardIcon/CardIcon.types.ts +8 -0
- package/src/components/Card/types/CardIcon/index.ts +1 -0
- package/src/components/Card/types/CardMedia/CardMedia.tsx +277 -0
- package/src/components/Card/types/CardMedia/CardMedia.types.ts +5 -0
- package/src/components/Card/types/CardMedia/index.ts +1 -0
- package/src/components/Card/types/CardVideo/CardVideo.tsx +262 -0
- package/src/components/Card/types/CardVideo/CardVideo.types.ts +11 -0
- package/src/components/Card/types/CardVideo/index.ts +1 -0
- package/src/components/CardGrid/CardGrid.stories.tsx +122 -0
- package/src/components/CardGrid/CardGrid.tsx +25 -0
- package/src/components/CardGrid/CardGrid.types.ts +7 -0
- package/src/components/CardGrid/index.ts +1 -0
- package/src/components/Carousel/Carousel.stories.tsx +351 -0
- package/src/components/Carousel/Carousel.tsx +174 -0
- package/src/components/Carousel/Carousel.types.ts +32 -0
- package/src/components/Carousel/MIGRATION.md +156 -0
- package/src/components/Carousel/index.ts +1 -0
- package/src/components/Cart/Cart.stories.tsx +92 -0
- package/src/components/Cart/Cart.tsx +194 -0
- package/src/components/Cart/Cart.types.ts +4 -0
- package/src/components/Cart/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +18 -0
- package/src/components/Checkbox/Checkbox.tsx +38 -0
- package/src/components/Checkbox/Checkbox.types.ts +15 -0
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.stories.tsx +37 -0
- package/src/components/Chip/Chip.tsx +104 -0
- package/src/components/Chip/Chip.types.ts +13 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Collapsible/Collapsible.stories.tsx +139 -0
- package/src/components/Collapsible/Collapsible.tsx +75 -0
- package/src/components/Collapsible/Collapsible.types.ts +14 -0
- package/src/components/Collapsible/index.ts +3 -0
- package/src/components/Container/Container.stories.tsx +17 -0
- package/src/components/Container/Container.tsx +51 -0
- package/src/components/Container/Container.types.ts +17 -0
- package/src/components/Container/index.ts +1 -0
- package/src/components/ContentPageLayout/ContentPageLayout.stories.tsx +17 -0
- package/src/components/ContentPageLayout/ContentPageLayout.tsx +38 -0
- package/src/components/ContentPageLayout/ContentPageLayout.types.ts +17 -0
- package/src/components/ContentPageLayout/index.ts +1 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.stories.tsx +19 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.tsx +30 -0
- package/src/components/ContentRowsLayout/ContentRowsLayout.types.ts +15 -0
- package/src/components/ContentRowsLayout/index.ts +1 -0
- package/src/components/Copy/Copy.stories.tsx +28 -0
- package/src/components/Copy/Copy.tsx +43 -0
- package/src/components/Copy/Copy.types.tsx +53 -0
- package/src/components/Copy/index.tsx +1 -0
- package/src/components/DisplayHeading/DisplayHeading.stories.tsx +17 -0
- package/src/components/DisplayHeading/DisplayHeading.tsx +43 -0
- package/src/components/DisplayHeading/DisplayHeading.types.ts +8 -0
- package/src/components/DisplayHeading/index.ts +1 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +18 -0
- package/src/components/FileUpload/FileUpload.tsx +41 -0
- package/src/components/FileUpload/FileUpload.types.ts +9 -0
- package/src/components/FileUpload/index.ts +1 -0
- package/src/components/Footer/Footer.stories.tsx +17 -0
- package/src/components/Footer/Footer.tsx +78 -0
- package/src/components/Footer/Footer.types.ts +4 -0
- package/src/components/Footer/index.ts +1 -0
- package/src/components/Form/Form.stories.tsx +81 -0
- package/src/components/Form/Form.tsx +98 -0
- package/src/components/Form/Form.types.ts +34 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/FormField/FormField.stories.tsx +205 -0
- package/src/components/FormField/FormField.tsx +258 -0
- package/src/components/FormField/FormField.types.ts +89 -0
- package/src/components/FormField/index.ts +1 -0
- package/src/components/FormSelect/FormSelect.stories.tsx +27 -0
- package/src/components/FormSelect/FormSelect.tsx +46 -0
- package/src/components/FormSelect/FormSelect.types.ts +45 -0
- package/src/components/FormSelect/index.ts +1 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.stories.tsx +18 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.tsx +26 -0
- package/src/components/FullContentBackgroundImage/FullContentBackgroundImage.types.ts +6 -0
- package/src/components/FullContentBackgroundImage/index.ts +1 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.stories.tsx +34 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.tsx +41 -0
- package/src/components/FullScreenVideoModal/FullScreenVideoModal.types.ts +9 -0
- package/src/components/FullScreenVideoModal/index.ts +1 -0
- package/src/components/Header/Header.stories.tsx +51 -0
- package/src/components/Header/Header.tsx +170 -0
- package/src/components/Header/Header.types.ts +11 -0
- package/src/components/Header/index.ts +1 -0
- package/src/components/Heading/Heading.stories.tsx +57 -0
- package/src/components/Heading/Heading.tsx +47 -0
- package/src/components/Heading/Heading.types.ts +35 -0
- package/src/components/Heading/index.ts +1 -0
- package/src/components/Hero/Hero.stories.tsx +17 -0
- package/src/components/Hero/Hero.tsx +28 -0
- package/src/components/Hero/Hero.types.ts +17 -0
- package/src/components/Hero/index.ts +1 -0
- package/src/components/Hr/Hr.stories.tsx +13 -0
- package/src/components/Hr/Hr.tsx +16 -0
- package/src/components/Hr/Hr.types.ts +3 -0
- package/src/components/Hr/index.ts +1 -0
- package/src/components/HtmlContent/HtmlContent.stories.tsx +29 -0
- package/src/components/HtmlContent/HtmlContent.tsx +36 -0
- package/src/components/HtmlContent/HtmlContent.types.ts +6 -0
- package/src/components/HtmlContent/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +26 -0
- package/src/components/Icon/Icon.tsx +24 -0
- package/src/components/Icon/Icon.types.ts +8 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Image/Image.stories.tsx +32 -0
- package/src/components/Image/Image.tsx +71 -0
- package/src/components/Image/Image.types.ts +20 -0
- package/src/components/Image/index.ts +1 -0
- package/src/components/Label/Label.stories.tsx +18 -0
- package/src/components/Label/Label.tsx +17 -0
- package/src/components/Label/Label.types.ts +9 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link/Link.stories.tsx +25 -0
- package/src/components/Link/Link.tsx +85 -0
- package/src/components/Link/Link.types.ts +14 -0
- package/src/components/Link/index.ts +1 -0
- package/src/components/List/List.stories.tsx +38 -0
- package/src/components/List/List.tsx +17 -0
- package/src/components/List/List.types.ts +27 -0
- package/src/components/List/index.ts +1 -0
- package/src/components/ListItem/ListItem.stories.tsx +61 -0
- package/src/components/ListItem/ListItem.tsx +53 -0
- package/src/components/ListItem/ListItem.types.ts +10 -0
- package/src/components/ListItem/index.ts +1 -0
- package/src/components/Loader/Loader.stories.tsx +17 -0
- package/src/components/Loader/Loader.tsx +34 -0
- package/src/components/Loader/Loader.types.ts +5 -0
- package/src/components/Loader/index.ts +1 -0
- package/src/components/Logo/Logo.stories.tsx +17 -0
- package/src/components/Logo/Logo.tsx +17 -0
- package/src/components/Logo/Logo.types.ts +6 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menu/Menu.stories.tsx +37 -0
- package/src/components/Menu/Menu.tsx +45 -0
- package/src/components/Menu/Menu.types.ts +15 -0
- package/src/components/Menu/index.ts +1 -0
- package/src/components/Notice/Notice.stories.tsx +49 -0
- package/src/components/Notice/Notice.tsx +63 -0
- package/src/components/Notice/Notice.types.ts +11 -0
- package/src/components/Notice/index.ts +1 -0
- package/src/components/OTPInput/OTPInput.stories.tsx +18 -0
- package/src/components/OTPInput/OTPInput.tsx +80 -0
- package/src/components/OTPInput/OTPInput.types.ts +8 -0
- package/src/components/OTPInput/index.ts +1 -0
- package/src/components/PanelCards/PanelCards.stories.tsx +125 -0
- package/src/components/PanelCards/PanelCards.tsx +81 -0
- package/src/components/PanelCards/PanelCards.types.ts +11 -0
- package/src/components/PanelCards/index.ts +1 -0
- package/src/components/PanelCustom/PanelCustom.stories.tsx +18 -0
- package/src/components/PanelCustom/PanelCustom.tsx +39 -0
- package/src/components/PanelCustom/PanelCustom.types.ts +20 -0
- package/src/components/PanelCustom/index.ts +1 -0
- package/src/components/PanelFeature/PanelFeature.stories.tsx +46 -0
- package/src/components/PanelFeature/PanelFeature.tsx +83 -0
- package/src/components/PanelFeature/PanelFeature.types.ts +27 -0
- package/src/components/PanelFeature/index.ts +1 -0
- package/src/components/PanelHero/PanelHero.stories.tsx +126 -0
- package/src/components/PanelHero/PanelHero.tsx +184 -0
- package/src/components/PanelHero/PanelHero.types.ts +19 -0
- package/src/components/PanelHero/index.ts +1 -0
- package/src/components/PanelIntro/PanelIntro.stories.tsx +38 -0
- package/src/components/PanelIntro/PanelIntro.tsx +139 -0
- package/src/components/PanelIntro/PanelIntro.types.ts +19 -0
- package/src/components/PanelIntro/index.ts +1 -0
- package/src/components/PanelProduct/PanelProduct.stories.tsx +24 -0
- package/src/components/PanelProduct/PanelProduct.tsx +87 -0
- package/src/components/PanelProduct/PanelProduct.types.ts +14 -0
- package/src/components/PanelProduct/index.ts +1 -0
- package/src/components/PanelScroller/PanelScroller.stories.tsx +81 -0
- package/src/components/PanelScroller/PanelScroller.tsx +58 -0
- package/src/components/PanelScroller/PanelScroller.types.ts +8 -0
- package/src/components/PanelScroller/index.ts +1 -0
- package/src/components/PanelVideo/PanelVideo.stories.tsx +42 -0
- package/src/components/PanelVideo/PanelVideo.tsx +81 -0
- package/src/components/PanelVideo/PanelVideo.types.ts +11 -0
- package/src/components/PanelVideo/index.ts +1 -0
- package/src/components/Radio/Radio.stories.tsx +24 -0
- package/src/components/Radio/Radio.tsx +44 -0
- package/src/components/Radio/Radio.types.ts +13 -0
- package/src/components/Radio/index.ts +1 -0
- package/src/components/Schedule/Schedule.stories.tsx +96 -0
- package/src/components/Schedule/Schedule.tsx +118 -0
- package/src/components/Schedule/Schedule.types.ts +64 -0
- package/src/components/Schedule/index.ts +1 -0
- package/src/components/ScheduleItem/ScheduleItem.stories.tsx +21 -0
- package/src/components/ScheduleItem/ScheduleItem.tsx +77 -0
- package/src/components/ScheduleItem/ScheduleItem.types.ts +8 -0
- package/src/components/ScheduleItem/index.ts +1 -0
- package/src/components/Screen/Screen.stories.tsx +27 -0
- package/src/components/Screen/Screen.tsx +63 -0
- package/src/components/Screen/Screen.types.ts +16 -0
- package/src/components/Screen/index.ts +1 -0
- package/src/components/ShadcnButton/ShadcnButton.tsx +57 -0
- package/src/components/ShadcnButton/index.ts +2 -0
- package/src/components/ShadcnCarousel/ShadcnCarousel.tsx +261 -0
- package/src/components/ShadcnCarousel/index.ts +9 -0
- package/src/components/Share/Share.stories.tsx +17 -0
- package/src/components/Share/Share.tsx +60 -0
- package/src/components/Share/Share.types.ts +12 -0
- package/src/components/Share/index.ts +1 -0
- package/src/components/SubscriptionManager/SubscriptionManager.stories.tsx +177 -0
- package/src/components/SubscriptionManager/SubscriptionManager.tsx +369 -0
- package/src/components/SubscriptionManager/SubscriptionManager.types.ts +36 -0
- package/src/components/SubscriptionManager/index.ts +1 -0
- package/src/components/Switch/Switch.stories.tsx +20 -0
- package/src/components/Switch/Switch.tsx +30 -0
- package/src/components/Switch/Switch.types.ts +7 -0
- package/src/components/Switch/index.ts +1 -0
- package/src/components/Tabs/Tabs.stories.tsx +34 -0
- package/src/components/Tabs/Tabs.tsx +42 -0
- package/src/components/Tabs/Tabs.types.ts +8 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/TextInput/TextInput.stories.tsx +18 -0
- package/src/components/TextInput/TextInput.tsx +78 -0
- package/src/components/TextInput/TextInput.types.ts +81 -0
- package/src/components/TextInput/index.ts +1 -0
- package/src/components/Video/Video.stories.tsx +75 -0
- package/src/components/Video/Video.tsx +280 -0
- package/src/components/Video/Video.types.ts +147 -0
- package/src/components/Video/index.ts +1 -0
- package/src/components/VisitUs/VisitUs.stories.tsx +32 -0
- package/src/components/VisitUs/VisitUs.tsx +56 -0
- package/src/components/VisitUs/VisitUs.types.ts +13 -0
- package/src/components/VisitUs/index.ts +1 -0
- package/src/components/index.ts +143 -0
- package/src/constants/index.ts +6 -0
- package/src/context/Amplify/index.tsx +65 -0
- package/src/context/App/index.tsx +93 -0
- package/src/context/Cart/index.tsx +64 -0
- package/src/context/ExampleContext/index.tsx +34 -0
- package/src/context/Theme/index.tsx +37 -0
- package/src/context/index.ts +18 -0
- package/src/features/Search/Search.stories.tsx +395 -0
- package/src/features/Search/Search.tsx +204 -0
- package/src/features/Search/Search.types.ts +41 -0
- package/src/features/Search/config/config-helper.ts +219 -0
- package/src/features/Search/index.ts +1 -0
- package/src/features/Search/view-helpers/appendClassName.ts +14 -0
- package/src/features/Search/view-helpers/formatResult.ts +97 -0
- package/src/features/Search/view-helpers/getFilterValueDisplay.ts +10 -0
- package/src/features/Search/view-helpers/getUrlSanitizer.ts +23 -0
- package/src/features/Search/view-helpers/index.ts +4 -0
- package/src/features/Search/views/Layout/Layout.tsx +50 -0
- package/src/features/Search/views/Layout/Layout.types.ts +13 -0
- package/src/features/Search/views/Layout/index.ts +1 -0
- package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.tsx +85 -0
- package/src/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.types.ts +5 -0
- package/src/features/Search/views/MultiCheckboxFacet/index.ts +1 -0
- package/src/features/Search/views/Paging/Paging.tsx +35 -0
- package/src/features/Search/views/Paging/Paging.types.ts +24 -0
- package/src/features/Search/views/Paging/index.ts +1 -0
- package/src/features/Search/views/PagingInfo/PagingInfo.tsx +34 -0
- package/src/features/Search/views/PagingInfo/PagingInfo.types.ts +26 -0
- package/src/features/Search/views/PagingInfo/index.ts +1 -0
- package/src/features/Search/views/Result/Result.tsx +84 -0
- package/src/features/Search/views/Result/Result.types.ts +47 -0
- package/src/features/Search/views/Result/index.ts +1 -0
- package/src/features/Search/views/Results/Results.tsx +16 -0
- package/src/features/Search/views/Results/Results.types.ts +24 -0
- package/src/features/Search/views/Results/index.ts +1 -0
- package/src/features/Search/views/ResultsPerPage/ResultsPerPage.tsx +32 -0
- package/src/features/Search/views/ResultsPerPage/ResultsPerPage.types.ts +26 -0
- package/src/features/Search/views/ResultsPerPage/index.ts +1 -0
- package/src/features/Search/views/SearchBox/SearchBox.tsx +51 -0
- package/src/features/Search/views/SearchBox/SearchBox.types.ts +10 -0
- package/src/features/Search/views/SearchBox/index.ts +1 -0
- package/src/features/Search/views/Sidebar/Sidebar.tsx +14 -0
- package/src/features/Search/views/Sidebar/Sidebar.types.ts +3 -0
- package/src/features/Search/views/Sidebar/index.ts +1 -0
- package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.tsx +62 -0
- package/src/features/Search/views/SingleLinksFacet/SingleLinksFacet.types.ts +5 -0
- package/src/features/Search/views/SingleLinksFacet/index.ts +1 -0
- package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.tsx +34 -0
- package/src/features/Search/views/SingleSelectFacet/SingleSelectFacet.types.ts +5 -0
- package/src/features/Search/views/SingleSelectFacet/index.ts +1 -0
- package/src/features/Search/views/Sorting/Sorting.tsx +24 -0
- package/src/features/Search/views/Sorting/Sorting.types.ts +25 -0
- package/src/features/Search/views/Sorting/index.ts +1 -0
- package/src/features/index.ts +11 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.stories.tsx +19 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.tsx +28 -0
- package/src/forms/ForgotPasswordForm/ForgotPasswordForm.types.ts +3 -0
- package/src/forms/ForgotPasswordForm/index.ts +1 -0
- package/src/forms/LoginForm/LoginForm.stories.tsx +67 -0
- package/src/forms/LoginForm/LoginForm.tsx +112 -0
- package/src/forms/LoginForm/LoginForm.types.ts +7 -0
- package/src/forms/LoginForm/index.ts +1 -0
- package/src/forms/ProfileForm/ProfileForm.stories.tsx +23 -0
- package/src/forms/ProfileForm/ProfileForm.tsx +40 -0
- package/src/forms/ProfileForm/ProfileForm.types.ts +6 -0
- package/src/forms/ProfileForm/index.ts +1 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.stories.tsx +19 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.tsx +22 -0
- package/src/forms/PromoCodeForm/PromoCodeForm.types.ts +4 -0
- package/src/forms/PromoCodeForm/index.ts +1 -0
- package/src/forms/RegisterForm/RegisterForm.stories.tsx +85 -0
- package/src/forms/RegisterForm/RegisterForm.tsx +108 -0
- package/src/forms/RegisterForm/RegisterForm.types.ts +6 -0
- package/src/forms/RegisterForm/index.ts +1 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.stories.tsx +23 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.tsx +39 -0
- package/src/forms/ResetPasswordAuthForm/ResetPasswordAuthForm.types.ts +3 -0
- package/src/forms/ResetPasswordAuthForm/index.ts +1 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.stories.tsx +23 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.tsx +30 -0
- package/src/forms/ResetPasswordForm/ResetPasswordForm.types.ts +3 -0
- package/src/forms/ResetPasswordForm/index.ts +1 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.stories.tsx +31 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.tsx +46 -0
- package/src/forms/SubscriptionForm/SubscriptionForm.types.ts +6 -0
- package/src/forms/SubscriptionForm/index.ts +1 -0
- package/src/forms/constants/index.ts +13 -0
- package/src/forms/index.ts +17 -0
- package/src/forms/validations/index.ts +39 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useLanguage.ts +18 -0
- package/src/hooks/useTheme.ts +6 -0
- package/src/index.ts +8 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/setupTests.ts +5 -0
- package/src/templates/AccountScreen/AccountScreen.stories.tsx +67 -0
- package/src/templates/AccountScreen/AccountScreen.tsx +78 -0
- package/src/templates/AccountScreen/AccountScreen.types.ts +31 -0
- package/src/templates/AccountScreen/index.ts +1 -0
- package/src/templates/AuthScreen/AuthScreen.stories.tsx +33 -0
- package/src/templates/AuthScreen/AuthScreen.tsx +21 -0
- package/src/templates/AuthScreen/AuthScreen.types.ts +8 -0
- package/src/templates/AuthScreen/index.ts +1 -0
- package/src/templates/CardGridScreen/CardGridScreen.stories.tsx +95 -0
- package/src/templates/CardGridScreen/CardGridScreen.tsx +43 -0
- package/src/templates/CardGridScreen/CardGridScreen.types.ts +11 -0
- package/src/templates/CardGridScreen/index.ts +1 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.stories.tsx +31 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.tsx +21 -0
- package/src/templates/CatalogueScreen/CatalogueScreen.types.ts +8 -0
- package/src/templates/CatalogueScreen/index.ts +1 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.stories.tsx +171 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.tsx +36 -0
- package/src/templates/ChallengeLibraryScreen/ChallengeLibraryScreen.types.ts +9 -0
- package/src/templates/ChallengeLibraryScreen/index.ts +1 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.stories.tsx +65 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.tsx +88 -0
- package/src/templates/ChallengeScreen/ChallengeScreen.types.ts +22 -0
- package/src/templates/ChallengeScreen/index.ts +1 -0
- package/src/templates/ContentScreen/ContentScreen.stories.tsx +71 -0
- package/src/templates/ContentScreen/ContentScreen.tsx +55 -0
- package/src/templates/ContentScreen/ContentScreen.types.ts +9 -0
- package/src/templates/ContentScreen/index.ts +1 -0
- package/src/templates/DashboardScreen/DashboardScreen.stories.tsx +490 -0
- package/src/templates/DashboardScreen/DashboardScreen.tsx +156 -0
- package/src/templates/DashboardScreen/DashboardScreen.types.ts +28 -0
- package/src/templates/DashboardScreen/index.ts +1 -0
- package/src/templates/FAQScreen/FAQScreen.stories.tsx +278 -0
- package/src/templates/FAQScreen/FAQScreen.tsx +32 -0
- package/src/templates/FAQScreen/FAQScreen.types.ts +14 -0
- package/src/templates/FAQScreen/index.ts +1 -0
- package/src/templates/HomeScreen/HomeScreen.stories.tsx +315 -0
- package/src/templates/HomeScreen/HomeScreen.tsx +50 -0
- package/src/templates/HomeScreen/HomeScreen.types.ts +23 -0
- package/src/templates/HomeScreen/index.ts +1 -0
- package/src/templates/LogoutScreen/LogoutScreen.stories.tsx +20 -0
- package/src/templates/LogoutScreen/LogoutScreen.tsx +25 -0
- package/src/templates/LogoutScreen/LogoutScreen.types.ts +4 -0
- package/src/templates/LogoutScreen/index.ts +1 -0
- package/src/templates/MenuScreen/MenuScreen.stories.tsx +36 -0
- package/src/templates/MenuScreen/MenuScreen.tsx +32 -0
- package/src/templates/MenuScreen/MenuScreen.types.ts +11 -0
- package/src/templates/MenuScreen/index.ts +1 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.stories.tsx +20 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.tsx +31 -0
- package/src/templates/NotFoundScreen/NotFoundScreen.types.ts +5 -0
- package/src/templates/NotFoundScreen/index.ts +1 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.stories.tsx +27 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.tsx +20 -0
- package/src/templates/PasswordResetAuthScreen/PasswordResetAuthScreen.types.ts +6 -0
- package/src/templates/PasswordResetAuthScreen/index.ts +1 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.stories.tsx +22 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.tsx +19 -0
- package/src/templates/PasswordResetScreen/PasswordResetScreen.types.ts +6 -0
- package/src/templates/PasswordResetScreen/index.ts +1 -0
- package/src/templates/ProfileScreen/ProfileScreen.stories.tsx +41 -0
- package/src/templates/ProfileScreen/ProfileScreen.tsx +30 -0
- package/src/templates/ProfileScreen/ProfileScreen.types.ts +24 -0
- package/src/templates/ProfileScreen/index.ts +1 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.stories.tsx +174 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.tsx +29 -0
- package/src/templates/ScheduleScreen/ScheduleScreen.types.ts +9 -0
- package/src/templates/ScheduleScreen/index.ts +1 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.stories.tsx +98 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.tsx +49 -0
- package/src/templates/SubscriptionScreen/SubscriptionScreen.types.ts +28 -0
- package/src/templates/SubscriptionScreen/index.ts +1 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.stories.tsx +173 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.tsx +230 -0
- package/src/templates/WorkoutScreen/WorkoutScreen.types.ts +34 -0
- package/src/templates/WorkoutScreen/index.ts +1 -0
- package/src/templates/index.ts +40 -0
- package/src/translations/en.ts +777 -0
- package/src/translations/fr.ts +182 -0
- package/src/translations/index.ts +2 -0
- package/src/utils/htmlParser/index.tsx +22 -0
- package/src/utils/index.ts +38 -0
- package/src/utils/parseDuration/index.ts +94 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import SubscriptionScreen from '.';
|
|
3
|
+
import { Copy } from '../../components';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof SubscriptionScreen> = {
|
|
6
|
+
title: 'TEMPLATES/SubscriptionScreen',
|
|
7
|
+
component: SubscriptionScreen,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof SubscriptionScreen>;
|
|
11
|
+
|
|
12
|
+
export const Default: Story = {
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: 'fullscreen',
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
title: 'Manage Subscription',
|
|
18
|
+
testID: 'subscription',
|
|
19
|
+
image: 'https://picsum.photos/600/400',
|
|
20
|
+
user: {
|
|
21
|
+
profile: {
|
|
22
|
+
firstName: 'Joe',
|
|
23
|
+
lastName: 'Bloggs',
|
|
24
|
+
email: 'joe.bloggs@example.com',
|
|
25
|
+
picture: 'https://dpyu2eix72mhm.cloudfront.net/54D17717-343B-4DAA-A2D0-071F8C1F8DF3.jpg',
|
|
26
|
+
dateOfBirth: '1980-01-01',
|
|
27
|
+
},
|
|
28
|
+
subscription: {
|
|
29
|
+
status: 'Active',
|
|
30
|
+
plan: 'Premium',
|
|
31
|
+
price: '$9.99',
|
|
32
|
+
billingDate: '2024-12-31',
|
|
33
|
+
cardType: 'Visa',
|
|
34
|
+
cardNumber: '**** **** **** 1234',
|
|
35
|
+
cardExpiry: '12/24',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
handleSubscriptionSubmit: values => console.log('handleSubscriptionSubmit', values),
|
|
39
|
+
subscriptionCallback: () => {
|
|
40
|
+
// Open mailto link
|
|
41
|
+
window.location.href = 'mailto:example@example.com?subject=Your%20Subject&body=Your%20message%20here';
|
|
42
|
+
},
|
|
43
|
+
subscriptionManagerProps: {
|
|
44
|
+
description: 'Manage your subscription here. New subscription include a 7-day free trial.',
|
|
45
|
+
subscription: {
|
|
46
|
+
id: '1',
|
|
47
|
+
status: 'active',
|
|
48
|
+
plan: 'Premium',
|
|
49
|
+
price: '£4.50',
|
|
50
|
+
nextBillingDate: '20th August 2021',
|
|
51
|
+
endDate: '20th September 2021',
|
|
52
|
+
},
|
|
53
|
+
// subscription: undefined,
|
|
54
|
+
plans: [
|
|
55
|
+
{
|
|
56
|
+
id: '1',
|
|
57
|
+
name: 'Premium',
|
|
58
|
+
price: '£4.50',
|
|
59
|
+
icon: 'mdi:rotate-360',
|
|
60
|
+
description: 'Unlimited Platform Access',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: '2',
|
|
64
|
+
name: 'Premium+',
|
|
65
|
+
price: '£19.50',
|
|
66
|
+
icon: 'mdi:camera-flip',
|
|
67
|
+
description: 'Unlimited On-Demand and Live classes',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: '3',
|
|
71
|
+
name: 'Premium (Annual)',
|
|
72
|
+
price: '£4.50',
|
|
73
|
+
icon: 'mdi:rotate-360',
|
|
74
|
+
description: 'Unlimited Platform Access',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: '4',
|
|
78
|
+
name: 'Premium+ (Annual)',
|
|
79
|
+
price: '£19.50',
|
|
80
|
+
icon: 'mdi:camera-flip',
|
|
81
|
+
description: 'Unlimited On-Demand and Live classes',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
children: (
|
|
85
|
+
<div className="flex justify-center gap-4">
|
|
86
|
+
<Copy>Stripe payment form goes here FROM APP.</Copy>
|
|
87
|
+
</div>
|
|
88
|
+
),
|
|
89
|
+
pauseSubscriptionCallback: () => console.log('Pause Subscription'),
|
|
90
|
+
changeSubscriptionCallback: (id: string) => console.log('Change Subscription to: ', id),
|
|
91
|
+
// contactSupportCallback: () => console.log('Contact Support'),
|
|
92
|
+
selectedPlanCallback: (planId: string) => console.log('Selected Plan: ', planId),
|
|
93
|
+
isLoading: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default meta;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Screen from '../../components/Screen';
|
|
3
|
+
import { Props } from './SubscriptionScreen.types';
|
|
4
|
+
import DisplayHeading from '../../components/DisplayHeading';
|
|
5
|
+
import SubscriptionManager from '../../components/SubscriptionManager';
|
|
6
|
+
import Copy from '../../components/Copy';
|
|
7
|
+
import Button from '../../components/Button';
|
|
8
|
+
import { BTN_VARIANTS } from '../../components/Button/Button.types';
|
|
9
|
+
import { useLanguage } from '../../hooks';
|
|
10
|
+
|
|
11
|
+
const SubscriptionScreen = ({
|
|
12
|
+
testID,
|
|
13
|
+
title,
|
|
14
|
+
image,
|
|
15
|
+
// user,
|
|
16
|
+
// handleSubscriptionSubmit,
|
|
17
|
+
subscriptionCallback,
|
|
18
|
+
subscriptionManagerProps,
|
|
19
|
+
}: Props) => {
|
|
20
|
+
const T = useLanguage();
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Screen data-testid={testID || 'SubscriptionScreen'} image={image}>
|
|
24
|
+
{title && <DisplayHeading text={title} />}
|
|
25
|
+
{subscriptionManagerProps && (
|
|
26
|
+
<div>
|
|
27
|
+
<SubscriptionManager {...subscriptionManagerProps} />
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
{subscriptionCallback && (
|
|
31
|
+
<div className="flex items-center justify-center">
|
|
32
|
+
<div className="flex flex-col gap-4 items-center">
|
|
33
|
+
<Copy>{T?.UI?.NEED_HELP_WITH_SUBSCRIPTION}</Copy>
|
|
34
|
+
<div>
|
|
35
|
+
<Button icon="mdi:help" variant={BTN_VARIANTS.SECONDARY} onClick={subscriptionCallback}>
|
|
36
|
+
{T?.UI?.CONTACT_SUPPORT}
|
|
37
|
+
</Button>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
</Screen>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
SubscriptionScreen.displayName = 'SubscriptionScreen';
|
|
47
|
+
|
|
48
|
+
export default SubscriptionScreen;
|
|
49
|
+
export type { Props };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Props as SubscriptionManagerProps } from '../../components/SubscriptionManager/SubscriptionManager.types';
|
|
2
|
+
|
|
3
|
+
export interface Props {
|
|
4
|
+
testID?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
user?: {
|
|
8
|
+
profile?: {
|
|
9
|
+
picture?: string;
|
|
10
|
+
firstName?: string;
|
|
11
|
+
lastName?: string;
|
|
12
|
+
dateOfBirth?: string;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
subscription?: {
|
|
16
|
+
status?: string;
|
|
17
|
+
plan?: string;
|
|
18
|
+
price?: string;
|
|
19
|
+
billingDate?: string;
|
|
20
|
+
cardType?: string;
|
|
21
|
+
cardNumber?: string;
|
|
22
|
+
cardExpiry?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
handleSubscriptionSubmit: (values: any) => void;
|
|
26
|
+
subscriptionCallback?: () => void;
|
|
27
|
+
subscriptionManagerProps: SubscriptionManagerProps;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SubscriptionScreen';
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs';
|
|
2
|
+
import { useReducer } from 'react';
|
|
3
|
+
import { ESVideo, formatVideos } from '@techstuff-dev/foundation-api-utils';
|
|
4
|
+
import WorkoutScreen from '.';
|
|
5
|
+
|
|
6
|
+
function secondsToISO8601(seconds?: number): string {
|
|
7
|
+
if (!seconds) return '';
|
|
8
|
+
// Calculate hours, minutes, and remaining seconds
|
|
9
|
+
const hours = Math.floor(seconds / 3600);
|
|
10
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
11
|
+
const remainingSeconds = seconds % 60;
|
|
12
|
+
|
|
13
|
+
// Build the ISO 8601 duration string
|
|
14
|
+
let duration = 'PT';
|
|
15
|
+
if (hours > 0) {
|
|
16
|
+
duration += `${hours}H`;
|
|
17
|
+
}
|
|
18
|
+
if (minutes > 0) {
|
|
19
|
+
duration += `${minutes}M`;
|
|
20
|
+
}
|
|
21
|
+
if (remainingSeconds > 0 || duration === 'PT') {
|
|
22
|
+
duration += `${remainingSeconds}S`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return duration;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const exampleWorkoutData = {
|
|
29
|
+
changed: 1716885585,
|
|
30
|
+
created: 1716885585,
|
|
31
|
+
description:
|
|
32
|
+
'Join me for this 45min barre floor class. A full body workout with no cardio element. A great dose of strength training on the mat, ending with a lovely stretch. No props needed for this class.',
|
|
33
|
+
duration: 'PT45M',
|
|
34
|
+
duration_filter: 2700,
|
|
35
|
+
image: 'https://d9r66csa6956h.cloudfront.net/2024-05/Screenshot%202024-05-28%20at%2010.37.16.png',
|
|
36
|
+
level: 'Beginner-Intermediate',
|
|
37
|
+
livestream_section: 'Barre Floor',
|
|
38
|
+
published: true,
|
|
39
|
+
targeted_section: 'Live Streams',
|
|
40
|
+
title: 'Barre Floor',
|
|
41
|
+
uid: 12,
|
|
42
|
+
uuid: '495c848b-519b-464b-939c-5f0bdee8efbc',
|
|
43
|
+
video:
|
|
44
|
+
'https://d227lq76md6ahr.cloudfront.net/ff7a5f88-5d37-40d4-8ca9-0789c32308b9/hls/livestream--barre-floor-21-08-2024.m3u8',
|
|
45
|
+
video_download:
|
|
46
|
+
'https://d227lq76md6ahr.cloudfront.net/e25e6d62-d9f5-4adb-863a-fcb4b95c9d3e/mp4/livestream--3-15-legs-abs-stretch--07-07-2024_Mp4_Avc_Aac_16x9_1920x1080p_24Hz_6Mbps_qvbr.mp4',
|
|
47
|
+
video_poster: 's3://2024-05/Screenshot 2024-05-28 at 10.37.16_0.png',
|
|
48
|
+
workout_category: 'Live Streams',
|
|
49
|
+
workout_type: 'Booty',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const ES_VIDEO_DATA = [
|
|
53
|
+
{
|
|
54
|
+
_index: 'elasticsearch_index_nrgprodcms_videos',
|
|
55
|
+
_id: 'entity:node/1049:en',
|
|
56
|
+
_score: 1.0,
|
|
57
|
+
sort: [0,1,2],
|
|
58
|
+
_source: {
|
|
59
|
+
_language: 'en',
|
|
60
|
+
image: [
|
|
61
|
+
'https://assets.nrgbarrebody.app/styles/full_16_9/s3/2023-10/Screenshot%202023-10-21%20at%2010.09.21.png?itok=Qd2g68zD',
|
|
62
|
+
],
|
|
63
|
+
video_poster: [
|
|
64
|
+
'https://assets.nrgbarrebody.app/styles/full_16_9/s3/2023-10/Screenshot%202023-10-21%20at%2010.09.21_0.png?itok=KRrkt6hx',
|
|
65
|
+
],
|
|
66
|
+
created: [1697875583],
|
|
67
|
+
description: [
|
|
68
|
+
'<p>Today we work every single muscle in our core. Last day of our challenge but I also want to say that it should be the first day of the rest of your core training hopefully. Try to integrate 1-2 core-focused workouts per week in your fitness routine, if you can. </p>',
|
|
69
|
+
],
|
|
70
|
+
duration: [1800],
|
|
71
|
+
section: ['7 days for a leaner waistline'],
|
|
72
|
+
section_id: [85],
|
|
73
|
+
title: ['Day 7 - The Leaner Waistline Challenge'],
|
|
74
|
+
updated: [1697887298],
|
|
75
|
+
uuid: ['63c30ba9-edff-4142-b341-4a0e08e662d7'],
|
|
76
|
+
video_url: [
|
|
77
|
+
'https://d227lq76md6ahr.cloudfront.net/ff7a5f88-5d37-40d4-8ca9-0789c32308b9/hls/livestream--barre-floor-21-08-2024.m3u8',
|
|
78
|
+
],
|
|
79
|
+
video_download: [''],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
const meta: Meta<typeof WorkoutScreen> = {
|
|
85
|
+
title: 'TEMPLATES/WorkoutScreen',
|
|
86
|
+
component: WorkoutScreen,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
type Story = StoryObj<typeof WorkoutScreen>;
|
|
90
|
+
|
|
91
|
+
export const Default: Story = {
|
|
92
|
+
parameters: {
|
|
93
|
+
layout: 'fullscreen',
|
|
94
|
+
},
|
|
95
|
+
args: {
|
|
96
|
+
id: exampleWorkoutData.uuid,
|
|
97
|
+
title: exampleWorkoutData.title,
|
|
98
|
+
description: exampleWorkoutData.description,
|
|
99
|
+
image: exampleWorkoutData.image,
|
|
100
|
+
video: exampleWorkoutData.video,
|
|
101
|
+
videoDownload: exampleWorkoutData.video_download,
|
|
102
|
+
videoPoster: exampleWorkoutData.video_poster,
|
|
103
|
+
created: exampleWorkoutData.created,
|
|
104
|
+
duration: exampleWorkoutData.duration,
|
|
105
|
+
level: exampleWorkoutData.level,
|
|
106
|
+
section: exampleWorkoutData.livestream_section,
|
|
107
|
+
uuid: exampleWorkoutData.uuid,
|
|
108
|
+
category: exampleWorkoutData.workout_category,
|
|
109
|
+
type: exampleWorkoutData.workout_type,
|
|
110
|
+
hasActiveSubscription: true,
|
|
111
|
+
noSubActionCallback: () => console.log('No subscription action callback'),
|
|
112
|
+
},
|
|
113
|
+
render: args => {
|
|
114
|
+
const [isLiked, setIsLiked] = useReducer(state => !state, false);
|
|
115
|
+
const [isCompleted, setIsCompleted] = useReducer(state => !state, false);
|
|
116
|
+
const [isFavourited, setIsFavourited] = useReducer(state => !state, false);
|
|
117
|
+
return (
|
|
118
|
+
<WorkoutScreen
|
|
119
|
+
{...args}
|
|
120
|
+
likeCallback={setIsLiked}
|
|
121
|
+
completedCallback={setIsCompleted}
|
|
122
|
+
favouriteCallback={setIsFavourited}
|
|
123
|
+
isLiked={isLiked}
|
|
124
|
+
isCompleted={isCompleted}
|
|
125
|
+
isFavourite={isFavourited}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const formattedESVideoData = formatVideos(ES_VIDEO_DATA as ESVideo[])?.[0];
|
|
132
|
+
|
|
133
|
+
export const Video: Story = {
|
|
134
|
+
parameters: {
|
|
135
|
+
layout: 'fullscreen',
|
|
136
|
+
},
|
|
137
|
+
args: {
|
|
138
|
+
isVideo: true,
|
|
139
|
+
sharePath: 'video',
|
|
140
|
+
id: formattedESVideoData.uuid,
|
|
141
|
+
title: formattedESVideoData.title,
|
|
142
|
+
description: formattedESVideoData.description,
|
|
143
|
+
image: formattedESVideoData.image,
|
|
144
|
+
video: formattedESVideoData.video,
|
|
145
|
+
videoDownload: formattedESVideoData.videoDownload,
|
|
146
|
+
// videoPoster: exampleWorkoutData.video_poster,
|
|
147
|
+
created: formattedESVideoData.created,
|
|
148
|
+
duration: secondsToISO8601(formattedESVideoData.duration),
|
|
149
|
+
// level: exampleWorkoutData.level,
|
|
150
|
+
// section: exampleWorkoutData.livestream_section,
|
|
151
|
+
// uuid: exampleWorkoutData.uuid,
|
|
152
|
+
// category: exampleWorkoutData.workout_category,
|
|
153
|
+
// type: exampleWorkoutData.workout_type,
|
|
154
|
+
hasActiveSubscription: true,
|
|
155
|
+
htmlDetails: true,
|
|
156
|
+
noSubActionCallback: () => console.log('No subscription action callback'),
|
|
157
|
+
},
|
|
158
|
+
render: args => {
|
|
159
|
+
const [isLiked, setIsLiked] = useReducer(state => !state, false);
|
|
160
|
+
const [isCompleted, setIsCompleted] = useReducer(state => !state, false);
|
|
161
|
+
return (
|
|
162
|
+
<WorkoutScreen
|
|
163
|
+
{...args}
|
|
164
|
+
likeCallback={setIsLiked}
|
|
165
|
+
completedCallback={setIsCompleted}
|
|
166
|
+
isLiked={isLiked}
|
|
167
|
+
isCompleted={isCompleted}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export default meta;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { toast } from 'react-toastify';
|
|
3
|
+
import Screen from '../../components/Screen';
|
|
4
|
+
import { format } from 'date-fns';
|
|
5
|
+
import { Props } from './WorkoutScreen.types';
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Container,
|
|
9
|
+
Copy,
|
|
10
|
+
DisplayHeading,
|
|
11
|
+
Heading,
|
|
12
|
+
HEADING_TAGS,
|
|
13
|
+
HtmlContent,
|
|
14
|
+
Label,
|
|
15
|
+
} from '../../components';
|
|
16
|
+
import { useLanguage } from '../../hooks';
|
|
17
|
+
import { formatDuration } from '../../utils';
|
|
18
|
+
import { DATE_FORMAT } from '../../constants';
|
|
19
|
+
// import { VideoPlayerMethods } from '../../components/Video/Video';
|
|
20
|
+
import FullScreenVideoModal from '../../components/FullScreenVideoModal';
|
|
21
|
+
|
|
22
|
+
const WorkoutScreen = ({
|
|
23
|
+
testID,
|
|
24
|
+
id,
|
|
25
|
+
title,
|
|
26
|
+
image,
|
|
27
|
+
description,
|
|
28
|
+
created = 0,
|
|
29
|
+
duration = 'PT0M',
|
|
30
|
+
level,
|
|
31
|
+
section,
|
|
32
|
+
// uuid,
|
|
33
|
+
video,
|
|
34
|
+
videoType = 'application/x-mpegURL', // 'video/mp4',
|
|
35
|
+
category,
|
|
36
|
+
type,
|
|
37
|
+
likeCallback,
|
|
38
|
+
completedCallback,
|
|
39
|
+
favouriteCallback,
|
|
40
|
+
isLiked,
|
|
41
|
+
// isCompleted,
|
|
42
|
+
isFavourite,
|
|
43
|
+
relatedWorkouts,
|
|
44
|
+
// isLoading,
|
|
45
|
+
hasActiveSubscription,
|
|
46
|
+
htmlDetails,
|
|
47
|
+
noSubActionCallback,
|
|
48
|
+
numCompleted = '0',
|
|
49
|
+
}: Props) => {
|
|
50
|
+
const T = useLanguage();
|
|
51
|
+
// const [videoAudioTrack, setVideoAudioTrack] = React.useState<number>(2);
|
|
52
|
+
// const videoRef = React.useRef<VideoPlayerMethods>(null);
|
|
53
|
+
const [launchVideoModal, setLaunchVideo] = React.useState<boolean>(false);
|
|
54
|
+
|
|
55
|
+
const formattedCreated = useMemo(() => format(new Date(created * 1000), DATE_FORMAT), [created]);
|
|
56
|
+
const formattedDuration = useMemo(() => formatDuration(duration), [duration]);
|
|
57
|
+
|
|
58
|
+
const startVideo = () => {
|
|
59
|
+
// setLaunchVideo(true);
|
|
60
|
+
// videoRef.current.play();
|
|
61
|
+
// videoRef.current.fullscreen();
|
|
62
|
+
setLaunchVideo(true);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleLikeClicked = () => {
|
|
66
|
+
if (id && likeCallback && typeof likeCallback === 'function') {
|
|
67
|
+
likeCallback(id);
|
|
68
|
+
toast.info(isLiked ? T.UI.REMOVED_LIKE : T.UI.ADDED_LIKE);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleFavouriteClicked = () => {
|
|
73
|
+
if (id && favouriteCallback && typeof favouriteCallback === 'function') {
|
|
74
|
+
favouriteCallback(id);
|
|
75
|
+
toast.info(isFavourite ? T.UI.REMOVED_FAVORITE : T.UI.ADDED_FAVORITE);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const handleCompletedClicked = () => {
|
|
80
|
+
if (id && completedCallback && typeof completedCallback === 'function') {
|
|
81
|
+
completedCallback(id);
|
|
82
|
+
// toast.info(isCompleted ? T.UI.MARKED_INCOMPLETE : T.UI.MARKED_COMPLETE);
|
|
83
|
+
toast.info(T.UI.MARKED_COMPLETE);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Toggle track between 0 and 2
|
|
88
|
+
// const handleSelectAudioTrack = () => {
|
|
89
|
+
// setVideoAudioTrack(videoAudioTrack === 0 ? 2 : 0);
|
|
90
|
+
// toast.info(videoAudioTrack === 0 ? T.UI.MUSIC_DISABLED : T.UI.MUSIC_ENABLED);
|
|
91
|
+
// };
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<Screen data-testid={testID || 'WorkoutScreen'} image={image}>
|
|
95
|
+
<div>
|
|
96
|
+
{title && <DisplayHeading text={title} />}
|
|
97
|
+
<div>
|
|
98
|
+
<Label>
|
|
99
|
+
{T.UI.CREATED}: {formattedCreated}
|
|
100
|
+
</Label>
|
|
101
|
+
</div>
|
|
102
|
+
<div>
|
|
103
|
+
<Label>
|
|
104
|
+
{T.UI.DURATION}: {formattedDuration}
|
|
105
|
+
</Label>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
{!hasActiveSubscription && (
|
|
109
|
+
<div>
|
|
110
|
+
<Heading tag={HEADING_TAGS.H4}>{T.UI.NO_ACTIVE_SUBSCRIPTION}</Heading>
|
|
111
|
+
<Copy>{T?.UI?.NO_SUBSCRIPTION_DETAILS}</Copy>
|
|
112
|
+
{noSubActionCallback && (
|
|
113
|
+
<Button rounded onClick={noSubActionCallback} icon="mdi:arrow-right-circle-outline">
|
|
114
|
+
{T.UI.SUBSCRIBE}
|
|
115
|
+
</Button>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
119
|
+
<div>
|
|
120
|
+
<Button onClick={startVideo} icon="mdi:play" iconFirst disabled={!hasActiveSubscription}>
|
|
121
|
+
{T.UI.START_WORKOUT}
|
|
122
|
+
</Button>
|
|
123
|
+
</div>
|
|
124
|
+
<div className="flex gap-2">
|
|
125
|
+
{/* <div>
|
|
126
|
+
<Button icon="playlist-plus" onClick={() => console.log('trigger playlist')} />
|
|
127
|
+
</div> */}
|
|
128
|
+
{likeCallback && (
|
|
129
|
+
<div>
|
|
130
|
+
<Button
|
|
131
|
+
onClick={handleLikeClicked}
|
|
132
|
+
icon={isLiked ? 'mdi:heart' : 'mdi:heart-outline'}
|
|
133
|
+
disabled={!hasActiveSubscription}
|
|
134
|
+
rounded
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
)}
|
|
138
|
+
{favouriteCallback && (
|
|
139
|
+
<div>
|
|
140
|
+
<Button
|
|
141
|
+
onClick={handleFavouriteClicked}
|
|
142
|
+
icon={isFavourite ? 'mdi:bookmark' : 'mdi:bookmark-outline'}
|
|
143
|
+
disabled={!hasActiveSubscription}
|
|
144
|
+
rounded
|
|
145
|
+
/>
|
|
146
|
+
</div>
|
|
147
|
+
)}
|
|
148
|
+
{completedCallback && (
|
|
149
|
+
<div>
|
|
150
|
+
<Button rounded onClick={handleCompletedClicked} icon="mdi:plus" disabled={!hasActiveSubscription}>
|
|
151
|
+
{numCompleted}
|
|
152
|
+
</Button>
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
{/* <div>
|
|
156
|
+
<Button
|
|
157
|
+
onClick={handleSelectAudioTrack}
|
|
158
|
+
icon={videoAudioTrack === 2 ? 'mdi:music-note-off' : 'mdi:music-note'}
|
|
159
|
+
disabled={!hasActiveSubscription}
|
|
160
|
+
rounded
|
|
161
|
+
/>
|
|
162
|
+
</div> */}
|
|
163
|
+
</div>
|
|
164
|
+
{!htmlDetails && description && (
|
|
165
|
+
<div>
|
|
166
|
+
<Copy>{description}</Copy>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
{htmlDetails && description && (
|
|
170
|
+
<div>
|
|
171
|
+
<HtmlContent data={description} />
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
<div className="flex gap-4 flex-wrap">
|
|
176
|
+
{level && (
|
|
177
|
+
<Label>
|
|
178
|
+
{T.UI.LEVEL}: {level}
|
|
179
|
+
</Label>
|
|
180
|
+
)}
|
|
181
|
+
{section && (
|
|
182
|
+
<Label>
|
|
183
|
+
{T.UI.SECTION}: {section}
|
|
184
|
+
</Label>
|
|
185
|
+
)}
|
|
186
|
+
{category && (
|
|
187
|
+
<Label>
|
|
188
|
+
{T.UI.CATEGORY}: {category}
|
|
189
|
+
</Label>
|
|
190
|
+
)}
|
|
191
|
+
{type && (
|
|
192
|
+
<Label>
|
|
193
|
+
{T.UI.TYPE}: {type}
|
|
194
|
+
</Label>
|
|
195
|
+
)}
|
|
196
|
+
</div>
|
|
197
|
+
{relatedWorkouts && (
|
|
198
|
+
<>
|
|
199
|
+
<Container isNarrow padded>
|
|
200
|
+
<div>
|
|
201
|
+
<Heading>{T?.UI?.RELATED}</Heading>
|
|
202
|
+
</div>
|
|
203
|
+
</Container>
|
|
204
|
+
</>
|
|
205
|
+
)}
|
|
206
|
+
<div>
|
|
207
|
+
{launchVideoModal && (
|
|
208
|
+
<FullScreenVideoModal
|
|
209
|
+
modalOpen={launchVideoModal}
|
|
210
|
+
onCloseCallback={() => setLaunchVideo(false)}
|
|
211
|
+
videoProps={{
|
|
212
|
+
sources: [
|
|
213
|
+
{
|
|
214
|
+
src: video,
|
|
215
|
+
type: videoType,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
isModal: true,
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
)}
|
|
222
|
+
</div>
|
|
223
|
+
</Screen>
|
|
224
|
+
);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
WorkoutScreen.displayName = 'WorkoutScreen';
|
|
228
|
+
|
|
229
|
+
export default WorkoutScreen;
|
|
230
|
+
export type { Props };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface Props {
|
|
2
|
+
testID?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
uuid?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
created?: number;
|
|
9
|
+
duration?: string;
|
|
10
|
+
level?: string;
|
|
11
|
+
section?: string;
|
|
12
|
+
video: string;
|
|
13
|
+
videoType?: string;
|
|
14
|
+
videoPoster?: string;
|
|
15
|
+
videoDownload?: string;
|
|
16
|
+
category?: string;
|
|
17
|
+
type?: string;
|
|
18
|
+
// React Native Only
|
|
19
|
+
isVideo?: boolean;
|
|
20
|
+
sharePath?: string;
|
|
21
|
+
shareMessage?: string;
|
|
22
|
+
likeCallback?: (id: string) => void;
|
|
23
|
+
isLiked?: boolean;
|
|
24
|
+
completedCallback?: (id: string) => void;
|
|
25
|
+
isCompleted?: boolean;
|
|
26
|
+
favouriteCallback?: (id: string) => void;
|
|
27
|
+
isFavourite?: boolean;
|
|
28
|
+
relatedWorkouts?: any[]; // TODO: is this an array of IDs or Data?
|
|
29
|
+
isLoading?: boolean;
|
|
30
|
+
hasActiveSubscription?: boolean;
|
|
31
|
+
htmlDetails?: boolean;
|
|
32
|
+
noSubActionCallback?: () => void;
|
|
33
|
+
numCompleted?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './WorkoutScreen';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export { default as AccountScreen } from './AccountScreen';
|
|
2
|
+
export { default as AuthScreen } from './AuthScreen';
|
|
3
|
+
export { default as CardGridScreen } from './CardGridScreen';
|
|
4
|
+
export { default as CatalogueScreen } from './CatalogueScreen';
|
|
5
|
+
export { default as ChallengeLibraryScreen } from './ChallengeLibraryScreen';
|
|
6
|
+
export { default as ChallengeScreen } from './ChallengeScreen';
|
|
7
|
+
export { default as ContentScreen } from './ContentScreen';
|
|
8
|
+
export { default as DashboardScreen } from './DashboardScreen';
|
|
9
|
+
export { default as FAQScreen } from './FAQScreen';
|
|
10
|
+
export { default as HomeScreen } from './HomeScreen';
|
|
11
|
+
export { default as LogoutScreen } from './LogoutScreen';
|
|
12
|
+
export { default as MenuScreen } from './MenuScreen';
|
|
13
|
+
export { default as NotFoundScreen } from './NotFoundScreen';
|
|
14
|
+
export { default as PasswordResetScreen } from './PasswordResetScreen';
|
|
15
|
+
export { default as PasswordResetAuthScreen } from './PasswordResetAuthScreen';
|
|
16
|
+
export { default as ProfileScreen } from './ProfileScreen';
|
|
17
|
+
export { default as ScheduleScreen } from './ScheduleScreen';
|
|
18
|
+
export { default as SubscriptionScreen } from './SubscriptionScreen';
|
|
19
|
+
export { default as WorkoutScreen } from './WorkoutScreen';
|
|
20
|
+
|
|
21
|
+
// Props
|
|
22
|
+
export type { Props as AccountScreenProps } from './AccountScreen/AccountScreen.types';
|
|
23
|
+
export type { Props as AuthScreenProps } from './AuthScreen/AuthScreen.types';
|
|
24
|
+
export type { Props as CardGridScreenProps } from './CardGridScreen/CardGridScreen.types';
|
|
25
|
+
export type { Props as CatalogueScreenProps } from './CatalogueScreen/CatalogueScreen.types';
|
|
26
|
+
export type { Props as ChallengeLibraryScreenProps } from './ChallengeLibraryScreen/ChallengeLibraryScreen.types';
|
|
27
|
+
export type { Props as ChallengeScreenProps } from './ChallengeScreen/ChallengeScreen.types';
|
|
28
|
+
export type { Props as ContentScreenProps } from './ContentScreen/ContentScreen.types';
|
|
29
|
+
export type { Props as DashboardScreenProps } from './DashboardScreen/DashboardScreen.types';
|
|
30
|
+
export type { Props as FAQScreenProps } from './FAQScreen/FAQScreen.types';
|
|
31
|
+
export type { Props as HomeScreenProps } from './HomeScreen/HomeScreen.types';
|
|
32
|
+
export type { Props as LogoutScreenProps } from './LogoutScreen/LogoutScreen.types';
|
|
33
|
+
export type { Props as MenuScreenProps } from './MenuScreen/MenuScreen.types';
|
|
34
|
+
export type { Props as NotFoundScreenProps } from './NotFoundScreen/NotFoundScreen.types';
|
|
35
|
+
export type { Props as PasswordResetScreenProps } from './PasswordResetScreen/PasswordResetScreen.types';
|
|
36
|
+
export type { Props as PasswordResetAuthScreenProps } from './PasswordResetAuthScreen/PasswordResetAuthScreen.types';
|
|
37
|
+
export type { Props as ProfileScreenProps } from './ProfileScreen/ProfileScreen.types';
|
|
38
|
+
export type { Props as ScheduleScreenProps } from './ScheduleScreen/ScheduleScreen.types';
|
|
39
|
+
export type { Props as SubscriptionScreenProps } from './SubscriptionScreen/SubscriptionScreen.types';
|
|
40
|
+
export type { Props as WorkoutScreenProps } from './WorkoutScreen/WorkoutScreen.types';
|