Skip to content
2 changes: 2 additions & 0 deletions packages/visual-editor/locales/cs/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/da/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/de/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/en-GB/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/en/visual-editor.json
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
"missingHtmlWidget": "Add HTML to view component",
"monday": "Monday",
"name": "Name",
"nearbyLocationsEmptyState": "No {{entityType}} within {{radius}} miles",
"nearbyLocationsEmptyStateSectionHidden": "Section hidden for this {{entityType}}",
"noAvailableFields": "No available fields",
"noAvailableTypes": "No available types",
"noHeroFieldsMsg": "To use entity content for this section, add a Hero Section field to your page group's entity type.",
Expand Down
2 changes: 2 additions & 0 deletions packages/visual-editor/locales/es/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/et/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/fi/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/fr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/hr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/hu/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/it/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/ja/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/lt/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/lv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/nb/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/nl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/pl/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/pt/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/ro/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/sk/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/sv/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/tr/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/zh-TW/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/visual-editor/locales/zh/visual-editor.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ export const MapboxStaticMapComponent: PuckComponent<MapboxStaticProps> = ({
<Map className="w-12 h-12 text-gray-400" />
<div className="flex flex-col items-center gap-0">
<Body variant="base" className="text-gray-500 font-medium">
{t(
{pt(
"staticMapEmptyStateSectionHidden",
"Section hidden for all locations"
)}
</Body>
<Body variant="base" className="text-gray-500 font-normal">
{t(
{pt(
"staticMapEmptyStateAddApiKey",
"Add an API key to preview your map"
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
resolvePageSetUrlTemplate,
useTemplateProps,
mergeMeta,
pt,
} from "@yext/visual-editor";
import { useQuery } from "@tanstack/react-query";
import {
Expand All @@ -39,6 +40,8 @@ import {
import * as React from "react";
import { useTranslation } from "react-i18next";
import { StreamDocument } from "../../utils/applyTheme";
import { MapPinOff } from "lucide-react";
import { useTemplateMetadata } from "../../internal/hooks/useMessageReceivers";

export interface NearbyLocationsData {
/**
Expand Down Expand Up @@ -389,6 +392,7 @@ const NearbyLocationsComponent = ({
const streamDocument = useDocument();
const { t, i18n } = useTranslation();
const locale = i18n.language;
const templateMetadata = useTemplateMetadata();

const coordinate = resolveComponentData(
data?.coordinate,
Expand Down Expand Up @@ -470,12 +474,49 @@ const NearbyLocationsComponent = ({
}[styles.heading.align]
: "justify-start";

// do not render the component if there's no data or it's not enabled
// Show empty state in editor mode when there are no results
if (
!enableNearbyLocations ||
(!nearbyLocationsData?.response?.docs?.length &&
nearbyLocationsStatus != "pending")
) {
if (puck.isEditing) {
const entityTypeDisplayName =
templateMetadata?.entityTypeDisplayName?.toLowerCase();

return (
<PageSection background={styles?.backgroundColor}>
<div className="relative h-[300px] w-full bg-gray-100 rounded-lg border border-gray-200 flex flex-col items-center justify-center py-8 gap-2.5">
<MapPinOff className="w-12 h-12 text-gray-400" />
<div className="flex flex-col items-center gap-0">
<Body variant="base" className="text-gray-500 font-medium">
{pt(
"nearbyLocationsEmptyStateSectionHidden",
"Section hidden for this {{entityType}}",
{
entityType: entityTypeDisplayName
? entityTypeDisplayName
: "page",
}
)}
</Body>
<Body variant="base" className="text-gray-500 font-normal">
{pt(
"nearbyLocationsEmptyState",
"No {{entityType}} within {{radius}} miles",
{
entityType: entityTypeDisplayName
? entityTypeDisplayName
: "entity",
radius: data?.radius ?? 10,
}
)}
</Body>
</div>
</div>
</PageSection>
);
}
return <></>;
}

Expand Down