diff --git a/package-lock.json b/package-lock.json index 94b01cf53..3bdd7d4ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "@faker-js/faker": "7.6.0", - "@iqss/dataverse-client-javascript": "2.0.0-pr192.6406015", + "@iqss/dataverse-client-javascript": "2.0.0-alpha.1", "@iqss/dataverse-design-system": "*", "@istanbuljs/nyc-config-typescript": "1.0.2", "@tanstack/react-table": "8.9.2", @@ -3674,9 +3674,9 @@ }, "node_modules/@iqss/dataverse-client-javascript": { "name": "@IQSS/dataverse-client-javascript", - "version": "2.0.0-pr192.6406015", - "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-pr192.6406015/4d6562b1e287c872e92ef3a551ee8aa63c5262b5", - "integrity": "sha512-1DmypaaV1cXS4y+kbx33GLmRLwI/8Cwj82MLhpq9gdy7+racUOyzVs3MFKJmdLLWTy7pAWKtj6a+c8Pt6DmtzQ==", + "version": "2.0.0-alpha.1", + "resolved": "https://npm.pkg.github.com/download/@IQSS/dataverse-client-javascript/2.0.0-alpha.1/5c1b7dc4ae62ec38d5a93c79ec2452b5de0bb729", + "integrity": "sha512-ItrxNcTlcxBy/4baX05dujMdBrMYAhePOAbNRJv+aspPmv5KSua3FkiM1vm+7mAZbR7x+6nRjmejZxcGwhN0aA==", "license": "MIT", "dependencies": { "@types/node": "^18.15.11", diff --git a/package.json b/package.json index 0a0b77593..55aba4600 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@faker-js/faker": "7.6.0", - "@iqss/dataverse-client-javascript": "2.0.0-pr192.6406015", + "@iqss/dataverse-client-javascript": "2.0.0-alpha.1", "@iqss/dataverse-design-system": "*", "@istanbuljs/nyc-config-typescript": "1.0.2", "@tanstack/react-table": "8.9.2", diff --git a/public/locales/en/citationBlock.json b/public/locales/en/citationBlock.json deleted file mode 100644 index bb11901e9..000000000 --- a/public/locales/en/citationBlock.json +++ /dev/null @@ -1 +0,0 @@ -{ "learnAbout": "Learn About", "standards": "Data Citation Standards" } diff --git a/public/locales/en/datasetMetadataForm.json b/public/locales/en/datasetMetadataForm.json deleted file mode 100644 index e547a0894..000000000 --- a/public/locales/en/datasetMetadataForm.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "metadataTip": { - "title": "Metadata Tip", - "content": "After adding the dataset, click the Edit Dataset button to add more metadata." - }, - "validationAlert": { - "title": "Validation Error", - "content": "Required fields were missed or there was a validation error. Please scroll down to see details." - }, - "requiredFields": "Asterisks indicate required fields", - "mayBecomeRequired": "One or more of these fields may become required if you add to one or more of these optional fields.", - "field": { - "required": "{{displayName}} is required", - "invalid": { - "url": "{{displayName}} is not a valid URL", - "email": "{{displayName}} is not a valid email", - "int": "{{displayName}} is not a valid integer", - "float": "{{displayName}} is not a valid float", - "date": "{{displayName}} is not a valid date. Please use the format {{dateFormat}}" - } - }, - "status": { - "submitting": "Submitting...", - "success": "Form submitted successfully!", - "failed": "Error: Submission failed." - }, - "states": { - "submitting": "Form Submitting", - "submissionSuccess": "Form submission successful" - }, - "saveButton": { - "createMode": "Save Dataset", - "editMode": "Save Changes" - }, - "cancelButton": "Cancel" -} diff --git a/public/locales/en/pageNotFound.json b/public/locales/en/pageNotFound.json deleted file mode 100644 index 19d0dcf7e..000000000 --- a/public/locales/en/pageNotFound.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "heading": "Page Not Found", - "message": "The page you are looking for was not found." -} diff --git a/public/locales/en/pageNumberNotFound.json b/public/locales/en/pageNumberNotFound.json deleted file mode 100644 index b902087b1..000000000 --- a/public/locales/en/pageNumberNotFound.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "heading": "Page Number Not Found", - "message": "The page number you requested does not exist. Please try a different page number." -} diff --git a/public/locales/en/pagination.json b/public/locales/en/pagination.json deleted file mode 100644 index ed421515e..000000000 --- a/public/locales/en/pagination.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "results_one": "1 {{item}}", - "results_other": "{{start}} to {{end}} of {{formattedCount}} {{item}}s", - "accumulated": { - "one": "{{formattedCount}} {{item}}", - "lessThanPageSize": "{{formattedCount}} {{item}}s", - "moreThanPageSize": "{{accumulated}} of {{formattedCount}} {{item}}s displayed" - }, - "pageSize": "{{item}}s per page" -} diff --git a/public/locales/en/shared.json b/public/locales/en/shared.json index 55aedf5cd..47fc276cf 100644 --- a/public/locales/en/shared.json +++ b/public/locales/en/shared.json @@ -1,5 +1,63 @@ { "asterisksIndicateRequiredFields": "Asterisks indicate required fields", "remove": "Remove", - "add": "Add" + "add": "Add", + "pageNumberNotFound": { + "heading": "Page Number Not Found", + "message": "The page number you requested does not exist. Please try a different page number." + }, + "pageNotFound": { + "heading": "Page Not Found", + "message": "The page you are looking for was not found." + }, + "pagination": { + "results_one": "1 {{item}}", + "results_other": "{{start}} to {{end}} of {{formattedCount}} {{item}}s", + "accumulated": { + "one": "{{formattedCount}} {{item}}", + "lessThanPageSize": "{{formattedCount}} {{item}}s", + "moreThanPageSize": "{{accumulated}} of {{formattedCount}} {{item}}s displayed" + }, + "pageSize": "{{item}}s per page" + }, + "citationBlock": { + "learnAbout": "Learn About", + "standards": "Data Citation Standards" + }, + "datasetMetadataForm": { + "metadataTip": { + "title": "Metadata Tip", + "content": "After adding the dataset, click the Edit Dataset button to add more metadata." + }, + "validationAlert": { + "title": "Validation Error", + "content": "Required fields were missed or there was a validation error. Please scroll down to see details." + }, + "requiredFields": "Asterisks indicate required fields", + "mayBecomeRequired": "One or more of these fields may become required if you add to one or more of these optional fields.", + "field": { + "required": "{{displayName}} is required", + "invalid": { + "url": "{{displayName}} is not a valid URL", + "email": "{{displayName}} is not a valid email", + "int": "{{displayName}} is not a valid integer", + "float": "{{displayName}} is not a valid float", + "date": "{{displayName}} is not a valid date. Please use the format {{dateFormat}}" + } + }, + "status": { + "submitting": "Submitting...", + "success": "Form submitted successfully!", + "failed": "Error: Submission failed." + }, + "states": { + "submitting": "Form Submitting", + "submissionSuccess": "Form submission successful" + }, + "saveButton": { + "createMode": "Save Dataset", + "editMode": "Save Changes" + }, + "cancelButton": "Cancel" + } } diff --git a/src/i18n.ts b/src/i18n.ts index 7f62965e6..7a8cdb345 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -16,7 +16,20 @@ void i18next .init({ fallbackLng: 'en', supportedLngs: ['en'], - ns: [], + ns: [ + 'shared', + 'header', + 'footer', + 'file', + 'astrophysics', + 'biomedical', + 'citation', + 'codeMeta20', + 'computationalworkflow', + 'geospatial', + 'journal', + 'socialscience' + ], returnNull: false, backend: { loadPath: diff --git a/src/index.tsx b/src/index.tsx index ba839fec8..a50dc685e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -4,11 +4,12 @@ import App from './App' import './i18n' import { LoadingProvider } from './sections/loading/LoadingProvider' import { ThemeProvider } from '@iqss/dataverse-design-system' +import { AppLoader } from './sections/shared/layout/app-loader/AppLoader' const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement) root.render( - + }> diff --git a/src/router/routes.tsx b/src/router/routes.tsx index b71090f75..2bcf0df06 100644 --- a/src/router/routes.tsx +++ b/src/router/routes.tsx @@ -1,17 +1,70 @@ +import { lazy, Suspense } from 'react' import { RouteObject } from 'react-router-dom' import { Route } from '../sections/Route.enum' import { Layout } from '../sections/layout/Layout' import { PageNotFound } from '../sections/page-not-found/PageNotFound' -import { DatasetFactory } from '../sections/dataset/DatasetFactory' -import { CreateDatasetFactory } from '../sections/create-dataset/CreateDatasetFactory' -import { FileFactory } from '../sections/file/FileFactory' -import { CollectionFactory } from '../sections/collection/CollectionFactory' -import { UploadDatasetFilesFactory } from '../sections/upload-dataset-files/UploadDatasetFilesFactory' -import { EditDatasetMetadataFactory } from '../sections/edit-dataset-metadata/EditDatasetMetadataFactory' -import { CreateCollectionFactory } from '../sections/create-collection/CreateCollectionFactory' -import { AccountFactory } from '../sections/account/AccountFactory' import { ProtectedRoute } from './ProtectedRoute' -import { HomepageFactory } from '../sections/homepage/HomepageFactory' +import { AppLoader } from '../sections/shared/layout/app-loader/AppLoader' + +const Homepage = lazy(() => + import('../sections/homepage/HomepageFactory').then(({ HomepageFactory }) => ({ + default: () => HomepageFactory.create() + })) +) + +const CollectionPage = lazy(() => + import('../sections/collection/CollectionFactory').then(({ CollectionFactory }) => ({ + default: () => CollectionFactory.create() + })) +) + +const DatasetPage = lazy(() => + import('../sections/dataset/DatasetFactory').then(({ DatasetFactory }) => ({ + default: () => DatasetFactory.create() + })) +) + +const FilePage = lazy(() => + import('../sections/file/FileFactory').then(({ FileFactory }) => ({ + default: () => FileFactory.create() + })) +) + +const CreateCollectionPage = lazy(() => + import('../sections/create-collection/CreateCollectionFactory').then( + ({ CreateCollectionFactory }) => ({ + default: () => CreateCollectionFactory.create() + }) + ) +) + +const CreateDatasetPage = lazy(() => + import('../sections/create-dataset/CreateDatasetFactory').then(({ CreateDatasetFactory }) => ({ + default: () => CreateDatasetFactory.create() + })) +) + +const UploadDatasetFilesPage = lazy(() => + import('../sections/upload-dataset-files/UploadDatasetFilesFactory').then( + ({ UploadDatasetFilesFactory }) => ({ + default: () => UploadDatasetFilesFactory.create() + }) + ) +) + +const EditDatasetMetadataPage = lazy(() => + import('../sections/edit-dataset-metadata/EditDatasetMetadataFactory').then( + ({ EditDatasetMetadataFactory }) => ({ + default: () => EditDatasetMetadataFactory.create() + }) + ) +) + +const AccountPage = lazy(() => + import('../sections/account/AccountFactory').then(({ AccountFactory }) => ({ + default: () => AccountFactory.create() + })) +) export const routes: RouteObject[] = [ { @@ -21,23 +74,43 @@ export const routes: RouteObject[] = [ children: [ { path: Route.HOME, - element: HomepageFactory.create() + element: ( + }> + + + ) }, { path: Route.COLLECTIONS_BASE, - element: CollectionFactory.create() + element: ( + }> + + + ) }, { path: Route.COLLECTIONS, - element: CollectionFactory.create() + element: ( + }> + + + ) }, { path: Route.DATASETS, - element: DatasetFactory.create() + element: ( + }> + + + ) }, { path: Route.FILES, - element: FileFactory.create() + element: ( + }> + + + ) }, // 🔐 Protected routes are only accessible to authenticated users { @@ -45,23 +118,43 @@ export const routes: RouteObject[] = [ children: [ { path: Route.CREATE_COLLECTION, - element: CreateCollectionFactory.create() + element: ( + }> + + + ) }, { path: Route.CREATE_DATASET, - element: CreateDatasetFactory.create() + element: ( + }> + + + ) }, { path: Route.UPLOAD_DATASET_FILES, - element: UploadDatasetFilesFactory.create() + element: ( + }> + + + ) }, { path: Route.EDIT_DATASET_METADATA, - element: EditDatasetMetadataFactory.create() + element: ( + }> + + + ) }, { path: Route.ACCOUNT, - element: AccountFactory.create() + element: ( + }> + + + ) } ] } diff --git a/src/sections/account/Account.tsx b/src/sections/account/Account.tsx index eaa4090b2..06d5a9fbb 100644 --- a/src/sections/account/Account.tsx +++ b/src/sections/account/Account.tsx @@ -5,8 +5,12 @@ import { useLoading } from '../loading/LoadingContext' import { AccountHelper, AccountPanelTabKey } from './AccountHelper' import { ApiTokenSection } from './api-token-section/ApiTokenSection' import { BreadcrumbsGenerator } from '../shared/hierarchy/BreadcrumbsGenerator' -import { UpwardHierarchyNodeMother } from '../../../tests/component/shared/hierarchy/domain/models/UpwardHierarchyNodeMother' import styles from './Account.module.scss' +import { + DvObjectType, + UpwardHierarchyNode +} from '../../shared/hierarchy/domain/models/UpwardHierarchyNode' +import { ROOT_COLLECTION_ALIAS } from '../../collection/domain/models/Collection' const tabsKeys = AccountHelper.ACCOUNT_PANEL_TABS_KEYS @@ -18,10 +22,11 @@ export const Account = ({ defaultActiveTabKey }: AccountProps) => { const { t } = useTranslation('account') const { setIsLoading } = useLoading() - const rootHierarchy = UpwardHierarchyNodeMother.createCollection({ - name: 'Root', - id: 'root' - }) + const rootHierarchy = new UpwardHierarchyNode( + 'Root', + DvObjectType.COLLECTION, + ROOT_COLLECTION_ALIAS + ) useEffect(() => { setIsLoading(false) diff --git a/src/sections/page-not-found/PageNotFound.tsx b/src/sections/page-not-found/PageNotFound.tsx index 046676254..4beae2eb4 100644 --- a/src/sections/page-not-found/PageNotFound.tsx +++ b/src/sections/page-not-found/PageNotFound.tsx @@ -2,7 +2,7 @@ import { Alert } from '@iqss/dataverse-design-system' import { useTranslation } from 'react-i18next' export function PageNotFound() { - const { t } = useTranslation('pageNotFound') + const { t } = useTranslation('shared', { keyPrefix: 'pageNotFound' }) return ( diff --git a/src/sections/shared/citation/CitationLearnAbout.tsx b/src/sections/shared/citation/CitationLearnAbout.tsx index 68dced2c8..bde2af235 100644 --- a/src/sections/shared/citation/CitationLearnAbout.tsx +++ b/src/sections/shared/citation/CitationLearnAbout.tsx @@ -2,7 +2,8 @@ import { useTranslation } from 'react-i18next' import styles from './Citation.module.scss' export function CitationLearnAbout() { - const { t } = useTranslation('citationBlock') + const { t } = useTranslation('shared', { keyPrefix: 'citationBlock' }) + return (
{t('learnAbout')}{' '} diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposeFieldMultiple.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposeFieldMultiple.tsx index a7883bb5a..0b53f958f 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposeFieldMultiple.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposeFieldMultiple.tsx @@ -26,7 +26,7 @@ export const ComposedFieldMultiple = ({ notRequiredWithChildFieldsRequired }: ComposedFieldMultipleProps) => { const { control } = useFormContext() - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const { fields: fieldsArray, diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposedField.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposedField.tsx index bdb919ea5..48e546c3a 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposedField.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/ComposedField.tsx @@ -22,7 +22,7 @@ export const ComposedField = ({ rulesToApply, notRequiredWithChildFieldsRequired }: ComposedFieldProps) => { - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const childFieldNamesThatMayBecomeRequired: string[] = useMemo( () => diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Primitive.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Primitive.tsx index 095a56224..b5d1661b6 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Primitive.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Primitive.tsx @@ -31,7 +31,7 @@ export const Primitive = ({ isFieldThatMayBecomeRequired, childFieldNamesThatTriggerRequired }: PrimitiveProps) => { - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const { control } = useFormContext() const builtFieldName = useMemo( diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Vocabulary.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Vocabulary.tsx index afa78204d..bfed76b96 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Vocabulary.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/Fields/Vocabulary.tsx @@ -30,7 +30,7 @@ export const Vocabulary = ({ isFieldThatMayBecomeRequired, childFieldNamesThatTriggerRequired }: VocabularyProps) => { - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const { control } = useFormContext() diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/useDefineRules.ts b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/useDefineRules.ts index c6050b431..9358c9907 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/useDefineRules.ts +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/MetadataBlockFormFields/MetadataFormField/useDefineRules.ts @@ -24,7 +24,7 @@ export const useDefineRules = ({ metadataFieldInfo, isParentFieldRequired }: Props): DefinedRules => { - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const { type, displayName, isRequired, watermark } = metadataFieldInfo // A sub field is required if the parent field is required and the sub field is required diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx index 460538ec8..049d7a276 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx @@ -35,7 +35,7 @@ export const MetadataForm = ({ }: FormProps) => { const { user } = useSession() const navigate = useNavigate() - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const accordionRef = useRef(null) const formContainerRef = useRef(null) diff --git a/src/sections/shared/form/DatasetMetadataForm/useSubmitDataset.ts b/src/sections/shared/form/DatasetMetadataForm/useSubmitDataset.ts index 9559839e2..ae27e0d2d 100644 --- a/src/sections/shared/form/DatasetMetadataForm/useSubmitDataset.ts +++ b/src/sections/shared/form/DatasetMetadataForm/useSubmitDataset.ts @@ -40,7 +40,7 @@ export function useSubmitDataset( datasetPersistentID?: string ): UseSubmitDatasetReturnType { const navigate = useNavigate() - const { t } = useTranslation('datasetMetadataForm') + const { t } = useTranslation('shared', { keyPrefix: 'datasetMetadataForm' }) const [submissionStatus, setSubmissionStatus] = useState( SubmissionStatus.NotSubmitted diff --git a/src/sections/shared/layout/app-loader/AppLoader.module.scss b/src/sections/shared/layout/app-loader/AppLoader.module.scss index 75591122c..c73ebaf84 100644 --- a/src/sections/shared/layout/app-loader/AppLoader.module.scss +++ b/src/sections/shared/layout/app-loader/AppLoader.module.scss @@ -4,4 +4,11 @@ display: grid; place-content: center; min-height: $main-container-available-height; + + &.full-viewport { + position: fixed; + inset: 0; + z-index: 1000; + min-height: unset; + } } diff --git a/src/sections/shared/layout/app-loader/AppLoader.tsx b/src/sections/shared/layout/app-loader/AppLoader.tsx index 045452fff..e0713c3f0 100644 --- a/src/sections/shared/layout/app-loader/AppLoader.tsx +++ b/src/sections/shared/layout/app-loader/AppLoader.tsx @@ -1,9 +1,18 @@ +import cn from 'classnames' import { Spinner } from '@iqss/dataverse-design-system' import styles from './AppLoader.module.scss' -export const AppLoader = () => { +interface AppLoaderProps { + fullViewport?: boolean +} + +export const AppLoader = ({ fullViewport = false }: AppLoaderProps) => { return ( -
+
) diff --git a/src/sections/shared/pagination/PageSizeSelector.tsx b/src/sections/shared/pagination/PageSizeSelector.tsx index 2378453df..aadb4ce82 100644 --- a/src/sections/shared/pagination/PageSizeSelector.tsx +++ b/src/sections/shared/pagination/PageSizeSelector.tsx @@ -10,7 +10,7 @@ export function PageSizeSelector({ pageSize: number setPageSize: (pageSize: number) => void }) { - const { t } = useTranslation('pagination') + const { t } = useTranslation('shared', { keyPrefix: 'pagination' }) const availableSizes = [10, 25, 50] return ( diff --git a/src/sections/shared/pagination/PaginationResultsInfo.tsx b/src/sections/shared/pagination/PaginationResultsInfo.tsx index 9bc4baf88..dce73cd35 100644 --- a/src/sections/shared/pagination/PaginationResultsInfo.tsx +++ b/src/sections/shared/pagination/PaginationResultsInfo.tsx @@ -11,7 +11,7 @@ interface PaginationResultsInfoProps { } export function PaginationResultsInfo({ paginationInfo, accumulated }: PaginationResultsInfoProps) { - const { t } = useTranslation('pagination') + const { t } = useTranslation('shared', { keyPrefix: 'pagination' }) const defineLocale = useCallback( (accumulated: number) => diff --git a/tests/component/sections/create-collection/CreateCollection.spec.tsx b/tests/component/sections/create-collection/CreateCollection.spec.tsx index 2c88dba53..40c4dbc8e 100644 --- a/tests/component/sections/create-collection/CreateCollection.spec.tsx +++ b/tests/component/sections/create-collection/CreateCollection.spec.tsx @@ -48,6 +48,11 @@ describe('CreateCollection', () => { }) it('should show loading skeleton while loading the owner collection', () => { + const DELAYED_TIME = 200 + collectionRepository.getById = cy.stub().callsFake(() => { + return Cypress.Promise.delay(DELAYED_TIME).then(() => collection) + }) + cy.customMount( { ownerCollectionId="root" /> ) + cy.clock() cy.findByTestId('create-collection-skeleton').should('exist') + + cy.tick(DELAYED_TIME) + + cy.findByTestId('create-collection-skeleton').should('not.exist') + + cy.clock().then((clock) => clock.restore()) }) it('should render the correct breadcrumbs', () => { diff --git a/tests/component/sections/create-dataset/CreateDataset.spec.tsx b/tests/component/sections/create-dataset/CreateDataset.spec.tsx index 4d882a954..159942511 100644 --- a/tests/component/sections/create-dataset/CreateDataset.spec.tsx +++ b/tests/component/sections/create-dataset/CreateDataset.spec.tsx @@ -42,6 +42,11 @@ describe('Create Dataset', () => { }) it('should show loading skeleton while loading the collection', () => { + const DELAYED_TIME = 200 + collectionRepository.getById = cy.stub().callsFake(() => { + return Cypress.Promise.delay(DELAYED_TIME).then(() => collection) + }) + cy.customMount( { collectionRepository={collectionRepository} /> ) + cy.clock() cy.findByTestId('create-dataset-skeleton').should('exist') + + cy.tick(DELAYED_TIME) + cy.findByTestId('create-dataset-skeleton').should('not.exist') }) it('should render the correct breadcrumbs', () => { diff --git a/tests/component/sections/shared/app-loader/AppLoader.spec.tsx b/tests/component/sections/shared/app-loader/AppLoader.spec.tsx new file mode 100644 index 000000000..29246b121 --- /dev/null +++ b/tests/component/sections/shared/app-loader/AppLoader.spec.tsx @@ -0,0 +1,17 @@ +import { AppLoader } from '@/sections/shared/layout/app-loader/AppLoader' + +describe('AppLoader', () => { + it('shows default app loader', () => { + cy.mount() + + cy.findByTestId('app-loader').should('exist').should('be.visible') + + cy.findByTestId('app-loader').invoke('attr', 'class').should('not.contain', 'full-viewport') + }) + + it('with fullViewport prop enabled should have an extra classname', () => { + cy.mount() + + cy.findByTestId('app-loader').invoke('attr', 'class').should('contain', 'full-viewport') + }) +}) diff --git a/tests/e2e-integration/e2e/sections/collection/Collection.spec.ts b/tests/e2e-integration/e2e/sections/collection/Collection.spec.ts index 5e71f8c05..de56e93f0 100644 --- a/tests/e2e-integration/e2e/sections/collection/Collection.spec.ts +++ b/tests/e2e-integration/e2e/sections/collection/Collection.spec.ts @@ -21,6 +21,7 @@ describe('Collection Page', () => { it('navigates to a dataset from the list when clicking the title', () => { cy.wrap(DatasetHelper.createWithTitle(title), { timeout: 10000 }).then(() => { + cy.wait(1_000) cy.visit('/spa/collections') cy.findByText(/Dataverse Admin/i).should('exist')