From f37b314380014561fa2f559203c3a23ea98cc6a2 Mon Sep 17 00:00:00 2001 From: HideBa Date: Fri, 17 Dec 2021 01:23:35 -0500 Subject: [PATCH] refine --- src/components/atoms/AutoComplete/index.tsx | 9 ++++++++- .../EarthEditor/TagPane/LayerTagPane/index.tsx | 3 +++ .../EarthEditor/TagPane/SceneTagPane/index.tsx | 8 +++++++- .../molecules/EarthEditor/TagPane/TagGroup/index.tsx | 3 +++ .../organisms/EarthEditor/RightMenu/index.tsx | 4 ++-- .../organisms/EarthEditor/TagPane/commonHooks.ts | 2 +- translations/en.yml | 12 ++++++++++-- translations/ja.yml | 8 ++++++++ 8 files changed, 42 insertions(+), 7 deletions(-) diff --git a/src/components/atoms/AutoComplete/index.tsx b/src/components/atoms/AutoComplete/index.tsx index e9eee42c6..126a54cd4 100644 --- a/src/components/atoms/AutoComplete/index.tsx +++ b/src/components/atoms/AutoComplete/index.tsx @@ -14,6 +14,7 @@ export type Item = { export type Props = { className?: string; + placeholder?: string; items?: Item[]; fullWidth?: boolean; creatable?: boolean; @@ -23,6 +24,7 @@ export type Props = { function AutoComplete({ className, + placeholder, items, fullWidth = false, creatable, @@ -70,7 +72,12 @@ function AutoComplete({ className={className} fullWidth={fullWidth} selectComponent={ - + } onChange={handleSelect} ref={ref} diff --git a/src/components/molecules/EarthEditor/TagPane/LayerTagPane/index.tsx b/src/components/molecules/EarthEditor/TagPane/LayerTagPane/index.tsx index d5defa8a6..6e950323f 100644 --- a/src/components/molecules/EarthEditor/TagPane/LayerTagPane/index.tsx +++ b/src/components/molecules/EarthEditor/TagPane/LayerTagPane/index.tsx @@ -1,4 +1,5 @@ import React, { useCallback } from "react"; +import { useIntl } from "react-intl"; import AutoComplete from "@reearth/components/atoms/AutoComplete"; import Box from "@reearth/components/atoms/Box"; @@ -37,6 +38,7 @@ const SceneTagPane: React.FC = ({ onTagGroupDetach, onTagItemDetach, }) => { + const intl = useIntl(); const handleTagGroupSelect = useCallback( (tagGroupLabel: string) => { const targetTagGroup = allTagGroups?.find(tg => tg.label === tagGroupLabel); @@ -64,6 +66,7 @@ const SceneTagPane: React.FC = ({ ))} = ({ onTagItemRemove, onTagGroupUpdate, }) => { + const intl = useIntl(); return ( {allTagGroups?.map(tg => ( @@ -52,7 +54,11 @@ const SceneTagPane: React.FC = ({ /> ))} - + ); }; diff --git a/src/components/molecules/EarthEditor/TagPane/TagGroup/index.tsx b/src/components/molecules/EarthEditor/TagPane/TagGroup/index.tsx index 84488e216..572820d9d 100644 --- a/src/components/molecules/EarthEditor/TagPane/TagGroup/index.tsx +++ b/src/components/molecules/EarthEditor/TagPane/TagGroup/index.tsx @@ -1,4 +1,5 @@ import React, { useCallback, useRef, useState, useMemo } from "react"; +import { useIntl } from "react-intl"; import { useClickAway } from "react-use"; import AutoComplete from "@reearth/components/atoms/AutoComplete"; @@ -46,6 +47,7 @@ const TagGroup: React.FC = ({ onTitleEdit, }) => { const theme = useTheme(); + const intl = useIntl(); const [editing, setEditing] = useState(false); const titleRef = useRef(null); useClickAway(titleRef, () => setEditing(false)); @@ -123,6 +125,7 @@ const TagGroup: React.FC = ({ onSelect={handleSelectTag} creatable onCreate={onTagAdd} + placeholder={intl.formatMessage({ defaultMessage: "Add a tag" })} /> ); diff --git a/src/components/organisms/EarthEditor/RightMenu/index.tsx b/src/components/organisms/EarthEditor/RightMenu/index.tsx index 37436bd3b..cee132655 100644 --- a/src/components/organisms/EarthEditor/RightMenu/index.tsx +++ b/src/components/organisms/EarthEditor/RightMenu/index.tsx @@ -10,9 +10,9 @@ import TagPane from "../TagPane"; import useHooks, { Tab } from "./hooks"; -const layerMode = ["property", "infobox", "export"]; +const layerMode = ["property", "infobox", "tag", "export"]; const widgetMode = ["property"]; -const sceneMode = ["property"]; +const sceneMode = ["property", "tag"]; export type LayerMode = typeof layerMode[number]; export type WidgetMode = typeof widgetMode[number]; export type SceneMode = typeof sceneMode[number]; diff --git a/src/components/organisms/EarthEditor/TagPane/commonHooks.ts b/src/components/organisms/EarthEditor/TagPane/commonHooks.ts index cb332a47c..3af5d9229 100644 --- a/src/components/organisms/EarthEditor/TagPane/commonHooks.ts +++ b/src/components/organisms/EarthEditor/TagPane/commonHooks.ts @@ -68,7 +68,7 @@ export default () => { const layerTagGroups = useMemo(() => { // TagItems which don't belong to any TagGroup will be in "Default" tag group - const defaultTagGroup: TagGroup = { id: "default", label: DEFAULT_TAG_ID, tags: [] }; + const defaultTagGroup: TagGroup = { id: DEFAULT_TAG_ID, label: "Default", tags: [] }; const formattedGroups: TagGroup[] = selectedLayerTags ? selectedLayerTags ?.map(t => { diff --git a/translations/en.yml b/translations/en.yml index 3eea12d2f..2cebf745f 100644 --- a/translations/en.yml +++ b/translations/en.yml @@ -166,6 +166,7 @@ src: '1835798571': Layers '2793623359': Widgets '3645414921': Delete + '4117491116': Clusters PropertyPane: '3453457092': Create Infobox '3833270271': Dataset @@ -260,6 +261,13 @@ src: project. '3869801582': Embed Code '4062044511': Update your project + TagPane: + LayerTagPane: + '1950319966': Add a tag group + SceneTagPane: + '1950319966': Add a tag group + TagGroup: + '1562483899': Add a tag Settings: Account: AccountSection: @@ -490,8 +498,8 @@ src: '2793623359': Widgets '3590336714': Export TagPane: - '1982056879': A tag with the same label already exist. Please input a different label and try again. - '4149491408': 'This tag group still has tags. You must remove all tags in the tag group before you can delete it.' + '1982056879': Same label tag already exist. Please type different label. + '4149491408': 'Tag group has tags, you need to remove all tags under the tag group' Notification: '687096634': Warning '1354606874': Notice diff --git a/translations/ja.yml b/translations/ja.yml index 5cdb6d1de..69acb412f 100644 --- a/translations/ja.yml +++ b/translations/ja.yml @@ -150,6 +150,7 @@ src: '1835798571': レイヤー '2793623359': ウィジェット '3645414921': 削除 + '4117491116': クラスター PropertyPane: '3453457092': インフォボックス作成 '3833270271': データセット @@ -234,6 +235,13 @@ src: '3733220817': URLを知っている人もこのプロジェクトを見ることができなくなります。 '3869801582': 埋め込み用コード '4062044511': プロジェクトを更新する + TagPane: + LayerTagPane: + '1950319966': タググループを追加 + SceneTagPane: + '1950319966': タググループを追加 + TagGroup: + '1562483899': タグを追加 Settings: Account: AccountSection: