Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS: I18N settings, create modal #10749

Merged
merged 1 commit into from Sep 8, 2021
Merged

Conversation

mfrachet
Copy link
Contributor

@mfrachet mfrachet commented Aug 18, 2021

What does it do?

Moves the I18N settings modal for creating a new locale to the new DS

How to test it?

  • Login the dashboard
  • Select "Settings" on the main menu
  • Select "I18N" in the sub menu
  • Select the "Add a locale" button

Screenshot

The I18N settings modal opened

@mfrachet mfrachet force-pushed the ds/i18n-settings-create branch 2 times, most recently from 4186c79 to 6b6437d Compare August 19, 2021 07:25
@mfrachet mfrachet marked this pull request as ready for review August 19, 2021 07:37
@codecov
Copy link

codecov bot commented Sep 7, 2021

Codecov Report

Merging #10749 (8ce77ad) into v4/ds-migration (7ff5867) will not change coverage.
The diff coverage is n/a.

❗ Current head 8ce77ad differs from pull request most recent head 2d75759. Consider uploading reports for the commit 2d75759 to get more accurate results
Impacted file tree graph

@@               Coverage Diff                @@
##           v4/ds-migration   #10749   +/-   ##
================================================
  Coverage            58.84%   58.84%           
================================================
  Files                  174      174           
  Lines                 6007     6007           
  Branches              1251     1251           
================================================
  Hits                  3535     3535           
  Misses                2054     2054           
  Partials               418      418           
Flag Coverage Δ
front ?
unit 58.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aabc125...2d75759. Read the comment docs.

}
/>
</ContentLayout>
<EmptyStateLayout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you can use the CustomContentLayout component instead:

import { CustomContentLayout } from '@strapi/helper-plugin';

<CustomContentLayout
        shouldShowEmptyState={locales === undefined || locales?.length === 0}
        action={
          onToggleCreateModal ? (
            <Button variant="secondary" startIcon={<AddIcon />} onClick={onToggleCreateModal}>
              {formatMessage({ id: getTrad('Settings.list.actions.add') })}
            </Button>
          ) : null
        }
      >
        <LocaleTable
          locales={locales}
          onDeleteLocale={handleDeleteLocale}
          onEditLocale={handleEditLocale}
        />
      </CustomContentLayout>

packages/plugins/i18n/admin/src/schemas.js Outdated Show resolved Hide resolved
packages/plugins/i18n/admin/src/translations/en.json Outdated Show resolved Hide resolved
packages/plugins/i18n/admin/src/translations/en.json Outdated Show resolved Hide resolved
@@ -0,0 +1,75 @@
<!--- EmptyStateLayout.stories.mdx --->

import { Meta, ArgsTable, Canvas, Story } from '@storybook/addon-docs';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

return !foundLocale;
});

const computedValue = value || '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const computedValue = value || options[0]?.value || '';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't match the default display name if we do that

@mfrachet mfrachet merged commit b77feb9 into v4/ds-migration Sep 8, 2021
@mfrachet mfrachet deleted the ds/i18n-settings-create branch September 8, 2021 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants