feat(travel): 좌표 없는 커스텀 지역에 항상 "위치 지정" 버튼 표시
지역 변경 직후뿐 아니라, 앨범의 지역이 좌표 미지정 커스텀 지역이면 헤더에 핀 버튼을 상시 노출. 기존 좌표가 있으면 RegionPinPicker에 초기값으로 전달. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -189,6 +189,31 @@ export default function AlbumDetail({
|
|||||||
|
|
||||||
/* ── Derived ── */
|
/* ── Derived ── */
|
||||||
const regionAccent = getRegionAccent(album?.region || album?.id || '');
|
const regionAccent = getRegionAccent(album?.region || album?.id || '');
|
||||||
|
|
||||||
|
// Determine if the album's region is a custom region missing coordinates
|
||||||
|
const currentRegionId = savedRegionId || album?.region || album?.id || '';
|
||||||
|
const needsPin = useMemo(() => {
|
||||||
|
if (!currentRegionId || !regions?.features) return false;
|
||||||
|
const feature = regions.features.find((f) => {
|
||||||
|
const rid = f.properties?.id || f.properties?.name || '';
|
||||||
|
return rid.toLowerCase() === currentRegionId.toLowerCase();
|
||||||
|
});
|
||||||
|
if (!feature) return true; // region not in GeoJSON at all → needs pin
|
||||||
|
if (feature.properties?.custom && !feature.geometry) return true; // custom without coords
|
||||||
|
return false;
|
||||||
|
}, [currentRegionId, regions]);
|
||||||
|
|
||||||
|
// Coords of existing pin (for initialCoords in picker)
|
||||||
|
const existingCoords = useMemo(() => {
|
||||||
|
if (!currentRegionId || !regions?.features) return null;
|
||||||
|
const feature = regions.features.find((f) => {
|
||||||
|
const rid = f.properties?.id || f.properties?.name || '';
|
||||||
|
return rid.toLowerCase() === currentRegionId.toLowerCase();
|
||||||
|
});
|
||||||
|
if (feature?.geometry?.type === 'Point') return feature.geometry.coordinates;
|
||||||
|
return null;
|
||||||
|
}, [currentRegionId, regions]);
|
||||||
|
|
||||||
const photoCountLabel = photoSummary?.total
|
const photoCountLabel = photoSummary?.total
|
||||||
? `${photoSummary.total} photos`
|
? `${photoSummary.total} photos`
|
||||||
: photos?.length
|
: photos?.length
|
||||||
@@ -323,7 +348,7 @@ export default function AlbumDetail({
|
|||||||
<path d="M7.5 1.5l1 1-5.5 5.5H2V7z" stroke="currentColor" strokeWidth="0.8" strokeLinejoin="round"/>
|
<path d="M7.5 1.5l1 1-5.5 5.5H2V7z" stroke="currentColor" strokeWidth="0.8" strokeLinejoin="round"/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
{regionMsg?.type === 'ok' && savedRegionId && (
|
{(needsPin || (regionMsg?.type === 'ok' && savedRegionId)) && (
|
||||||
<button
|
<button
|
||||||
className="album-detail__pin-btn"
|
className="album-detail__pin-btn"
|
||||||
onClick={handleOpenPinPicker}
|
onClick={handleOpenPinPicker}
|
||||||
@@ -349,11 +374,11 @@ export default function AlbumDetail({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Pin Picker */}
|
{/* Pin Picker */}
|
||||||
{pinPickerOpen && savedRegionId && (
|
{pinPickerOpen && currentRegionId && (
|
||||||
<RegionPinPicker
|
<RegionPinPicker
|
||||||
regionId={savedRegionId}
|
regionId={currentRegionId}
|
||||||
regionName={savedRegionId}
|
regionName={album?.regionName || currentRegionId}
|
||||||
initialCoords={null}
|
initialCoords={existingCoords}
|
||||||
accent={regionAccent}
|
accent={regionAccent}
|
||||||
onSave={handlePinSave}
|
onSave={handlePinSave}
|
||||||
onClose={() => setPinPickerOpen(false)}
|
onClose={() => setPinPickerOpen(false)}
|
||||||
|
|||||||
Reference in New Issue
Block a user