-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(desk): localize desk tool components
- Loading branch information
1 parent
74b5077
commit 4601245
Showing
20 changed files
with
353 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 0 additions & 63 deletions
63
packages/sanity/src/desk/components/MissingDocumentTypesMessage.tsx
This file was deleted.
Oops, something went wrong.
42 changes: 26 additions & 16 deletions
42
packages/sanity/src/desk/components/MissingSchemaType.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,41 @@ | ||
import {WarningOutlineIcon} from '@sanity/icons' | ||
import {SanityDocument} from '@sanity/types' | ||
import React from 'react' | ||
import {GeneralPreviewLayoutKey, SanityDefaultPreview} from 'sanity' | ||
import {deskLocaleNamespace} from '../i18n' | ||
import {GeneralPreviewLayoutKey, SanityDefaultPreview, Translate, useTranslation} from 'sanity' | ||
|
||
export interface MissingSchemaTypeProps { | ||
layout?: GeneralPreviewLayoutKey | ||
value: SanityDocument | ||
} | ||
|
||
const getUnknownTypeFallback = (id: string, typeName: string) => ({ | ||
title: ( | ||
<em> | ||
No schema found for type <code>{typeName}</code> | ||
</em> | ||
), | ||
subtitle: ( | ||
<em> | ||
Document: <code>{id}</code> | ||
</em> | ||
), | ||
media: () => <WarningOutlineIcon />, | ||
}) | ||
|
||
export function MissingSchemaType(props: MissingSchemaTypeProps) { | ||
const {t} = useTranslation(deskLocaleNamespace) | ||
const {layout, value} = props | ||
|
||
return ( | ||
<SanityDefaultPreview {...getUnknownTypeFallback(value._id, value._type)} layout={layout} /> | ||
<SanityDefaultPreview | ||
title={ | ||
<em> | ||
<Translate | ||
t={t} | ||
i18nKey="pane-item.missing-schema-type.title" | ||
components={{Code: 'code'}} | ||
values={{documentType: value._type}} | ||
/> | ||
</em> | ||
} | ||
subtitle={ | ||
<Translate | ||
t={t} | ||
i18nKey="pane-item.missing-schema-type.subtitle" | ||
components={{Code: 'code'}} | ||
values={{documentId: value._id}} | ||
/> | ||
} | ||
// eslint-disable-next-line react/jsx-no-bind | ||
media={() => <WarningOutlineIcon />} | ||
layout={layout} | ||
/> | ||
) | ||
} |
13 changes: 0 additions & 13 deletions
13
packages/sanity/src/desk/components/NotPublishedStatus.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 0 additions & 73 deletions
73
packages/sanity/src/desk/components/ReferringDocumentsList.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.