Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import HelpButton from "@reearth/classic/components/atoms/HelpButton";
import Icon from "@reearth/classic/components/atoms/Icon";
import Text from "@reearth/classic/components/atoms/Text";
import ToggleButton from "@reearth/classic/components/atoms/ToggleButton";
import { DATAATTRIBUTION_BUILTIN_WIDGET_ID } from "@reearth/classic/components/molecules/Visualizer/Widget/builtin";
import { metricsSizes } from "@reearth/classic/theme";
import fonts from "@reearth/classic/theme/reearthTheme/common/fonts";
import useDoubleClick from "@reearth/classic/util/use-double-click";
Expand Down Expand Up @@ -86,6 +87,7 @@ const Layer: React.ForwardRefRenderFunction<HTMLDivElement, Props> = (
showLayerActions,
actionItems,
underlined,
id,
},
expanded,
selected,
Expand Down Expand Up @@ -132,6 +134,7 @@ const Layer: React.ForwardRefRenderFunction<HTMLDivElement, Props> = (
const [handleClick, handleDoubleClick] = useDoubleClick(onClick, startEditing);

const theme = useTheme();
const isDataAttribution = id?.includes(DATAATTRIBUTION_BUILTIN_WIDGET_ID);
Comment thread
airslice marked this conversation as resolved.

return (
<Wrapper
Expand Down Expand Up @@ -217,7 +220,7 @@ const Layer: React.ForwardRefRenderFunction<HTMLDivElement, Props> = (
/>
</HideableDiv>
)}
{deactivated !== undefined && (
{deactivated !== undefined && !isDataAttribution && (
<HideableDiv isVisible={isHover || selected} onClick={handleActivationChange}>
<ToggleButton size="sm" checked={!deactivated} parentSelected={selected} />
</HideableDiv>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import HelpButton from "@reearth/classic/components/atoms/HelpButton";
import Icon from "@reearth/classic/components/atoms/Icon";
import Text from "@reearth/classic/components/atoms/Text";
import { Layer } from "@reearth/classic/components/molecules/EarthEditor/LayerTreeViewItem/Layer";
import { DATAATTRIBUTION_BUILTIN_WIDGET_ID } from "@reearth/classic/components/molecules/Visualizer/Widget/builtin";
import { metricsSizes } from "@reearth/classic/theme";
import { useT } from "@reearth/services/i18n";
import { styled } from "@reearth/services/theme";
Expand Down Expand Up @@ -49,17 +50,22 @@ const LayerActionsList: React.FC<Props> = ({

useClickAway(wrapperRef, () => setVisibleMenu(false));

const isDataAttribution = selectedLayerId?.includes(DATAATTRIBUTION_BUILTIN_WIDGET_ID);

return (
<ActionWrapper
ref={wrapperRef}
onClick={e => {
e.stopPropagation();
}}>
<Action
disabled={!selectedLayerId}
onClick={() => onWarning?.(true) ?? (selectedLayerId && onRemove?.(selectedLayerId))}>
disabled={!selectedLayerId || isDataAttribution}
Comment thread
airslice marked this conversation as resolved.
Outdated
onClick={() => {
if (!selectedLayerId || isDataAttribution) return;
onWarning?.(true) ?? onRemove?.(selectedLayerId);
}}>
<HelpButton descriptionTitle={t("Delete the selected item.")} balloonDirection="top">
<StyledIcon icon="bin" size={16} disabled={!selectedLayerId} />
<StyledIcon icon="bin" size={16} disabled={!selectedLayerId || isDataAttribution} />
</HelpButton>
</Action>
<Action ref={referenceElement} onClick={() => setVisibleMenu(!visibleMenu)}>
Expand Down
Loading