Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/fsevents-patch-6b67494872-10c0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 6 additions & 2 deletions apps/nowait-admin/src/components/MobileAdminNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,21 @@ const MobileAdminNav = ({
<div className="flex flex-col justify-between h-full">
<ul className="flex flex-col gap-2">
{menuItems.map(({ label, icon, activeIcon, path }) => {
const isActive = pathname === path;
//주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증
if (label === "주문") {
path = `/admin/orders/${storeId}`;
}
const isActive = pathname === path;
Comment on lines 59 to +64
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Avoid mutating the destructured path variable.

Reassigning the path variable that comes from destructuring is confusing and violates clean code principles. Instead, compute the actual path in a separate variable to maintain clarity.

Apply this diff to use a separate variable:

         {menuItems.map(({ label, icon, activeIcon, path }) => {
-          //주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증
+          // 주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증
+          const actualPath = label === "주문" ? `/admin/orders/${storeId}` : path;
-          if (label === "주문") {
-            path = `/admin/orders/${storeId}`;
-          }
-          const isActive = pathname === path;
+          const isActive = pathname === actualPath;
           return (
             <li
               key={label}
               className={`flex items-center gap-3 px-3 py-2 rounded-md text-title-18-semibold ${
                 isActive ? "bg-[#f5f5f5] text-black" : "text-black-50"
               }`}
-              onClick={() => {
-                navigate(path);
-                onClose();
-              }}
+              onClick={() => {
+                navigate(actualPath);
+                onClose();
+              }}
             >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{menuItems.map(({ label, icon, activeIcon, path }) => {
const isActive = pathname === path;
//주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증
if (label === "주문") {
path = `/admin/orders/${storeId}`;
}
const isActive = pathname === path;
{menuItems.map(({ label, icon, activeIcon, path }) => {
// 주문의 경우 클릭시 경로에 storeId가 붙기 때문에 추가 검증
const actualPath = label === "주문" ? `/admin/orders/${storeId}` : path;
const isActive = pathname === actualPath;
return (
<li
key={label}
className={`flex items-center gap-3 px-3 py-2 rounded-md text-title-18-semibold ${
isActive ? "bg-[#f5f5f5] text-black" : "text-black-50"
}`}
onClick={() => {
navigate(actualPath);
onClose();
}}
>
🤖 Prompt for AI Agents
In apps/nowait-admin/src/components/MobileAdminNav.tsx around lines 59 to 64,
the code mutates the destructured path variable for the "주문" menu item which is
confusing; instead compute a new variable (e.g., resolvedPath or itemPath) that
sets `/admin/orders/${storeId}` when label === "주문" otherwise uses the original
path, then use that new variable for active-checking and any navigation so the
destructured props remain immutable and intent is clear.

return (
<li
key={label}
className={`flex items-center gap-3 px-3 py-2 rounded-md text-title-18-semibold ${
isActive ? "bg-[#f5f5f5] text-black" : "text-black-50"
}`}
onClick={() => navigate(path)}
onClick={() => {
navigate(path);
onClose();
}}
>
{isActive ? (
<img src={activeIcon} alt={label} className="w-5 h-5" />
Expand Down
42 changes: 42 additions & 0 deletions apps/nowait-admin/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,45 @@ input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
display: none;
}

input[type="range"] {
-webkit-appearance: none;
appearance: none;

width: 100%;
height: 6px;
border-radius: 4px;
outline: none;

/* 왼쪽 = #222 / 오른쪽 = 연회색 */
background: linear-gradient(to right, #222 var(--value, 0%), #e5e7eb 0%);
}

input[type="range"]::-webkit-slider-runnable-track {
background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 14px;
height: 14px;
background: #222;
border-radius: 50%;
cursor: pointer;
margin-top: -1px;
}

/* Firefox */
/* input[type="range"]::-moz-range-thumb {
width: 14px;
height: 14px;
background: #3b82f6;
border-radius: 50%;
cursor: pointer;
}
input[type="range"]::-moz-range-track {
background: #d1d5db;
height: 6px;
border-radius: 4px;
} */
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import PreviewModal from "./Modal/PreviewModal";
import { useDeleteBannerImage } from "../../../hooks/booth/menu/useDeleteBannerImage";
import { useRemoveEmoji } from "../../../hooks/useRemoveEmoji";
import ImageCropModal from "./Modal/ImageCropModal";
import { useWindowWidth } from "../../../hooks/useWindowWidth";

const BoothSection = ({
location,
Expand Down Expand Up @@ -69,6 +70,7 @@ const BoothSection = ({
isMobile: boolean;
}) => {
const [showPreview, setShowPreview] = useState(false);
const width = useWindowWidth();
const { mutate: deleteBannerImage } = useDeleteBannerImage();
const { removeEmojiAll } = useRemoveEmoji();
const [cropSpec, setCropSpec] = useState<{
Expand Down Expand Up @@ -406,7 +408,7 @@ const BoothSection = ({
setNotice={setBoothNotice}
/>

{cropSpec && (
{cropSpec && width > 1279 && (
<ImageCropModal
file={cropSpec.file}
aspect={cropSpec.aspect}
Expand All @@ -416,11 +418,7 @@ const BoothSection = ({
quality={0.95}
onDone={handleCropDone}
onClose={() => setCropSpec(null)}
title={
cropSpec.target === "profile"
? "프로필 이미지 1:1 자르기"
: "배너 이미지 375:246 자르기"
}
title={"이미지 편집하기"}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export default function ImageCropModal({

return (
<div className="fixed inset-0 z-[1000] flex items-center justify-center bg-black/60">
<div className="w-full max-w-[520px] rounded-2xl bg-white p-4">
<div className="w-full max-w-[520px] rounded-2xl bg-white py-4 px-5">
<div className="mb-3 text-16-semibold">{title}</div>

<div className="relative h-[360px] w-full overflow-hidden rounded-xl bg-black">
<div className="relative h-[360px] w-full overflow-hidden rounded-xl bg-black cropper-wrapper">
<Cropper
image={url}
crop={crop}
Expand All @@ -95,7 +95,12 @@ export default function ImageCropModal({
max={6}
step={0.01}
value={zoom}
onChange={(e) => setZoom(Number(e.target.value))}
onChange={(e) => {
const v = Number(e.target.value);
setZoom(v);
const percent = ((v - 1) / (6 - 1)) * 100;
e.target.style.setProperty("--value", `${percent}%`);
}}
/>
</div>

Expand Down
Loading