diff --git a/frontend/src/__mocks__/mockData.ts b/frontend/src/__mocks__/mockData.ts index 07a6e910c..c440be244 100644 --- a/frontend/src/__mocks__/mockData.ts +++ b/frontend/src/__mocks__/mockData.ts @@ -30,7 +30,7 @@ export const guestMaps: GuestMaps = { mapName: 'GUEST_TEST_MAP', mapDrawing: '{"width":800,"height":600,"mapElements":[{"id":2,"type":"rect","stroke":"#333333","points":["210,90","650,230"]},{"id":3,"type":"rect","stroke":"#333333","width":440,"height":140,"x":210,"y":90,"points":["210, 90","650, 230"]}]}', - mapImageUrl: '', + thumbnail: '', sharingMapId: 'JMTGR', }, }; diff --git a/frontend/src/api/managerMap.ts b/frontend/src/api/managerMap.ts index 66156414a..a6f3243c1 100644 --- a/frontend/src/api/managerMap.ts +++ b/frontend/src/api/managerMap.ts @@ -14,14 +14,14 @@ export interface QueryManagerMapParams { interface PostMapParams { mapName: string; mapDrawing: string; - mapImageSvg: string; + thumbnail: string; } interface PutMapParams { mapId: number; mapName: string; mapDrawing: string; - mapImageSvg: string; + thumbnail: string; } interface DeleteMapParams { @@ -53,17 +53,17 @@ export const queryManagerMap: QueryFunction< export const postMap = ({ mapName, mapDrawing, - mapImageSvg, + thumbnail, }: PostMapParams): Promise> => - api.post('/managers/maps', { mapName, mapDrawing, mapImageSvg }); + api.post('/managers/maps', { mapName, mapDrawing, thumbnail }); export const putMap = ({ mapId, mapName, mapDrawing, - mapImageSvg, + thumbnail, }: PutMapParams): Promise> => - api.put(`/managers/maps/${mapId}`, { mapName, mapDrawing, mapImageSvg }); + api.put(`/managers/maps/${mapId}`, { mapName, mapDrawing, thumbnail }); export const deleteMap = ({ mapId }: DeleteMapParams): Promise> => api.delete(`/managers/maps/${mapId}`); diff --git a/frontend/src/api/managerSpace.ts b/frontend/src/api/managerSpace.ts index d5e3cf39d..deafb44ec 100644 --- a/frontend/src/api/managerSpace.ts +++ b/frontend/src/api/managerSpace.ts @@ -21,7 +21,7 @@ export interface PostManagerSpaceParams { description: string; area: string; settingsRequest: ReservationSettings; - mapImageSvg: string; + thumbnail: string; }; } @@ -32,7 +32,7 @@ export interface PutManagerSpaceParams extends PostManagerSpaceParams { export interface DeleteManagerSpaceParams { mapId: number; spaceId: number; - mapImageSvg: string; + thumbnail: string; } export const queryManagerSpaces: QueryFunction< @@ -71,6 +71,6 @@ export const putManagerSpace = ({ export const deleteManagerSpace = ({ mapId, spaceId, - mapImageSvg, + thumbnail, }: DeleteManagerSpaceParams): Promise> => - api.delete(`/managers/maps/${mapId}/spaces/${spaceId}`, { data: { mapImageSvg } }); + api.delete(`/managers/maps/${mapId}/spaces/${spaceId}`, { data: { thumbnail } }); diff --git a/frontend/src/components/MapListItem/MapListItem.stories.tsx b/frontend/src/components/MapListItem/MapListItem.stories.tsx index 75b8dc3a3..a6023ef2e 100644 --- a/frontend/src/components/MapListItem/MapListItem.stories.tsx +++ b/frontend/src/components/MapListItem/MapListItem.stories.tsx @@ -10,10 +10,7 @@ export default { const Template: Story = (args) => ; -const thumbnail = { - src: './images/luther.png', - alt: '루터회관 14F 공간', -}; +const thumbnail = ` `; export const Default = Template.bind({}); Default.args = { diff --git a/frontend/src/components/MapListItem/MapListItem.styles.ts b/frontend/src/components/MapListItem/MapListItem.styles.ts index 3d1246522..897d6ad23 100644 --- a/frontend/src/components/MapListItem/MapListItem.styles.ts +++ b/frontend/src/components/MapListItem/MapListItem.styles.ts @@ -28,11 +28,10 @@ export const ImageInner = styled.div` display: flex; justify-content: center; align-items: center; -`; -export const Image = styled.img` - max-width: 100%; - max-height: 100%; + svg { + z-index: -1; + } `; export const TitleWrapper = styled.div` diff --git a/frontend/src/components/MapListItem/MapListItem.tsx b/frontend/src/components/MapListItem/MapListItem.tsx index 02971cd47..b6bf4956a 100644 --- a/frontend/src/components/MapListItem/MapListItem.tsx +++ b/frontend/src/components/MapListItem/MapListItem.tsx @@ -1,12 +1,8 @@ -import { ReactNode, useState } from 'react'; -import MapDefault from 'assets/images/map-default.jpg'; +import { ReactNode } from 'react'; import * as Styled from './MapListItem.styles'; export interface Props { - thumbnail: { - src: string; - alt: string; - }; + thumbnail: string; title: string; control?: ReactNode; selected?: boolean; @@ -20,23 +16,10 @@ const MapListItem = ({ selected = false, onClick = () => null, }: Props): JSX.Element => { - const [thumbnailSrc, setThumbnailSrc] = useState(thumbnail.src); - - const onImgError = () => { - setThumbnailSrc(MapDefault); - }; - return ( - - - + {title} diff --git a/frontend/src/pages/ManagerMain/units/MapDrawer.tsx b/frontend/src/pages/ManagerMain/units/MapDrawer.tsx index e8a3a67a2..74a925d69 100644 --- a/frontend/src/pages/ManagerMain/units/MapDrawer.tsx +++ b/frontend/src/pages/ManagerMain/units/MapDrawer.tsx @@ -32,11 +32,11 @@ const MapDrawer = ({ {organization} - {maps.map(({ mapId, mapName, mapImageUrl }) => ( + {maps.map(({ mapId, mapName, thumbnail }) => ( onSelectMap(mapId, mapName)} - thumbnail={{ src: mapImageUrl, alt: mapName }} + thumbnail={thumbnail} title={mapName} selected={mapId === selectedMapId} control={ diff --git a/frontend/src/pages/ManagerMapEditor/ManagerMapEditor.tsx b/frontend/src/pages/ManagerMapEditor/ManagerMapEditor.tsx index 9f497811f..d7663f202 100644 --- a/frontend/src/pages/ManagerMapEditor/ManagerMapEditor.tsx +++ b/frontend/src/pages/ManagerMapEditor/ManagerMapEditor.tsx @@ -129,7 +129,7 @@ const ManagerMapEditor = (): JSX.Element => { mapElements: mapElements.map(({ ref, ...props }) => props), }); - const mapImageSvg = createMapImageSvg({ + const thumbnail = createMapImageSvg({ mapElements, spaces, width, @@ -137,12 +137,12 @@ const ManagerMapEditor = (): JSX.Element => { }); if (isEdit) { - updateMap.mutate({ mapId: Number(mapId), mapName: name, mapDrawing, mapImageSvg }); + updateMap.mutate({ mapId: Number(mapId), mapName: name, mapDrawing, thumbnail }); return; } - createMap.mutate({ mapName: name, mapDrawing, mapImageSvg }); + createMap.mutate({ mapName: name, mapDrawing, thumbnail }); }; useListenManagerMainState({ mapId: Number(mapId) }, { enabled: isEdit }); diff --git a/frontend/src/pages/ManagerSpaceEditor/units/Form.tsx b/frontend/src/pages/ManagerSpaceEditor/units/Form.tsx index bde12ddb3..869a9f025 100644 --- a/frontend/src/pages/ManagerSpaceEditor/units/Form.tsx +++ b/frontend/src/pages/ManagerSpaceEditor/units/Form.tsx @@ -67,13 +67,13 @@ const Form = ({ const handleSubmit: FormEventHandler = (event) => { event.preventDefault(); - const mapImageSvg = generateSvg({ ...mapData, spaces: getSpacesForSvg() }); + const thumbnail = generateSvg({ ...mapData, spaces: getSpacesForSvg() }); const valuesForRequest = getRequestValues(); if (selectedSpaceId === null) { onCreateSpace({ space: { - mapImageSvg, + thumbnail, ...valuesForRequest.space, settingsRequest: { ...valuesForRequest.space.settings }, }, @@ -85,7 +85,7 @@ const Form = ({ onUpdateSpace({ spaceId: selectedSpaceId, space: { - mapImageSvg, + thumbnail, ...valuesForRequest.space, settingsRequest: { ...valuesForRequest.space.settings }, }, @@ -97,11 +97,11 @@ const Form = ({ if (!window.confirm(MESSAGE.MANAGER_SPACE.DELETE_SPACE_CONFIRM)) return; const filteredSpaces = spaces.filter(({ id }) => id !== selectedSpaceId); - const mapImageSvg = generateSvg({ ...mapData, spaces: filteredSpaces }); + const thumbnail = generateSvg({ ...mapData, spaces: filteredSpaces }); onDeleteSpace({ spaceId: selectedSpaceId, - mapImageSvg, + thumbnail, }); resetForm(); diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts index 0978e0a75..db230c4c5 100644 --- a/frontend/src/types/common.ts +++ b/frontend/src/types/common.ts @@ -40,7 +40,7 @@ export interface MapItem { mapId: number; mapName: string; mapDrawing: MapDrawing; - mapImageUrl: string; + thumbnail: string; sharingMapId: string; }