chore: fix typos across the codebase (#402)
This commit is contained in:
@ -86,7 +86,7 @@ const Header = ({
|
||||
createNewEntry(collectionName);
|
||||
}, []);
|
||||
|
||||
const createableCollections = useMemo(
|
||||
const creatableCollections = useMemo(
|
||||
() =>
|
||||
Object.values(collections).filter(collection =>
|
||||
'folder' in collection ? collection.create ?? false : false,
|
||||
@ -123,7 +123,7 @@ const Header = ({
|
||||
) : null}
|
||||
<StyledSpacer />
|
||||
<StyledAppHeaderActions>
|
||||
{createableCollections.length > 0 && (
|
||||
{creatableCollections.length > 0 && (
|
||||
<div key="quick-create">
|
||||
<Button
|
||||
id="quick-create-button"
|
||||
@ -145,7 +145,7 @@ const Header = ({
|
||||
'aria-labelledby': 'quick-create-button',
|
||||
}}
|
||||
>
|
||||
{createableCollections.map(collection => (
|
||||
{creatableCollections.map(collection => (
|
||||
<MenuItem
|
||||
key={collection.name}
|
||||
onClick={() => handleCreatePostClick(collection.name)}
|
||||
|
@ -54,7 +54,7 @@ const EntryCard = ({
|
||||
|
||||
interface EntryCardOwnProps {
|
||||
entry: Entry;
|
||||
inferedFields: {
|
||||
inferredFields: {
|
||||
titleField?: string | null | undefined;
|
||||
descriptionField?: string | null | undefined;
|
||||
imageField?: string | null | undefined;
|
||||
@ -67,11 +67,11 @@ interface EntryCardOwnProps {
|
||||
}
|
||||
|
||||
function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
|
||||
const { entry, inferedFields, collection } = ownProps;
|
||||
const { entry, inferredFields, collection } = ownProps;
|
||||
const entryData = entry.data;
|
||||
|
||||
let image = inferedFields.imageField
|
||||
? (entryData?.[inferedFields.imageField] as string | undefined)
|
||||
let image = inferredFields.imageField
|
||||
? (entryData?.[inferredFields.imageField] as string | undefined)
|
||||
: undefined;
|
||||
|
||||
if (image) {
|
||||
@ -86,7 +86,7 @@ function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
|
||||
image,
|
||||
imageField:
|
||||
'fields' in collection
|
||||
? collection.fields?.find(f => f.name === inferedFields.imageField && f.widget === 'image')
|
||||
? collection.fields?.find(f => f.name === inferredFields.imageField && f.widget === 'image')
|
||||
: undefined,
|
||||
isLoadingAsset,
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ import { Waypoint } from 'react-waypoint';
|
||||
|
||||
import { VIEW_STYLE_LIST } from '@staticcms/core/constants/collectionViews';
|
||||
import { transientOptions } from '@staticcms/core/lib';
|
||||
import { selectFields, selectInferedField } from '@staticcms/core/lib/util/collection.util';
|
||||
import { selectFields, selectInferredField } from '@staticcms/core/lib/util/collection.util';
|
||||
import EntryCard from './EntryCard';
|
||||
|
||||
import type { CollectionViewStyle } from '@staticcms/core/constants/collectionViews';
|
||||
@ -86,12 +86,12 @@ const EntryListing = ({
|
||||
return {};
|
||||
}
|
||||
|
||||
const titleField = selectInferedField(collection, 'title');
|
||||
const descriptionField = selectInferedField(collection, 'description');
|
||||
const imageField = selectInferedField(collection, 'image');
|
||||
const titleField = selectInferredField(collection, 'title');
|
||||
const descriptionField = selectInferredField(collection, 'description');
|
||||
const imageField = selectInferredField(collection, 'image');
|
||||
const fields = selectFields(collection);
|
||||
const inferedFields = [titleField, descriptionField, imageField];
|
||||
const remainingFields = fields && fields.filter(f => inferedFields.indexOf(f.name) === -1);
|
||||
const inferredFields = [titleField, descriptionField, imageField];
|
||||
const remainingFields = fields && fields.filter(f => inferredFields.indexOf(f.name) === -1);
|
||||
return { titleField, descriptionField, imageField, remainingFields };
|
||||
},
|
||||
[],
|
||||
@ -99,11 +99,11 @@ const EntryListing = ({
|
||||
|
||||
const renderedCards = useMemo(() => {
|
||||
if ('collection' in otherProps) {
|
||||
const inferedFields = inferFields(otherProps.collection);
|
||||
const inferredFields = inferFields(otherProps.collection);
|
||||
return entries.map((entry, idx) => (
|
||||
<EntryCard
|
||||
collection={otherProps.collection}
|
||||
inferedFields={inferedFields}
|
||||
inferredFields={inferredFields}
|
||||
viewStyle={viewStyle}
|
||||
entry={entry}
|
||||
key={idx}
|
||||
@ -118,12 +118,12 @@ const EntryListing = ({
|
||||
coll => coll.name === collectionName,
|
||||
);
|
||||
const collectionLabel = !isSingleCollectionInList ? collection?.label : undefined;
|
||||
const inferedFields = inferFields(collection);
|
||||
const inferredFields = inferFields(collection);
|
||||
return collection ? (
|
||||
<EntryCard
|
||||
collection={collection}
|
||||
entry={entry}
|
||||
inferedFields={inferedFields}
|
||||
inferredFields={inferredFields}
|
||||
collectionLabel={collectionLabel}
|
||||
key={idx}
|
||||
/>
|
||||
|
@ -46,7 +46,7 @@ const LocaleRowWrapper = styled('div')`
|
||||
gap: 8px;
|
||||
`;
|
||||
|
||||
const DefaultLocaleWrittingIn = styled('div')`
|
||||
const DefaultLocaleWritingIn = styled('div')`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 36.5px;
|
||||
@ -89,7 +89,7 @@ const LocaleDropdown = ({
|
||||
);
|
||||
|
||||
if (!canChangeLocale) {
|
||||
return <DefaultLocaleWrittingIn>{dropdownText}</DefaultLocaleWrittingIn>;
|
||||
return <DefaultLocaleWritingIn>{dropdownText}</DefaultLocaleWritingIn>;
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -10,7 +10,7 @@ import { getAsset as getAssetAction } from '@staticcms/core/actions/media';
|
||||
import { ErrorBoundary } from '@staticcms/core/components/UI';
|
||||
import { lengths } from '@staticcms/core/components/UI/styles';
|
||||
import { getPreviewStyles, getPreviewTemplate, resolveWidget } from '@staticcms/core/lib/registry';
|
||||
import { selectTemplateName, useInferedFields } from '@staticcms/core/lib/util/collection.util';
|
||||
import { selectTemplateName, useInferredFields } from '@staticcms/core/lib/util/collection.util';
|
||||
import { selectField } from '@staticcms/core/lib/util/field.util';
|
||||
import { selectIsLoadingAsset } from '@staticcms/core/reducers/selectors/medias';
|
||||
import { getTypedFieldForValue } from '@staticcms/list/typedListHelpers';
|
||||
@ -92,7 +92,7 @@ function getWidgetFor(
|
||||
name: string,
|
||||
fields: Field[],
|
||||
entry: Entry,
|
||||
inferedFields: Record<string, InferredField>,
|
||||
inferredFields: Record<string, InferredField>,
|
||||
getAsset: GetAssetFunction,
|
||||
widgetFields: Field[] = fields,
|
||||
values: EntryData = entry.data,
|
||||
@ -116,7 +116,7 @@ function getWidgetFor(
|
||||
collection,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
field.fields,
|
||||
value as EntryData | EntryData[],
|
||||
@ -130,7 +130,7 @@ function getWidgetFor(
|
||||
collection,
|
||||
field,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
value as EntryData[],
|
||||
),
|
||||
@ -138,7 +138,7 @@ function getWidgetFor(
|
||||
}
|
||||
|
||||
const labelledWidgets = ['string', 'text', 'number'];
|
||||
const inferedField = Object.entries(inferedFields)
|
||||
const inferredField = Object.entries(inferredFields)
|
||||
.filter(([key]) => {
|
||||
const fieldToMatch = selectField(collection, key);
|
||||
return fieldToMatch === fieldWithWidgets;
|
||||
@ -146,8 +146,8 @@ function getWidgetFor(
|
||||
.map(([, value]) => value)[0];
|
||||
|
||||
let renderedValue: ValueOrNestedValue | ReactNode = value;
|
||||
if (inferedField) {
|
||||
renderedValue = inferedField.defaultPreview(String(value));
|
||||
if (inferredField) {
|
||||
renderedValue = inferredField.defaultPreview(String(value));
|
||||
} else if (
|
||||
value &&
|
||||
fieldWithWidgets.widget &&
|
||||
@ -235,7 +235,7 @@ function widgetsForNestedFields(
|
||||
collection: Collection,
|
||||
fields: Field[],
|
||||
entry: Entry,
|
||||
inferedFields: Record<string, InferredField>,
|
||||
inferredFields: Record<string, InferredField>,
|
||||
getAsset: GetAssetFunction,
|
||||
widgetFields: Field[],
|
||||
values: EntryData,
|
||||
@ -249,7 +249,7 @@ function widgetsForNestedFields(
|
||||
field.name,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
widgetFields,
|
||||
values,
|
||||
@ -267,7 +267,7 @@ function getTypedNestedWidgets(
|
||||
collection: Collection,
|
||||
field: ListField,
|
||||
entry: Entry,
|
||||
inferedFields: Record<string, InferredField>,
|
||||
inferredFields: Record<string, InferredField>,
|
||||
getAsset: GetAssetFunction,
|
||||
values: EntryData[],
|
||||
) {
|
||||
@ -283,7 +283,7 @@ function getTypedNestedWidgets(
|
||||
collection,
|
||||
itemType.fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
itemType.fields,
|
||||
value,
|
||||
@ -301,7 +301,7 @@ function getNestedWidgets(
|
||||
collection: Collection,
|
||||
fields: Field[],
|
||||
entry: Entry,
|
||||
inferedFields: Record<string, InferredField>,
|
||||
inferredFields: Record<string, InferredField>,
|
||||
getAsset: GetAssetFunction,
|
||||
widgetFields: Field[],
|
||||
values: EntryData | EntryData[],
|
||||
@ -314,7 +314,7 @@ function getNestedWidgets(
|
||||
collection,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
widgetFields,
|
||||
value,
|
||||
@ -328,7 +328,7 @@ function getNestedWidgets(
|
||||
collection,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
getAsset,
|
||||
widgetFields,
|
||||
values,
|
||||
@ -338,7 +338,7 @@ function getNestedWidgets(
|
||||
const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||
const { entry, collection, config, fields, previewInFrame, getAsset, t } = props;
|
||||
|
||||
const inferedFields = useInferedFields(collection);
|
||||
const inferredFields = useInferredFields(collection);
|
||||
|
||||
const handleGetAsset = useCallback(
|
||||
(path: string, field?: Field) => {
|
||||
@ -359,11 +359,11 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||
name,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
handleGetAsset,
|
||||
);
|
||||
},
|
||||
[collection, config, entry, fields, handleGetAsset, inferedFields],
|
||||
[collection, config, entry, fields, handleGetAsset, inferredFields],
|
||||
);
|
||||
|
||||
/**
|
||||
@ -413,7 +413,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||
field.name,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
handleGetAsset,
|
||||
nestedFields,
|
||||
val,
|
||||
@ -445,7 +445,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||
field.name,
|
||||
fields,
|
||||
entry,
|
||||
inferedFields,
|
||||
inferredFields,
|
||||
handleGetAsset,
|
||||
nestedFields,
|
||||
value,
|
||||
@ -457,7 +457,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
||||
}, {} as Record<string, ReactNode>),
|
||||
};
|
||||
},
|
||||
[collection, config.config, entry, fields, handleGetAsset, inferedFields],
|
||||
[collection, config.config, entry, fields, handleGetAsset, inferredFields],
|
||||
);
|
||||
|
||||
const previewStyles = useMemo(
|
||||
|
Reference in New Issue
Block a user