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

refactor(web): remove api key input for google map photorealistics [VIZ-1411] #1524

Merged
merged 4 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"@monaco-editor/react": "4.6.0",
"@popperjs/core": "2.11.8",
"@radix-ui/react-slot": "1.1.0",
"@reearth/core": "0.0.7-alpha.33",
"@reearth/core": "0.0.7-alpha.34",
"@rot1024/use-transition": "1.0.0",
"@sentry/browser": "7.77.0",
"@seznam/compose-react-refs": "1.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
SubmitWrapper,
Wrapper,
InputsWrapper,
ContentWrapper,
LinkWrapper
ContentWrapper
} from "@reearth/beta/features/Editor/Map/shared/SharedComponent";
import { Button, RadioGroup, TextInput } from "@reearth/beta/lib/reearth-ui";
import { useT } from "@reearth/services/i18n";
Expand All @@ -26,38 +25,8 @@ const ThreeDTiles: FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {

const [value, setValue] = useState("");
const [sourceType, setSourceType] = useState<SourceType>("osm-buildings");
const [googleMapsApiKey, setGoogleMapsApiKey] = useState("");
const googlePhotorealistic = sourceType === "google-photorealistic";

const renderGooglePhotorealisticInput = useMemo(() => {
if (googlePhotorealistic) {
return (
<InputGroup
label={
<>
{t("Google Maps API Key ")} ( {t("You can apply a key ")}
<LinkWrapper
to="https://developers.google.com/maps/documentation/javascript/get-api-key"
target="_blank"
rel="noopener noreferrer"
>
{t("here")}
</LinkWrapper>
)
</>
}
>
<InputsWrapper>
<TextInput
value={googleMapsApiKey}
onChange={(value) => setGoogleMapsApiKey(value)}
/>
</InputsWrapper>
</InputGroup>
);
} else return undefined;
}, [googleMapsApiKey, googlePhotorealistic, t]);

const renderUrlInput = useMemo(() => {
if (sourceType === "url") {
return (
Expand All @@ -79,22 +48,20 @@ const ThreeDTiles: FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
{ label: t("Cesium OSM 3D Tiles"), value: "osm-buildings" },
{
label: t("Google Photorealistic 3D Tiles"),
value: "google-photorealistic",
children: renderGooglePhotorealisticInput
value: "google-photorealistic"
},
{
label: t("URL"),
value: "url",
children: renderUrlInput
}
],
[renderGooglePhotorealisticInput, renderUrlInput, t]
[renderUrlInput, t]
);

const handleDataSourceTypeChange = useCallback((newValue: string) => {
setSourceType(newValue as SourceType);
setValue("");
setGoogleMapsApiKey("");
}, []);

const title = useMemo(() => {
Expand All @@ -116,13 +83,6 @@ const ThreeDTiles: FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
config: {
data: {
url: value !== "" ? value : undefined,
...(googlePhotorealistic
? {
serviceTokens: {
googleMapApiKey: googleMapsApiKey || undefined
}
}
: {}),
type:
sourceType === "osm-buildings"
? "osm-buildings"
Expand Down Expand Up @@ -150,10 +110,7 @@ const ThreeDTiles: FC<DataProps> = ({ sceneId, onSubmit, onClose }) => {
title={t("Add to Layer")}
appearance="primary"
onClick={handleSubmit}
disabled={
(!value && sourceType === "url") ||
(!googleMapsApiKey && googlePhotorealistic)
}
disabled={!value && sourceType === "url"}
/>
</SubmitWrapper>
</Wrapper>
Expand Down
3 changes: 0 additions & 3 deletions web/src/services/i18n/translations/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ Vector Tile: ''
3D Tiles: ''
Data Source Manager: ''
Support for the KML format is currently experimental and remains somewhat unstable, with certain features not yet fully supported. We advise using it with caution.: ''
'Google Maps API Key ': ''
'You can apply a key ': ''
here: ''
Cesium OSM 3D Tiles: ''
Google Photorealistic 3D Tiles: ''
URL: ''
Expand Down
3 changes: 0 additions & 3 deletions web/src/services/i18n/translations/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ Vector Tile: ベクトルタイル
Data Source Manager: データソースマネージャー
Support for the KML format is currently experimental and remains somewhat unstable, with certain features not yet fully supported. We advise using it with caution.: >-
KMLフォーマットのサポートは現在、実験的な段階にあり、安定性に欠ける部分があります。また、いくつかの機能はまだ完全にはサポートされていません。ご利用の際はご注意ください。
'Google Maps API Key ': Google Maps APIキー
'You can apply a key ': キーを申請できます
here: ここ
Cesium OSM 3D Tiles: Cesium OSM 3Dタイル
Google Photorealistic 3D Tiles: Googleフォトリアリスティック3Dタイル
URL: URL
Expand Down
10 changes: 5 additions & 5 deletions web/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8528,9 +8528,9 @@ __metadata:
languageName: node
linkType: hard

"@reearth/core@npm:0.0.7-alpha.33":
version: 0.0.7-alpha.33
resolution: "@reearth/core@npm:0.0.7-alpha.33"
"@reearth/core@npm:0.0.7-alpha.34":
version: 0.0.7-alpha.34
resolution: "@reearth/core@npm:0.0.7-alpha.34"
dependencies:
"@radix-ui/react-checkbox": "npm:1.1.1"
"@radix-ui/react-dialog": "npm:1.1.1"
Expand Down Expand Up @@ -8585,7 +8585,7 @@ __metadata:
cesium: 1.118.x
react: ^18.2.0
react-dom: ^18.2.0
checksum: 10c0/27ba9da0dfba01b1b999eb3f70b61decf74d54f51a5e6a66384b11ae9b8440f9820f9ad5dc90d5e6d32621315c44aa03be9d683f42ae2c2315e55152af49105e
checksum: 10c0/876bcae133be09b0360c23517c0fe1a8df2df908d2cbb93f7ff3f75b72f9896389445dd0f60e4e99803559e07d591a5617632d518a4ddcb66e50e5e475a38c14
languageName: node
linkType: hard

Expand Down Expand Up @@ -8634,7 +8634,7 @@ __metadata:
"@playwright/test": "npm:1.46.1"
"@popperjs/core": "npm:2.11.8"
"@radix-ui/react-slot": "npm:1.1.0"
"@reearth/core": "npm:0.0.7-alpha.33"
"@reearth/core": "npm:0.0.7-alpha.34"
"@rollup/plugin-yaml": "npm:4.1.2"
"@rot1024/use-transition": "npm:1.0.0"
"@sentry/browser": "npm:7.77.0"
Expand Down
Loading