refactor: FSD 위반 해소 — 공유 상수/함수를 shared/로 이동
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
부모
3fa0b67e97
커밋
ec9d894ac8
@ -3,7 +3,7 @@ import type { Layer } from '@deck.gl/core';
|
||||
import type { ProcessedTrack } from '../model/track.types';
|
||||
import { getShipKindColor } from '../lib/adapters';
|
||||
import { TRACK_REPLAY_LAYER_IDS } from './trackLayers';
|
||||
import { DEPTH_DISABLED_PARAMS } from '../../../widgets/map3d/constants';
|
||||
import { DEPTH_DISABLED_PARAMS } from '../../../shared/lib/map/mapConstants';
|
||||
|
||||
interface ReplayTrip {
|
||||
vesselId: string;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { IconLayer, PathLayer, ScatterplotLayer, TextLayer } from '@deck.gl/layers';
|
||||
import type { Layer, PickingInfo } from '@deck.gl/core';
|
||||
import { DEPTH_DISABLED_PARAMS, SHIP_ICON_MAPPING } from '../../../widgets/map3d/constants';
|
||||
import { DEPTH_DISABLED_PARAMS, SHIP_ICON_MAPPING } from '../../../shared/lib/map/mapConstants';
|
||||
import { getCachedShipIcon } from '../../../widgets/map3d/lib/shipIconCache';
|
||||
import { getShipKindColor } from '../lib/adapters';
|
||||
import type { CurrentVesselPosition, ProcessedTrack } from '../model/track.types';
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
RadarLayer,
|
||||
ColorRamp,
|
||||
} from '@maptiler/weather';
|
||||
import { getMapTilerKey } from '../../widgets/map3d/lib/mapCore';
|
||||
import { getMapTilerKey } from '../../shared/lib/map/mapTilerKey';
|
||||
|
||||
/** 6종 기상 레이어 ID */
|
||||
export type WeatherLayerId =
|
||||
|
||||
20
apps/web/src/shared/lib/map/mapConstants.ts
Normal file
20
apps/web/src/shared/lib/map/mapConstants.ts
Normal file
@ -0,0 +1,20 @@
|
||||
// ── Shared map constants ──
|
||||
// Moved from widgets/map3d/constants.ts to resolve FSD layer violation
|
||||
// (features/ must not import from widgets/).
|
||||
|
||||
export const SHIP_ICON_MAPPING = {
|
||||
ship: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 128,
|
||||
height: 128,
|
||||
anchorX: 64,
|
||||
anchorY: 64,
|
||||
mask: true,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const DEPTH_DISABLED_PARAMS = {
|
||||
depthCompare: 'always',
|
||||
depthWriteEnabled: false,
|
||||
} as const;
|
||||
9
apps/web/src/shared/lib/map/mapTilerKey.ts
Normal file
9
apps/web/src/shared/lib/map/mapTilerKey.ts
Normal file
@ -0,0 +1,9 @@
|
||||
// Moved from widgets/map3d/lib/mapCore.ts to resolve FSD layer violation
|
||||
// (features/ must not import from widgets/).
|
||||
|
||||
export function getMapTilerKey(): string | null {
|
||||
const k = import.meta.env.VITE_MAPTILER_KEY;
|
||||
if (typeof k !== 'string') return null;
|
||||
const v = k.trim();
|
||||
return v ? v : null;
|
||||
}
|
||||
@ -15,18 +15,9 @@ const OVERLAY_FLEET_RANGE_RGB = OVERLAY_RGB.fleetRange;
|
||||
const OVERLAY_SUSPICIOUS_RGB = OVERLAY_RGB.suspicious;
|
||||
|
||||
// ── Ship icon mapping (Deck.gl IconLayer) ──
|
||||
// Canonical source: shared/lib/map/mapConstants.ts (re-exported for local usage)
|
||||
|
||||
export const SHIP_ICON_MAPPING = {
|
||||
ship: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 128,
|
||||
height: 128,
|
||||
anchorX: 64,
|
||||
anchorY: 64,
|
||||
mask: true,
|
||||
},
|
||||
} as const;
|
||||
export { SHIP_ICON_MAPPING } from '../../shared/lib/map/mapConstants';
|
||||
|
||||
// ── Ship constants ──
|
||||
|
||||
@ -70,10 +61,8 @@ export const DECK_VIEW_ID = 'mapbox';
|
||||
|
||||
// ── Depth params ──
|
||||
|
||||
export const DEPTH_DISABLED_PARAMS = {
|
||||
depthCompare: 'always',
|
||||
depthWriteEnabled: false,
|
||||
} as const;
|
||||
// Canonical source: shared/lib/map/mapConstants.ts (re-exported for local usage)
|
||||
export { DEPTH_DISABLED_PARAMS } from '../../shared/lib/map/mapConstants';
|
||||
|
||||
export const GLOBE_OVERLAY_PARAMS = {
|
||||
depthCompare: 'less-equal',
|
||||
|
||||
@ -83,12 +83,8 @@ export function extractProjectionType(map: maplibregl.Map): MapProjectionId | un
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getMapTilerKey(): string | null {
|
||||
const k = import.meta.env.VITE_MAPTILER_KEY;
|
||||
if (typeof k !== 'string') return null;
|
||||
const v = k.trim();
|
||||
return v ? v : null;
|
||||
}
|
||||
// Canonical source: shared/lib/map/mapTilerKey.ts (re-exported for local usage)
|
||||
export { getMapTilerKey } from '../../../shared/lib/map/mapTilerKey';
|
||||
|
||||
export function getLayerId(value: unknown): string | null {
|
||||
if (!value || typeof value !== 'object') return null;
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user