Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function App() {
<Routes>
{/* ๊ณตํ†ต ํŽ˜์ด์ง€ */}
<Route path="/" element={<NoticeList />} />
<Route path=":id" element={<Notice />} />
<Route path=":shopId/:userId" element={<Notice />} />
<Route path="login" element={<Login />} />
<Route path="signup" element={<Signup />} />

Expand All @@ -32,7 +32,7 @@ export default function App() {
</Route>
<Route path="post">
<Route index element={<StoreForm />} />
<Route path=":id" element={<StorePost />} />
<Route path=":shopId/:userId" element={<StorePost />} />
</Route>
</Route>

Expand Down
23 changes: 19 additions & 4 deletions src/components/common/Post.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavigate, useLocation } from 'react-router-dom';
import formatWorkTime from '@/utils/formatWorkTime';
import ClockRed from '@/assets/icons/clock-red.svg';
import ClockGray from '@/assets/icons/clock-gray.svg';
Expand Down Expand Up @@ -26,15 +27,17 @@ function getStatus(

export default function Post({ data }: { data: NoticeShopItem }) {
const {
id: noticeId,
hourlyPay,
workhour,
startsAt,
closed,
shop: {
item: { name, address1, imageUrl, originalHourlyPay },
item: { id: shopId, name, address1, imageUrl, originalHourlyPay },
},
} = data;

const navigate = useNavigate();
const location = useLocation();
const status = getStatus(startsAt, closed);
const isInactive = status !== 'ACTIVE';
const overlayText = isInactive
Expand Down Expand Up @@ -79,8 +82,20 @@ export default function Post({ data }: { data: NoticeShopItem }) {
}
}

const handleClick = () => {
const isOwnerPage = location.pathname.startsWith('/owner');

const path = isOwnerPage
? `/owner/post/${shopId}/${noticeId}`
: `/${shopId}/${noticeId}`;
Comment on lines +86 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๐Ÿ’ฌ ์ด๋ ‡๊ฒŒ ๋œ๋‹ค๋ฉด ํ˜„์žฌ ์‚ฌ์žฅ ํŽ˜์ด์ง€์— ์žˆ๋‹ค๊ฐ€ ๋‹ค๋ฅธ notice ๊ฒฝ๋กœ๋ฅผ ์น˜๊ณ  ๋“ค์–ด๊ฐ€๋ฉด ๋‚จ์˜ ์ง€์› ๋ชฉ๋ก์ด ํฌํ•จ๋œ ๊ณต๊ณ  ์ƒ์„ธ ํŽ˜์ด์ง€๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์ง€ ์•Š์„๊นŒ์š”? ๊ฐ€์žฅ ์ข‹์€ ๋ฐฉ๋ฒ•์€ userId๋ฅผ ๊ฐ€์ง€๊ณ  ๊ถŒํ•œ?์„ ํŒ๋‹จํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๊ฒ ์ง€๋งŒ ์–ด๋ ค์šธ ๊ฑฐ ๊ฐ™์•„์„œ... ๊ทธ๋ƒฅ ์™ธ๋ถ€์—์„œ ์ด๋™ํ•  ๊ฒฝ๋กœ๋ฅผ ์ปจํŠธ๋กค ํ•˜๊ฑฐ๋‚˜ ํ•˜๋Š” ๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!

Copy link
Collaborator Author

@Yun-Jinwoo Yun-Jinwoo Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ทธ์œผ ์ด๊ฑฐ๋Š” post ์ปดํฌ๋„ŒํŠธ ํด๋ฆญ ์ด๋ฒคํŠธ๋ผ ์ง์ ‘ ์ฃผ์†Œ๋ฅผ ์น˜๊ณ  ๊ฐ€๋Š” ๋™์ž‘์€ ๊ด€๋ จ์ด ์—†๊ณ ,
๋ง์”€ํ•˜์‹  ๋ถ€๋ถ„์€ ํ•ด๋‹น ํŽ˜์ด์ง€ ๋‚ด์—์„œ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒŒ ๋งž์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.


navigate(path);
};
return (
<div className="flex h-261 w-full cursor-pointer flex-col gap-12 rounded-xl border border-gray-20 bg-white p-12 md:h-359 md:gap-20 md:p-16 lg:h-348">
<button
onClick={handleClick}
className="flex h-261 w-full cursor-pointer flex-col gap-12 rounded-xl border border-gray-20 bg-white p-12 md:h-359 md:gap-20 md:p-16 lg:h-348"
>
<div className="relative">
<div
className="relative h-84 w-full rounded-xl bg-cover bg-center md:h-171 lg:h-160"
Expand Down Expand Up @@ -152,6 +167,6 @@ export default function Post({ data }: { data: NoticeShopItem }) {
)}
</div>
</div>
</div>
</button>
);
}
2 changes: 1 addition & 1 deletion src/pages/store/StoreForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default function StoreForm() {
const handleModalConfirm = useCallback(() => {
if (modal.message === '๋“ฑ๋ก์ด ์™„๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.') {
setModal({ isOpen: false, message: '' });
navigate(`/owner/post/${noticeId.current}`);
navigate(`/owner/post/${shopId.current}/${noticeId.current}`);
} else if (modal.message.includes('๋กœ๊ทธ์ธ')) {
setModal({ isOpen: false, message: '' });
navigate('/login');
Expand Down