From 54dad7cae5988f46e4ba7fecebcdea5b878f4cb7 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 16 Oct 2019 17:18:29 +0200 Subject: [PATCH 1/7] Allow users to change language --- package-lock.json | 6 +- package.json | 2 +- src/components/AppLayout/AppLayout.tsx | 17 +++- src/components/Date/Date.tsx | 2 +- src/components/Date/DateTime.tsx | 2 +- src/components/Locale/Locale.tsx | 78 ++++++++++++++++--- src/components/Money/Money.tsx | 2 +- src/components/MoneyRange/MoneyRange.tsx | 3 +- src/components/Percent/Percent.tsx | 2 +- src/hooks/useDateLocalize.ts | 2 +- src/hooks/useLocale.ts | 4 +- .../StaffDetailsPage/StaffDetailsPage.tsx | 52 ++++++++----- .../StaffPreferences/StaffPreferences.tsx | 52 +++++++++++++ .../components/StaffPreferences/index.ts | 2 + src/staff/views/StaffDetails.tsx | 1 + src/storybook/Decorator.tsx | 11 ++- .../stories/staff/StaffDetailsPage.tsx | 2 + src/theme.ts | 1 + 18 files changed, 194 insertions(+), 47 deletions(-) create mode 100644 src/staff/components/StaffPreferences/StaffPreferences.tsx create mode 100644 src/staff/components/StaffPreferences/index.ts diff --git a/package-lock.json b/package-lock.json index e437333ce..ddb20cd7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4953,9 +4953,9 @@ } }, "babel-plugin-react-intl-auto": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/babel-plugin-react-intl-auto/-/babel-plugin-react-intl-auto-2.2.0.tgz", - "integrity": "sha512-L6IS4NQCr+uGw8yOJ+tBfm5R0UhrM2mZyhN+X7jCsnEhTcWopkWe7geLm7AzJC2SWFXnr7phwXlJbN4erwKRrA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-react-intl-auto/-/babel-plugin-react-intl-auto-2.3.0.tgz", + "integrity": "sha512-y9QSRHkuN2eAPlvhvvJCbWjxeXhd0kbFLksLkMgaqX7VAiWON04rTSfq4PVbvgfvs5MHdLLbGrxBEWQ129QVIA==", "dev": true, "requires": { "@babel/types": "^7.5.5", diff --git a/package.json b/package.json index de5286a57..8bba69e0a 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "babel-jest": "^23.6.0", "babel-loader": "^8.0.6", "babel-plugin-react-intl": "^4.1.12", - "babel-plugin-react-intl-auto": "^2.2.0", + "babel-plugin-react-intl-auto": "^2.3.0", "codecov": "^3.5.0", "core-js": "^3.2.1", "enzyme": "^3.10.0", diff --git a/src/components/AppLayout/AppLayout.tsx b/src/components/AppLayout/AppLayout.tsx index 0d3cbb4b6..6185b8d3b 100644 --- a/src/components/AppLayout/AppLayout.tsx +++ b/src/components/AppLayout/AppLayout.tsx @@ -29,6 +29,7 @@ import useNavigator from "@saleor/hooks/useNavigator"; import useTheme from "@saleor/hooks/useTheme"; import useUser from "@saleor/hooks/useUser"; import ArrowDropdown from "@saleor/icons/ArrowDropdown"; +import { staffMemberDetailsUrl } from "@saleor/staff/urls"; import Container from "../Container"; import AppActionContext from "./AppActionContext"; import AppHeaderContext from "./AppHeaderContext"; @@ -287,10 +288,15 @@ const AppLayout = withStyles(styles, { const menuStructure = createMenuStructure(intl); const handleLogout = () => { - close(); + setMenuState(false); logout(); }; + const handleViewerProfile = () => { + setMenuState(false); + navigate(staffMemberDetailsUrl(user.id)); + }; + const handleMenuItemClick = ( url: string, event: React.MouseEvent @@ -434,6 +440,15 @@ const AppLayout = withStyles(styles, { mouseEvent="onClick" > + + + = ({ date, plain }) => { return ( - {locale => ( + {({ locale }) => ( {currentDate => plain ? ( diff --git a/src/components/Date/DateTime.tsx b/src/components/Date/DateTime.tsx index 31af9987e..d6a9045a4 100644 --- a/src/components/Date/DateTime.tsx +++ b/src/components/Date/DateTime.tsx @@ -27,7 +27,7 @@ export const DateTime: React.StatelessComponent = ({ {tz => ( - {locale => ( + {({ locale }) => ( {currentDate => plain ? ( diff --git a/src/components/Locale/Locale.tsx b/src/components/Locale/Locale.tsx index a5d23b8e8..6a5b3c458 100644 --- a/src/components/Locale/Locale.tsx +++ b/src/components/Locale/Locale.tsx @@ -43,15 +43,6 @@ import locale_VI from "@locale/vi.json"; import locale_ZH_HANS from "@locale/zh-Hans.json"; import locale_ZH_HANT from "@locale/zh-Hant.json"; -const defaultLocale = "en"; - -export type LocaleContextType = string; -export const LocaleContext = React.createContext( - defaultLocale -); - -const { Consumer: LocaleConsumer, Provider: RawLocaleProvider } = LocaleContext; - export enum Locale { AR = "ar", AZ = "az", @@ -144,6 +135,51 @@ const localeData: Record = { [Locale.ZH_HANT]: locale_ZH_HANT }; +export const localeNames: Record = { + [Locale.AR]: "العربيّة", + [Locale.AZ]: "Azərbaycanca", + [Locale.BG]: "български", + [Locale.BN]: "বাংলা", + [Locale.CA]: "català", + [Locale.CS]: "česky", + [Locale.DA]: "dansk", + [Locale.DE]: "Deutsch", + [Locale.EL]: "Ελληνικά", + [Locale.EN]: "English", + [Locale.ES]: "español", + [Locale.ES_CO]: "español de Colombia", + [Locale.ET]: "eesti", + [Locale.FA]: "فارسی", + [Locale.FR]: "français", + [Locale.HI]: "Hindi", + [Locale.HU]: "Magyar", + [Locale.HY]: "հայերեն", + [Locale.ID]: "Bahasa Indonesia", + [Locale.IS]: "Íslenska", + [Locale.IT]: "italiano", + [Locale.JA]: "日本語", + [Locale.KO]: "한국어", + [Locale.MN]: "Mongolian", + [Locale.NB]: "norsk (bokmål)", + [Locale.NL]: "Nederlands", + [Locale.PL]: "polski", + [Locale.PT]: "Português", + [Locale.PT_BR]: "Português Brasileiro", + [Locale.RO]: "Română", + [Locale.RU]: "Русский", + [Locale.SK]: "Slovensky", + [Locale.SL]: "Slovenščina", + [Locale.SQ]: "shqip", + [Locale.SR]: "српски", + [Locale.SV]: "svenska", + [Locale.TH]: "ภาษาไทย", + [Locale.TR]: "Türkçe", + [Locale.UK]: "Українська", + [Locale.VI]: "Tiếng Việt", + [Locale.ZH_HANS]: "简体中文", + [Locale.ZH_HANT]: "繁體中文" +}; + export function getMatchingLocale(languages: readonly string[]): Locale { const localeEntries = Object.entries(Locale); @@ -158,8 +194,21 @@ export function getMatchingLocale(languages: readonly string[]): Locale { return undefined; } +const defaultLocale = Locale.EN; + +export interface LocaleContextType { + locale: Locale; + setLocale: (locale: Locale) => void; +} +export const LocaleContext = React.createContext({ + locale: defaultLocale, + setLocale: () => undefined +}); + +const { Consumer: LocaleConsumer, Provider: RawLocaleProvider } = LocaleContext; + const LocaleProvider: React.FC = ({ children }) => { - const [locale] = React.useState( + const [locale, setLocale] = React.useState( getMatchingLocale(navigator.languages) || defaultLocale ); @@ -175,7 +224,14 @@ const LocaleProvider: React.FC = ({ children }) => { }} key={locale} > - {children} + + {children} + ); }; diff --git a/src/components/Money/Money.tsx b/src/components/Money/Money.tsx index 164a34af9..c1c623ea9 100644 --- a/src/components/Money/Money.tsx +++ b/src/components/Money/Money.tsx @@ -12,7 +12,7 @@ export interface MoneyProps { export const Money: React.StatelessComponent = ({ money }) => ( - {locale => { + {({ locale }) => { return money.amount.toLocaleString(locale, { currency: money.currency, style: "currency" diff --git a/src/components/MoneyRange/MoneyRange.tsx b/src/components/MoneyRange/MoneyRange.tsx index 0b4a6d12f..e85c6c1d1 100644 --- a/src/components/MoneyRange/MoneyRange.tsx +++ b/src/components/MoneyRange/MoneyRange.tsx @@ -1,5 +1,6 @@ import React from "react"; import { useIntl } from "react-intl"; + import { LocaleConsumer } from "../Locale"; import IMoney from "../Money"; @@ -22,7 +23,7 @@ export const MoneyRange: React.StatelessComponent = ({ return ( - {locale => + {({ locale }) => from && to ? intl.formatMessage( { diff --git a/src/components/Percent/Percent.tsx b/src/components/Percent/Percent.tsx index ee6ed35e3..7a890e7b3 100644 --- a/src/components/Percent/Percent.tsx +++ b/src/components/Percent/Percent.tsx @@ -8,7 +8,7 @@ interface PercentProps { const Percent: React.StatelessComponent = ({ amount }) => ( - {locale => { + {({ locale }) => { return (amount / 100).toLocaleString(locale, { maximumFractionDigits: 2, style: "percent" diff --git a/src/hooks/useDateLocalize.ts b/src/hooks/useDateLocalize.ts index 3ef7cb9ef..d183556c2 100644 --- a/src/hooks/useDateLocalize.ts +++ b/src/hooks/useDateLocalize.ts @@ -4,7 +4,7 @@ import { useContext } from "react"; import { LocaleContext } from "@saleor/components/Locale"; function useDateLocalize(): (date: string) => string { - const locale = useContext(LocaleContext); + const { locale } = useContext(LocaleContext); return (date: string) => moment(date) diff --git a/src/hooks/useLocale.ts b/src/hooks/useLocale.ts index 1f1487603..9114c9d72 100644 --- a/src/hooks/useLocale.ts +++ b/src/hooks/useLocale.ts @@ -3,7 +3,7 @@ import { useContext } from "react"; import { LocaleContext } from "@saleor/components/Locale"; function useLocale() { - const themeInfo = useContext(LocaleContext); - return themeInfo; + const localeInfo = useContext(LocaleContext); + return localeInfo; } export default useLocale; diff --git a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx index a2ab4bdb0..826ff2327 100644 --- a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx +++ b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx @@ -9,13 +9,16 @@ import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import Container from "@saleor/components/Container"; import Form from "@saleor/components/Form"; import Grid from "@saleor/components/Grid"; +import { localeNames } from "@saleor/components/Locale"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; import { ShopInfo_shop_permissions } from "@saleor/components/Shop/types/ShopInfo"; +import useLocale from "@saleor/hooks/useLocale"; import { sectionNames } from "@saleor/intl"; import { getUserName, maybe } from "../../../misc"; import { PermissionEnum } from "../../../types/globalTypes"; import { StaffMemberDetails_user } from "../../types/StaffMemberDetails"; +import StaffPreferences from "../StaffPreferences"; import StaffProperties from "../StaffProperties/StaffProperties"; interface FormData { @@ -29,6 +32,7 @@ interface FormData { export interface StaffDetailsPageProps { canEditAvatar: boolean; + canEditPreferences: boolean; canEditStatus: boolean; canRemove: boolean; disabled: boolean; @@ -44,6 +48,7 @@ export interface StaffDetailsPageProps { const StaffDetailsPage: React.StatelessComponent = ({ canEditAvatar, + canEditPreferences, canEditStatus, canRemove, disabled, @@ -57,6 +62,7 @@ const StaffDetailsPage: React.StatelessComponent = ({ onSubmit }: StaffDetailsPageProps) => { const intl = useIntl(); + const { locale, setLocale } = useLocale(); const initialForm: FormData = { email: maybe(() => staffMember.email, ""), @@ -75,6 +81,7 @@ const StaffDetailsPage: React.StatelessComponent = ({ lastName: maybe(() => staffMember.lastName, ""), permissions: maybe(() => staffMember.permissions, []).map(perm => perm.code) }; + return (
{({ data, change, hasChanged, submit }) => ( @@ -95,26 +102,31 @@ const StaffDetailsPage: React.StatelessComponent = ({ onImageDelete={onImageDelete} /> - {canEditStatus && ( -
- - - -
- )} +
+ {canEditPreferences && ( + + )} + {canEditStatus && ( + <> + + + + + )} +
void; +} + +const StaffPreferences: React.StatelessComponent = ({ + locale, + onLocaleChange +}) => { + const intl = useIntl(); + + return ( + + + + ({ + label: localeNames[locale], + value: locale + }))} + displayValue={localeNames[locale]} + helperText={intl.formatMessage({ + defaultMessage: + "Selecting this will change the language of your dashboard" + })} + label={intl.formatMessage({ + defaultMessage: "Preferred Language" + })} + name="locale" + value={locale} + onChange={event => onLocaleChange(event.target.value)} + /> + + + ); +}; +StaffPreferences.displayName = "StaffPreferences"; +export default StaffPreferences; diff --git a/src/staff/components/StaffPreferences/index.ts b/src/staff/components/StaffPreferences/index.ts new file mode 100644 index 000000000..e57bc57c9 --- /dev/null +++ b/src/staff/components/StaffPreferences/index.ts @@ -0,0 +1,2 @@ +export { default } from "./StaffPreferences"; +export * from "./StaffPreferences"; diff --git a/src/staff/views/StaffDetails.tsx b/src/staff/views/StaffDetails.tsx index 1090184a1..f32c8995f 100644 --- a/src/staff/views/StaffDetails.tsx +++ b/src/staff/views/StaffDetails.tsx @@ -126,6 +126,7 @@ export const StaffDetails: React.StatelessComponent = ({ /> ( - - + + undefined + }} + > diff --git a/src/storybook/stories/staff/StaffDetailsPage.tsx b/src/storybook/stories/staff/StaffDetailsPage.tsx index 5f2e115bb..455e7d7fe 100644 --- a/src/storybook/stories/staff/StaffDetailsPage.tsx +++ b/src/storybook/stories/staff/StaffDetailsPage.tsx @@ -11,6 +11,7 @@ import Decorator from "../../Decorator"; const props: Omit = { canEditAvatar: false, + canEditPreferences: false, canEditStatus: true, canRemove: true, disabled: false, @@ -45,5 +46,6 @@ storiesOf("Views / Staff / Staff member details", module) canEditStatus={false} canRemove={false} canEditAvatar={true} + canEditPreferences={true} /> )); diff --git a/src/theme.ts b/src/theme.ts index 1ed2b9bfd..937f04fc6 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -526,6 +526,7 @@ export default (colors: IThemeColors): Theme => body2: { fontSize: "1rem" }, + fontFamily, h4: { color: colors.font.default }, From f9dd50e297eb889fcc4e62cfb1baa5053f51c24d Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 16 Oct 2019 17:24:26 +0200 Subject: [PATCH 2/7] Fix types --- src/products/views/ProductList/ProductList.tsx | 2 +- src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/products/views/ProductList/ProductList.tsx b/src/products/views/ProductList/ProductList.tsx index 7c9b01f8c..ae78c2ba5 100644 --- a/src/products/views/ProductList/ProductList.tsx +++ b/src/products/views/ProductList/ProductList.tsx @@ -64,7 +64,7 @@ interface ProductListProps { export const ProductList: React.StatelessComponent = ({ params }) => { - const locale = useLocale(); + const { locale } = useLocale(); const navigate = useNavigator(); const notify = useNotifier(); const paginate = usePaginator(); diff --git a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx index 826ff2327..48e56488f 100644 --- a/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx +++ b/src/staff/components/StaffDetailsPage/StaffDetailsPage.tsx @@ -9,7 +9,6 @@ import { ConfirmButtonTransitionState } from "@saleor/components/ConfirmButton"; import Container from "@saleor/components/Container"; import Form from "@saleor/components/Form"; import Grid from "@saleor/components/Grid"; -import { localeNames } from "@saleor/components/Locale"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; import { ShopInfo_shop_permissions } from "@saleor/components/Shop/types/ShopInfo"; From 77fe0076e2b713a93d5caf488cd805a2bdd3d7cb Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 16 Oct 2019 17:31:47 +0200 Subject: [PATCH 3/7] Update snapshots --- .../__snapshots__/Stories.test.ts.snap | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 9eeaa4605..2472e45a1 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -118581,6 +118581,98 @@ exports[`Storyshots Views / Staff / Staff member details default 1`] = ` +
+
+
+ + Preferences + +
+
+
+
+
+
+
+ + +

+ Selecting this will change the language of your dashboard +

+
+
+
+
+
From 7faff0d4f3dfcba9ed29141090862b9dd5254195 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 16 Oct 2019 17:33:26 +0200 Subject: [PATCH 4/7] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc7c642f6..0c5323ec5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,3 +40,4 @@ All notable, unreleased changes to this project will be documented in this file. - Update sale details design - #207 by @dominik-zeglen - Improve autocomplete UX - #212 by @dominik-zeglen - Fix empty attribute values - #218 by @dominik-zeglen +- Add language switch - #213 by @dominik-zeglen From 845d5186c95496ee100b591ca761f386120d862c Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Wed, 16 Oct 2019 17:35:19 +0200 Subject: [PATCH 5/7] Persist locale in local storage --- locale/messages.pot | 34 +++++++++++++++++++++++++++++++- src/components/Locale/Locale.tsx | 4 +++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/locale/messages.pot b/locale/messages.pot index 0737d71ba..ae28d4017 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-10-16T15:55:00.250Z\n" +"POT-Creation-Date: 2019-10-17T11:58:34.974Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -59,6 +59,14 @@ msgctxt "service account" msgid "Account Name" msgstr "" +#: build/locale/src/components/AppLayout/AppLayout.json +#. [src.components.AppLayout.248888005] - button +#. defaultMessage is: +#. Account Settings +msgctxt "button" +msgid "Account Settings" +msgstr "" + #: build/locale/src/components/AccountStatus/AccountStatus.json #. [src.components.AccountStatus.2183517419] - section header #. defaultMessage is: @@ -5755,6 +5763,22 @@ msgctxt "order payment" msgid "Preauthorized amount" msgstr "" +#: build/locale/src/staff/components/StaffPreferences/StaffPreferences.json +#. [src.staff.components.StaffPreferences.2340309446] - section header +#. defaultMessage is: +#. Preferences +msgctxt "section header" +msgid "Preferences" +msgstr "" + +#: build/locale/src/staff/components/StaffPreferences/StaffPreferences.json +#. [src.staff.components.StaffPreferences.2281358617] +#. defaultMessage is: +#. Preferred Language +msgctxt "description" +msgid "Preferred Language" +msgstr "" + #: build/locale/src/products/components/ProductVariantCreateDialog/ProductVariantCreateDialog.json #. [src.products.components.ProductVariantCreateDialog.904693740] - previous step, button #. defaultMessage is: @@ -7019,6 +7043,14 @@ msgctxt "description" msgid "Selected {number} items" msgstr "" +#: build/locale/src/staff/components/StaffPreferences/StaffPreferences.json +#. [src.staff.components.StaffPreferences.1332294025] +#. defaultMessage is: +#. Selecting this will change the language of your dashboard +msgctxt "description" +msgid "Selecting this will change the language of your dashboard" +msgstr "" + #: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json #. [src.products.components.ProductVariantPrice.2238565650] #. defaultMessage is: diff --git a/src/components/Locale/Locale.tsx b/src/components/Locale/Locale.tsx index 6a5b3c458..a5cd646db 100644 --- a/src/components/Locale/Locale.tsx +++ b/src/components/Locale/Locale.tsx @@ -42,6 +42,7 @@ import locale_UK from "@locale/uk.json"; import locale_VI from "@locale/vi.json"; import locale_ZH_HANS from "@locale/zh-Hans.json"; import locale_ZH_HANT from "@locale/zh-Hant.json"; +import useLocalStorage from "@saleor/hooks/useLocalStorage"; export enum Locale { AR = "ar", @@ -208,7 +209,8 @@ export const LocaleContext = React.createContext({ const { Consumer: LocaleConsumer, Provider: RawLocaleProvider } = LocaleContext; const LocaleProvider: React.FC = ({ children }) => { - const [locale, setLocale] = React.useState( + const [locale, setLocale] = useLocalStorage( + "locale", getMatchingLocale(navigator.languages) || defaultLocale ); From 0b93f853484437fa2f995413027f49780d53f3d1 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Fri, 18 Oct 2019 14:29:01 +0200 Subject: [PATCH 6/7] Capitalize choice label --- src/misc.ts | 4 ++++ src/staff/components/StaffPreferences/StaffPreferences.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/misc.ts b/src/misc.ts index 54dd931ee..883496397 100644 --- a/src/misc.ts +++ b/src/misc.ts @@ -332,3 +332,7 @@ export function parseBoolean(a: string): boolean { } return a === "true"; } + +export function capitalize(s: string) { + return s.charAt(0).toLocaleUpperCase() + s.slice(1); +} diff --git a/src/staff/components/StaffPreferences/StaffPreferences.tsx b/src/staff/components/StaffPreferences/StaffPreferences.tsx index 0400b3fb1..18c2b9f0a 100644 --- a/src/staff/components/StaffPreferences/StaffPreferences.tsx +++ b/src/staff/components/StaffPreferences/StaffPreferences.tsx @@ -6,6 +6,7 @@ import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import { Locale, localeNames } from "@saleor/components/Locale"; import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; +import { capitalize } from "@saleor/misc"; interface StaffPreferencesProps { locale: Locale; @@ -29,7 +30,7 @@ const StaffPreferences: React.StatelessComponent = ({ ({ - label: localeNames[locale], + label: capitalize(localeNames[locale]), value: locale }))} displayValue={localeNames[locale]} From f1a9bb137a14cb3979c3000c8b6742815d6aee3b Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Mon, 21 Oct 2019 13:14:33 +0200 Subject: [PATCH 7/7] Update stories --- .../__snapshots__/Stories.test.ts.snap | 184 +++++++++--------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 2472e45a1..0b79fc263 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -118581,98 +118581,6 @@ exports[`Storyshots Views / Staff / Staff member details default 1`] = ` -
-
-
- - Preferences - -
-
-
-
-
-
-
- - -

- Selecting this will change the language of your dashboard -

-
-
-
-
-
@@ -118893,6 +118801,98 @@ exports[`Storyshots Views / Staff / Staff member details himself 1`] = ` +
+
+
+ + Preferences + +
+
+
+
+
+
+
+ + +

+ Selecting this will change the language of your dashboard +

+
+
+
+
+