* fix: PageCard should use the pages and resources path from context This prevents some odd behaviors around changing the URL based on the current path. * fix: use the correct formRef for AppConfigForm children Straight up refactoring bug. This should be using the formRef from the context, but was still defining its own and passing it down. This ultimately meant that the submit button wasn’t properly hooked up to the form, since the form was given a different ref than the submit button. * fix: Only validate fields that have been touched * fix: use the title instead of app.name app.name doesn’t exist - but the title is the string we’re looking for. Use it. * refactor: default appConfig appropriately for both config forms In subsequent PRs we’re going to start passing null appConfigs to forms sometimes - this uses prop types to set default values for the forms if the component isn’t passed a meaningful appConfig. * refactor: replace and flesh out discussions data layer Since we only have one GET endpoint for all the data around discussions, we don’t need two separate slices/thunks/api files. The API needs to be hit once when the discussions settings load. This means the app-list and app-config-form share far more state than originally thought. The AppList and AppConfigForm are no longer responsible for data loading - we’ve moved that back up into DiscussionsSettings. Now they just read from the redux state and load what they need. The main change is moving app-list/data/slice.js up to discussions/data/slice.js, renaming the reducer, and adding a saveStatus to it - turns out this is all we need. The original two slices go away. The discussions/data/api file gets a proper implementation of postAppConfig which mostly works with the server as of this writing - we have some data shape issues to figure out. AppConfigForm needed a little help. It now checks whether our data is loaded and selects an app based on its route. This allows us to deep link in and keep the selectedAppId correct. * Adding a loading spinner to AppList This is only tangentally related to the current PR, admittedly. * test: adding some title tests to LegacyConfigForm.test.jsx Needed to add the title prop, then decided I’d test it. * test: adding a test suite for discussions/data files This test exercises the thunks, slice, and api parts of the data layer all at once in ‘real’ scenarios with mocked API requests.
26 lines
714 B
JavaScript
26 lines
714 B
JavaScript
import React from 'react';
|
|
import { Spinner } from '@edx/paragon';
|
|
import { FormattedMessage } from '@edx/frontend-platform/i18n';
|
|
|
|
export default function Loading() {
|
|
return (
|
|
<div
|
|
className="d-flex justify-content-center align-items-center flex-column"
|
|
style={{
|
|
height: '50vh',
|
|
}}
|
|
data-test-id="spinnerContainer"
|
|
>
|
|
<Spinner className animation="border" role="status" variant="primary">
|
|
<span className="sr-only">
|
|
<FormattedMessage
|
|
id="authoring.loading"
|
|
defaultMessage="Loading..."
|
|
description="Screen-reader message for when a page is loading."
|
|
/>
|
|
</span>
|
|
</Spinner>
|
|
</div>
|
|
);
|
|
}
|