Skip to content

Commit

Permalink
add events and rearrange sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Gupta authored and Rahul Gupta committed Sep 4, 2024
1 parent 2e260f9 commit c31267c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/editor/components/components/AdvancedComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import Component from './Component';
import DEFAULT_COMPONENTS from './DefaultComponents';
import { Button } from '../components';

import posthog from 'posthog-js';
const AdvancedComponents = ({ entity }) => {
const [showAdvanced, setShowAdvanced] = useState(false);

Expand All @@ -14,6 +14,7 @@ const AdvancedComponents = ({ entity }) => {
});

const toggleAdvanced = () => {
posthog.capture('toggleAdvanced', { showAdvanced });
setShowAdvanced(!showAdvanced);
};

Expand Down
32 changes: 19 additions & 13 deletions src/editor/components/components/GeoSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { Button } from '../components';
import Events from '../../lib/Events';
import AdvancedComponents from './AdvancedComponents';
import PropertyRow from './PropertyRow';
import posthog from 'posthog-js';

const GeoSidebar = ({ entity }) => {
const openGeoModal = () => {
posthog.capture('openGeoModalFromSidebar');
Events.emit('opengeomodal', { entity });
};

Expand All @@ -16,25 +18,12 @@ const GeoSidebar = ({ entity }) => {
<div className="geo-sidebar">
<div className="geo-controls">
<div className="details">
{component && component.schema && component.data && (
<PropertyRow
key="maps"
name="maps"
label="Map Source"
schema={component.schema['maps']}
data={component.data['maps']}
componentname="street-geo"
isSingle={false}
entity={entity}
/>
)}
<div className="propertyRow">
{entity && entity.components && entity.components['street-geo'] ? (
<>
<Button variant="toolbtn" onClick={openGeoModal}>
Change Location
</Button>
<AdvancedComponents entity={entity} />
</>
) : (
<div>
Expand All @@ -44,6 +33,23 @@ const GeoSidebar = ({ entity }) => {
</div>
)}
</div>
{component && component.schema && component.data && (
<PropertyRow
key="maps"
name="maps"
label="Map Source"
schema={component.schema['maps']}
data={component.data['maps']}
componentname="street-geo"
isSingle={false}
entity={entity}
/>
)}
{entity && entity.components && entity.components['street-geo'] && (
<div className="propertyRow">
<AdvancedComponents entity={entity} />
</div>
)}
</div>
</div>
</div>
Expand Down

0 comments on commit c31267c

Please sign in to comment.