Skip to content

Commit

Permalink
[FE][Feat] #280 : GuestView ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
effozen committed Nov 26, 2024
1 parent 67e7de7 commit 7cbb086
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
22 changes: 15 additions & 7 deletions frontend/src/pages/AddChannel.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useEffect } from 'react';
import { useContext, useEffect, useState } from 'react';
import { HiMiniInformationCircle } from 'react-icons/hi2';
import { FooterContext } from '@/component/layout/footer/LayoutFooterProvider';
import { RouteSettingButton } from '@/component/routebutton/RouteSettingButton';
Expand Down Expand Up @@ -33,8 +33,8 @@ const Divider = () => <hr className="my-6 w-full border-gray-300" />;
*/

export const AddChannel = () => {
const [channelName, setChannelName] = useState<string>('');
const { users, setUsers } = useContext(UserContext);

const { setFooterTitle, setFooterTransparency, setFooterActive } = useContext(FooterContext);

/**
Expand All @@ -58,8 +58,8 @@ export const AddChannel = () => {
const newUser: IUser = {
id: users.length + 1,
name: `์‚ฌ์šฉ์ž${users.length + 1}`,
start_location: { lat: 0, lng: 0 }, // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ์ขŒํ‘œ
end_location: { lat: 0, lng: 0 }, // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ์ขŒํ‘œ
start_location: { title: '', lat: 0, lng: 0 }, // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ์ขŒํ‘œ
end_location: { title: '', lat: 0, lng: 0 }, // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ์ขŒํ‘œ
path: [], // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ๋ฐฐ์—ด
marker_style: { color: '' }, // ์ดˆ๊ธฐ๊ฐ’์œผ๋กœ ๋นˆ ๋ฌธ์ž์—ด
};
Expand Down Expand Up @@ -104,13 +104,17 @@ export const AddChannel = () => {
name: `์‚ฌ์šฉ์ž${index + 1}`,
}));
setUsers(updatedUsers);
localStorage.setItem('users', JSON.stringify(updatedUsers));
};

const handleChangeChannelName = (event: React.ChangeEvent<HTMLInputElement>) => {
setChannelName(event.target.value);
};

useEffect(() => {
setFooterTitle('์ œ์ž‘ ์™„๋ฃŒ');
setFooterTransparency(false);
setFooterActive(buttonActiveType.PASSIVE);
console.log(users);
}, []);

useEffect(() => {
Expand All @@ -127,7 +131,11 @@ export const AddChannel = () => {
return (
<main className="flex h-full w-full flex-col items-center px-8 py-16">
<Outlet />
<InputBox placeholder="๊ฒฝ๋กœ ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”. ex) ์•„๋“ค ์ง‘ ๊ฐ€๋Š” ๊ธธ" />
<InputBox
placeholder="๊ฒฝ๋กœ ์ด๋ฆ„์„ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”. ex) ์•„๋“ค ์ง‘ ๊ฐ€๋Š” ๊ธธ"
onChange={handleChangeChannelName}
value={channelName}
/>
<Divider />
<section className="w-full space-y-4">
{users.map(user => (
Expand All @@ -148,7 +156,7 @@ export const AddChannel = () => {
<section className="flex w-full justify-end">
<button
onClick={addUser}
className="bg-grayscale-25 border-gray-75 h-8 w-64 rounded border p-2 text-xs"
className="bg-grayscale-25 border-gray-75 font-nomal mr-8 h-8 w-64 rounded border p-2 text-xs"
>
์‚ฌ์šฉ์ž ์ถ”๊ฐ€
</button>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/pages/GuestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useLocation } from 'react-router-dom';
import { MapCanvasForView } from '@/component/canvasWithMap/canvasWithMapForView/MapCanvasForView.tsx';
import { IPoint } from '@/lib/types/canvasInterface.ts';
import { guestEntity } from '@/api/dto/channel.dto.ts';
import { UserMarker } from '@/component/userMarker/UserMarker.tsx';
// import { UserMarker } from '@/component/userMarker/UserMarker.tsx';

export const GuestView = () => {
const [guestInfo, setGuestInfo] = useState<IGuest>({
Expand All @@ -23,8 +23,8 @@ export const GuestView = () => {
const transformTypeGuestEntityToIGuest = (props: guestEntity): IGuest => {
return {
id: props.id ?? '',
// name: props.name ?? '',
name: 'ํ˜„์žฌ ๋‚ด ์œ„์น˜',
name: props.name ?? '',
// name: 'ํ˜„์žฌ ๋‚ด ์œ„์น˜',
startPoint: {
lat: props.start_location?.lat ?? 0,
lng: props.start_location?.lng ?? 0,
Expand Down Expand Up @@ -73,7 +73,7 @@ export const GuestView = () => {

return (
<article className="absolute h-full w-screen flex-grow overflow-hidden">
<UserMarker userData={[guestInfo]} />
{/* <UserMarker userData={[guestInfo]} /> */}
{component}
</article>
);
Expand Down

0 comments on commit 7cbb086

Please sign in to comment.