mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
move useI18n to i18n.ts
Since we are using the react-i18n babel loader plugin, useI18n can only be used once per file. Also we have to remember to add the istanbul ignore next comment each time we use it. By moving this to a common file, it can be easily copied and pasted when a new submodule is created and we don't have to remember the rules when calling it.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// Copyright (c) 2022 The Pybricks Authors
|
||||
|
||||
import { Button, Classes, Dialog } from '@blueprintjs/core';
|
||||
import { useI18n } from '@shopify/react-i18n';
|
||||
import React, { useCallback, useRef, useState } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useFileStorageMetadata } from '../../fileStorage/hooks';
|
||||
@@ -13,11 +12,10 @@ import {
|
||||
import { useSelector } from '../../reducers';
|
||||
import FileNameFormGroup from '../fileNameFormGroup/FileNameFormGroup';
|
||||
import { duplicateFileDialogDidAccept, duplicateFileDialogDidCancel } from './actions';
|
||||
import { I18nId } from './i18n';
|
||||
import { I18nId, useI18n } from './i18n';
|
||||
|
||||
const DuplicateFileDialog: React.VFC = () => {
|
||||
// istanbul ignore next: babel-loader rewrites this line
|
||||
const [i18n] = useI18n();
|
||||
const i18n = useI18n();
|
||||
const dispatch = useDispatch();
|
||||
const isOpen = useSelector((s) => s.explorer.duplicateFileDialog.isOpen);
|
||||
const oldName = useSelector((s) => s.explorer.duplicateFileDialog.fileName);
|
||||
|
||||
Reference in New Issue
Block a user