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 type { ProcessedTrack } from '../model/track.types';
|
||||||
import { getShipKindColor } from '../lib/adapters';
|
import { getShipKindColor } from '../lib/adapters';
|
||||||
import { TRACK_REPLAY_LAYER_IDS } from './trackLayers';
|
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 {
|
interface ReplayTrip {
|
||||||
vesselId: string;
|
vesselId: string;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { IconLayer, PathLayer, ScatterplotLayer, TextLayer } from '@deck.gl/layers';
|
import { IconLayer, PathLayer, ScatterplotLayer, TextLayer } from '@deck.gl/layers';
|
||||||
import type { Layer, PickingInfo } from '@deck.gl/core';
|
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 { getCachedShipIcon } from '../../../widgets/map3d/lib/shipIconCache';
|
||||||
import { getShipKindColor } from '../lib/adapters';
|
import { getShipKindColor } from '../lib/adapters';
|
||||||
import type { CurrentVesselPosition, ProcessedTrack } from '../model/track.types';
|
import type { CurrentVesselPosition, ProcessedTrack } from '../model/track.types';
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {
|
|||||||
RadarLayer,
|
RadarLayer,
|
||||||
ColorRamp,
|
ColorRamp,
|
||||||
} from '@maptiler/weather';
|
} from '@maptiler/weather';
|
||||||
import { getMapTilerKey } from '../../widgets/map3d/lib/mapCore';
|
import { getMapTilerKey } from '../../shared/lib/map/mapTilerKey';
|
||||||
|
|
||||||
/** 6종 기상 레이어 ID */
|
/** 6종 기상 레이어 ID */
|
||||||
export type WeatherLayerId =
|
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;
|
const OVERLAY_SUSPICIOUS_RGB = OVERLAY_RGB.suspicious;
|
||||||
|
|
||||||
// ── Ship icon mapping (Deck.gl IconLayer) ──
|
// ── Ship icon mapping (Deck.gl IconLayer) ──
|
||||||
|
// Canonical source: shared/lib/map/mapConstants.ts (re-exported for local usage)
|
||||||
|
|
||||||
export const SHIP_ICON_MAPPING = {
|
export { SHIP_ICON_MAPPING } from '../../shared/lib/map/mapConstants';
|
||||||
ship: {
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width: 128,
|
|
||||||
height: 128,
|
|
||||||
anchorX: 64,
|
|
||||||
anchorY: 64,
|
|
||||||
mask: true,
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
// ── Ship constants ──
|
// ── Ship constants ──
|
||||||
|
|
||||||
@ -70,10 +61,8 @@ export const DECK_VIEW_ID = 'mapbox';
|
|||||||
|
|
||||||
// ── Depth params ──
|
// ── Depth params ──
|
||||||
|
|
||||||
export const DEPTH_DISABLED_PARAMS = {
|
// Canonical source: shared/lib/map/mapConstants.ts (re-exported for local usage)
|
||||||
depthCompare: 'always',
|
export { DEPTH_DISABLED_PARAMS } from '../../shared/lib/map/mapConstants';
|
||||||
depthWriteEnabled: false,
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const GLOBE_OVERLAY_PARAMS = {
|
export const GLOBE_OVERLAY_PARAMS = {
|
||||||
depthCompare: 'less-equal',
|
depthCompare: 'less-equal',
|
||||||
|
|||||||
@ -83,12 +83,8 @@ export function extractProjectionType(map: maplibregl.Map): MapProjectionId | un
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMapTilerKey(): string | null {
|
// Canonical source: shared/lib/map/mapTilerKey.ts (re-exported for local usage)
|
||||||
const k = import.meta.env.VITE_MAPTILER_KEY;
|
export { getMapTilerKey } from '../../../shared/lib/map/mapTilerKey';
|
||||||
if (typeof k !== 'string') return null;
|
|
||||||
const v = k.trim();
|
|
||||||
return v ? v : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getLayerId(value: unknown): string | null {
|
export function getLayerId(value: unknown): string | null {
|
||||||
if (!value || typeof value !== 'object') return null;
|
if (!value || typeof value !== 'object') return null;
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user