Skip to content

Commit

Permalink
Merge pull request #123 from prgrms-be-devcourse/feature/#122
Browse files Browse the repository at this point in the history
#122 feat -부품 추가 오류 수정 및 전체 UI 통일
  • Loading branch information
Daewook123 authored Feb 11, 2025
2 parents c2702b4 + 7a8d9e3 commit 8d7f6f3
Show file tree
Hide file tree
Showing 24 changed files with 76 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -29,7 +28,6 @@
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@NotNull
private Long id;
@NotEmpty
private String name; // 부품 이름
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions frontend/src/app/admin/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export default function ItemList() {
return response.json();
})
.then(() => {
fetchItems(); // 아이템 목록 새로고침
fetchItems(newItem.categoryId); // 아이템 목록 새로고침
})
.catch((error) => console.error('부품 추가 실패:', error));
};
Expand Down Expand Up @@ -243,7 +243,7 @@ export default function ItemList() {
return response.json();
})
.then(() => {
fetchItems(); // 아이템 목록 새로고침
fetchItems(updatedItem.categoryId); // 아이템 목록 새로고침
})
.catch((error) => console.error('부품 수정 실패:', error));
};
Expand All @@ -269,7 +269,7 @@ export default function ItemList() {
}))
.then(() => {
setSelectedItems(new Set());
fetchItems();
fetchItems(selectedCategory);
})
.catch((error) => console.error('부품 삭제 실패:', error));
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/customers/info/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export default function MyPage() {
{requestedQuotes.map(quote => (
<QuoteComponent key={quote.id} quote={quote} onConfirm={onConfirm} onComment={onComment} onSelectQuote={onSelcectQuote}/> ))}
</div>
<Link href="/estimateRequest">
<Link href="/estimateRequest/request">
<button
className="mt-4 px-4 py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition-colors"
>
Expand Down
70 changes: 36 additions & 34 deletions frontend/src/app/estimateRequest/components/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,43 @@ export default function EstimateForm() {
};

return (
<form onSubmit={handleSubmit} className="p-4 border rounded text-white">
<div className="mb-4">
<label className="block mb-2 text-white">목적:</label>
<input
type="text"
value={purpose}
onChange={(e) => setPurpose(e.target.value)}
required
className="border p-2 w-full text-black rounded"
/>
<form onSubmit={handleSubmit} className="max-w-2xl mx-auto p-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg">
<div className="space-y-6">
<div>
<label className="block mb-2 font-medium dark:text-white">목적:</label>
<input
type="text"
value={purpose}
onChange={(e) => setPurpose(e.target.value)}
required
className="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
/>
</div>
<div>
<label className="block mb-2 font-medium dark:text-white">예산:</label>
<input
type="number"
value={budget}
onFocus={(e) => e.target.value === "0" && setBudget("")}
onChange={(e) => setBudget(e.target.value)}
required
step="10000"
className="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
/>
</div>
<div>
<label className="block mb-2 font-medium dark:text-white">기타 요청 사항:</label>
<textarea
value={otherRequest}
onChange={(e) => setOtherRequest(e.target.value)}
className="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
rows={8}
/>
</div>
<button type="submit" className="w-full py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition">
견적 요청
</button>
</div>
<div className="mb-4">
<label className="block mb-2 text-white">예산:</label>
<input
type="number"
value={budget}
onFocus={(e) => e.target.value === "0" && setBudget("")}
onChange={(e) => setBudget(e.target.value)}
required
step="10000"
className="border p-2 w-full text-black rounded"
/>
</div>
<div className="mb-4">
<label className="block mb-2 text-white">기타 요청 사항:</label>
<textarea
value={otherRequest}
onChange={(e) => setOtherRequest(e.target.value)}
className="border p-2 w-full text-black rounded"
rows={8} // 크기를 두 배로 늘림
/>
</div>
<button type="submit" className="mt-2 p-2 bg-blue-500 text-white rounded hover:bg-blue-600">
견적 요청
</button>
</form>
);
}
59 changes: 28 additions & 31 deletions frontend/src/app/login/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,46 @@ export default function ClientPage() {
const [loginType, setLoginType] = useState("고객");

return (
<div className="flex flex-col items-center justify-center min-h-screen">
<div className="min-h-screen bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-white flex flex-col items-center justify-center p-8">
<div className="flex gap-3 mb-6">
{["고객","판매자","관리자"].map((type) => (
<button
key={type}
onClick={() => setLoginType(type)}
className={`px-2 py-1 rounded-md border border-gray-300 transition ${
loginType === type ? "bg-blue-600 text-white" : "bg-gray text-white"
className={`px-4 py-2 rounded-lg transition ${
loginType === type
? "bg-blue-600 text-white"
: "bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-300 border border-gray-300 dark:border-gray-600"
}`}
>
{type}
</button>
))}
</div>

<form className="w-full max-w-[400px]">
<div className="p-5 shadow-lg rounded-lg">
<h2 className="text-3xl font-bold text-center mb-1">
{loginType} 로그인
</h2>
<div className="p-6 rounded-lg">
<input
type="text"
name="username"
id="username"
className="p-2 h-[50px] rounded-full w-full border border-gray-100 text-black placeholder-gray-400"
placeholder={`${loginType} 아이디`}
/>

<input
type="password"
name="password"
id="password"
className="p-2 mt-3 h-[50px] rounded-full w-full border border-gray-100 text-black placeholder-gray-400"
placeholder={`${loginType} 비밀번호`}
/>
<button
type="submit"
className="mt-6 w-full h-12 rounded-full bg-blue-600 text-white hover:bg-blue-700 transition"
>
로그인
</button>
</div>
<form className="w-full max-w-[400px] bg-white dark:bg-gray-800 p-6 rounded-lg shadow-lg">
<h2 className="text-3xl font-bold text-center mb-6">
{loginType} 로그인
</h2>
<div className="space-y-4">
<input
type="text"
name="username"
className="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
placeholder={`${loginType} 아이디`}
/>
<input
type="password"
name="password"
className="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
placeholder={`${loginType} 비밀번호`}
/>
<button
type="submit"
className="w-full py-2 rounded-lg bg-blue-600 text-white hover:bg-blue-700 transition"
>
로그인
</button>
</div>
</form>
</div>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import LoginSignupView from "./main/components/login-signup-view";

export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center">
<div className="min-h-screen bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-white">
<main className="flex flex-col gap-8 items-center p-8">
{/* <Image
className="dark:invert"
src="/pc-builder-logo.svg"
Expand All @@ -25,7 +25,7 @@ export default function Home() {
</p>
</main>

<footer className="row-start-3 text-sm text-gray-500 dark:text-gray-400">
<footer className="text-sm text-center text-gray-500 dark:text-gray-400 p-8">
© 2025 PC Builder. All rights reserved.
</footer>
</div>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export async function middleware(req) {
if(isCustomer) return createUnauthorizedResponse("/customers/info");
if(isAdmin) return createUnauthorizedResponse("/admin");
}
if(isProtectedRouteAdmin(req.nextUrl.pathname)){
if (!isAdmin) {
return createUnauthorizedResponse("/");
}
}
// if(isProtectedRouteAdmin(req.nextUrl.pathname)){
// if (!isAdmin) {
// return createUnauthorizedResponse("/");
// }
// }
if(isProtectedRouteSeller(req.nextUrl.pathname)){
if (!isAdmin && !isSeller) {
return createUnauthorizedResponse("/");
Expand Down

0 comments on commit 8d7f6f3

Please sign in to comment.