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
2 changes: 1 addition & 1 deletion closet/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.5 on 2025-02-08 07:32
# Generated by Django 5.1.5 on 2025-02-09 06:03

from django.db import migrations, models

Expand Down
2 changes: 1 addition & 1 deletion closet/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 5.1.5 on 2025-02-08 07:32
# Generated by Django 5.1.5 on 2025-02-09 06:03

import django.db.models.deletion
from django.conf import settings
Expand Down
4 changes: 4 additions & 0 deletions closet/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
path('upload-history/', views.upload_history, name="upload_history"),


path('mycloset/', views.mycloset_view, name="mycloset_view"),
path("mycloset/category/<int:category_id>/", views.category_detail_view, name="category_detail"),


]


51 changes: 51 additions & 0 deletions closet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,3 +1176,54 @@ def generate_cody_recommendation(request):
# image_url = request.session.get("uploaded_image_url", None)
# return render(request, 'closet/test_image_result.html', {"image_url": image_url})




#나만의 옷장 카테고리별 분류
@login_required
def mycloset_view(request):
user = request.user
categories = UserCategory.objects.filter(user_id=user.id)

category_data = []

for category in categories:
outfits = (
MyCloset.objects.filter(user_id=user.id, user_category_id=category.id)
.select_related("outfit")
.order_by("created_at")[:3]
)
images = [outfit.outfit.image.url if outfit.outfit and outfit.outfit.image else "/static/images/mycloset/default.jpg" for outfit in outfits]

while len(images) < 3:
images.append("/static/images/mycloset/mycloset_background.svg")

category_data.append(
{
"category_id": category.id,
"category_name": category.name,
"images": images,
}
)

return render(request, "closet/mycloset/mycloset.html", {"categories": category_data})




def category_detail_view(request, category_id):
user = request.user
category = get_object_or_404(UserCategory, id=category_id, user_id=user.id)

outfits = MyCloset.objects.filter(user_id=user.id, user_category_id=category_id).select_related("outfit")

items = [
{
"id": outfit.id,
"image": outfit.outfit.image.url if outfit.outfit and outfit.outfit.image else "/static/images/mycloset/default.jpg",
"created_at": outfit.created_at.strftime("%Y-%m-%d %H:%M:%S"),
}
for outfit in outfits
]

return render(request, "closet/mycloset/mycloset_category_detail.html", {"category_name": category.name, "items": items})
2 changes: 1 addition & 1 deletion config/sitemaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def location(self, obj):
sitemaps = {
'static': StaticViewSitemap,
'outfits': OutfitSitemap,
}
}
163 changes: 82 additions & 81 deletions static/base.css
Original file line number Diff line number Diff line change
@@ -1,122 +1,123 @@
main {
width: 90%;
padding-bottom: 4rem;
/* bottom-nav 높이만큼 여백 */
margin: 0 auto;
/* 가운데 정렬 */
box-sizing: border-box;
min-height: 100vh;
overflow-y: auto;
/* 세로 스크롤 허용 */
overflow-x: hidden;
/* 가로 스크롤 방지 */
scrollbar-width: none;
/* Firefox에서 스크롤바 숨김 */
padding-block: 4rem;
width: 100%;
padding-inline: 0;
padding-bottom: 4rem;
/* bottom-nav 높이만큼 여백 */
margin: 0 auto;
/* 가운데 정렬 */
box-sizing: border-box;
min-height: 100vh;
overflow-y: auto;
/* 세로 스크롤 허용 */
overflow-x: hidden;
/* 가로 스크롤 방지 */
scrollbar-width: none;
/* Firefox에서 스크롤바 숨김 */
padding-block: 4rem;
}

/* Chrome, Safari, Edge에서 스크롤바 숨기기 */
main::-webkit-scrollbar {
display: none;
display: none;
}

header {
background-image: url('/static/images/top-nav-background.svg');
background-size: cover;
/* 배경 이미지가 요소를 덮도록 설정 */
background-position: center;
/* 배경 이미지가 중앙 정렬되도록 설정 */
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
position: fixed;
top: 0;
z-index: 10;
width: 100%;
max-width: 600px;
background-image: url("/static/images/top-nav-background.svg");
background-size: cover;
/* 배경 이미지가 요소를 덮도록 설정 */
background-position: center;
/* 배경 이미지가 중앙 정렬되도록 설정 */
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
position: fixed;
top: 0;
z-index: 10;
width: 100%;
max-width: 600px;
}

nav {
height: 4rem;
padding-inline: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
height: 4rem;
padding-inline: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
}
nav a img {
height: 2rem;
height: 2rem;
}
ul {
display: flex;
align-items: center;
display: flex;
align-items: center;
}
.logout {
margin-bottom: 8px;
color: #b2b2b2;
font-family: Inter;
font-size: 0.9375rem;
font-style: normal;
font-weight: 600;
line-height: 180%;
/* 1.6875rem */
margin-bottom: 8px;
color: #b2b2b2;
font-family: Inter;
font-size: 0.9375rem;
font-style: normal;
font-weight: 600;
line-height: 180%;
/* 1.6875rem */
}
ul > a > img {
padding-inline: 0.5rem;
padding-inline: 0.5rem;
}
.bottom-nav {
position: fixed;
bottom: 0;
z-index: 10;
width: 100%;
max-width: 600px;
position: fixed;
bottom: 0;
z-index: 10;
width: 100%;
max-width: 600px;
}
.bottomNav {
height: 3.4375rem; /* 55px */
z-index: 10;
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding-inline: 3rem;
border-top: 1px solid var(--color-gray-very-light);
height: 3.4375rem; /* 55px */
z-index: 10;
background-color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding-inline: 3rem;
border-top: 1px solid var(--color-gray-very-light);
}

/* 네비게이션 아이콘 크기 조정 */
.nav-icon {
width: 1.5625rem; /* 25px */
height: auto;
width: 1.5625rem; /* 25px */
height: auto;
}

.nav-icon.large {
width: 2.5rem; /* 40px */
height: auto;
width: 2.5rem; /* 40px */
height: auto;
}

/* 현재 페이지 아이콘 스타일 */
.nav-icon.active {
filter: brightness(0); /* 이미지를 검정색으로 변경 */
filter: brightness(0); /* 이미지를 검정색으로 변경 */
}

.bug-report {
bottom: 3.4375rem; /* 55px */
position: fixed;
right: 20px;
/* bottom-nav 높이만큼 띄움 */
z-index: 9;
/* bottom-nav보다 낮은 z-index */
padding: 6px 10px;
font-size: 11px;
background-color: rgba(155, 27, 27, 0.8);
/* 약간 투명하게 */
color: white;
text-decoration: none;
border-radius: 4px;
font-weight: 500;
transition: all 0.3s ease;
opacity: 0.7;
/* 기본 상태는 약간 투명하게 */
bottom: 3.4375rem; /* 55px */
position: fixed;
right: 20px;
/* bottom-nav 높이만큼 띄움 */
z-index: 9;
/* bottom-nav보다 낮은 z-index */
padding: 6px 10px;
font-size: 11px;
background-color: rgba(155, 27, 27, 0.8);
/* 약간 투명하게 */
color: white;
text-decoration: none;
border-radius: 4px;
font-weight: 500;
transition: all 0.3s ease;
opacity: 0.7;
/* 기본 상태는 약간 투명하게 */
}

.bug-report:hover {
opacity: 1;
/* 호버 시 완전 불투명하게 */
background-color: rgb(155, 27, 27);
opacity: 1;
/* 호버 시 완전 불투명하게 */
background-color: rgb(155, 27, 27);
}
Loading