)}
- {isCompModalOpen && (
-
- )}
+ {isCompModalOpen &&
}
);
}
@@ -157,13 +156,65 @@ const Info = styled.div`
/* background-color: #d9d9d9; */
`;
+const TitleFireContainer = styled.div`
+ display: flex;
+ justify-content: space-between;
+ width: 242px;
+ margin-top: 12px;
+`;
+
const Title = styled.div`
- font-size: 20px;
+ font-size: 18px;
font-weight: bolder;
- margin-top: 12px;
/* border: 2px solid red; */
`;
+const Fire = styled.div`
+ font-size: 14px;
+ display: flex;
+`;
+
+const FireContainer = styled.div`
+ position: relative;
+ display: flex;
+ align-items: center;
+ margin-bottom: 3px;
+
+ &:hover div {
+ display: block;
+ }
+`;
+
+const Tooltip = styled.div`
+ display: none;
+ position: absolute;
+ bottom: -34px;
+ left: 50%;
+ transform: translateX(-50%);
+ width: max-content;
+ padding: 8px;
+ background-color: white;
+ text-align: center;
+ border-radius: 4px;
+ font-size: 12px;
+ z-index: 4;
+ box-shadow: 2px 6px 12px rgba(0, 0, 0, 0.12), 0 0 4px rgba(0, 0, 0, 0.12);
+
+ &:before {
+ content: "";
+ border-color: white transparent;
+ border-style: solid;
+ border-width: 0 6px 8px 6.5px;
+ display: block;
+ left: 50%;
+ transform: translateX(-50%);
+ position: absolute;
+ top: -5px;
+ width: 0;
+ z-index: 4;
+ }
+`;
+
const Period = styled.div`
display: flex;
font-size: 16px;
@@ -179,7 +230,11 @@ const Period = styled.div`
}
`;
-const StartDate = styled.div``;
+const StartDate = styled.div`
+ height: 24px;
+ display: flex;
+ align-items: center;
+`;
const DueDate = styled.div``;
@@ -223,8 +278,7 @@ const Accomplished = styled.button`
margin-bottom: 16px;
border-radius: 8px;
/* background-color: transparent; */
- background-color: ${(props) =>
- props.status === "OPEN" ? "transparent" : "#EEF1FF"};
+ background-color: ${(props) => (props.status === "OPEN" ? "transparent" : "#EEF1FF")};
cursor: pointer;
font-weight: bold;
diff --git a/src/homepage/component/goals/Goals.jsx b/src/homepage/component/goals/Goals.jsx
index df4efd4..3ebcce3 100644
--- a/src/homepage/component/goals/Goals.jsx
+++ b/src/homepage/component/goals/Goals.jsx
@@ -12,13 +12,12 @@ import getGoalList from "../../../apis/getGoalList";
import { tokenState } from "../../../atom/atom";
import { useRecoilState } from "recoil";
import GoalDoesNotExistImg from "../../../asset/Icon/GoalDoesNotExist.svg";
-
+import GoalDoesNotExistPink from "../../../asset/Icon/GoalDoesNotExistPink.svg";
import img1 from "../../../asset/Random/random1.svg";
import img2 from "../../../asset/Random/random2.svg";
import GoalCreatedModal from "./CreateGoalModal/GoalCreatedModal";
+
const backgroundArr = [img1, img2];
-// const randomIndex = Math.floor(Math.random() * backgroundArr.length);
-// const backgroundImg = backgroundArr[randomIndex];
function Goals() {
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -33,7 +32,7 @@ function Goals() {
const [csrfToken, setCsrfToken] = useRecoilState(tokenState);
useEffect(() => {
- if (!csrfToken) return; // 토큰이 없으면 API 호출하지 않음
+ if (!csrfToken) return;
const fetchGoalList = async () => {
try {
const fetchedGoalList = await getGoalList(csrfToken);
@@ -41,8 +40,8 @@ function Goals() {
console.log("Fetched goalList:", fetchedGoalList);
} catch (error) {
if (error.response && error.response.status === 401) {
- setCsrfToken(null); // 401 에러 발생 시 토큰 초기화
- navigate("/"); // 로그인 페이지로 이동
+ setCsrfToken(null);
+ navigate("/");
} else {
console.error("Error fetching goal list", error);
}
@@ -70,7 +69,7 @@ function Goals() {
const isExpired = (endDate) => {
if (!endDate) return false;
let [year, month, day] = endDate.split(".").map(Number);
- year += year < 50 ? 2000 : 1900; // 50을 기준으로 2000년대와 1900년대 구분
+ year += year < 50 ? 2000 : 1900;
const goalDate = new Date(year, month - 1, day);
return goalDate < today;
};
@@ -78,7 +77,7 @@ function Goals() {
const getDaysLeft = (endDate) => {
if (!endDate) return null;
let [year, month, day] = endDate.split(".").map(Number);
- year += year < 50 ? 2000 : 1900; // 50을 기준으로 2000년대와 1900년대 구분
+ year += year < 50 ? 2000 : 1900;
const goalDate = new Date(year, month - 1, day);
const diffTime = goalDate - today;
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
@@ -116,7 +115,7 @@ function Goals() {
목표 추가하기
- {!isLoading && filteredGoals.length === 0 && (
+ {!isLoading && filteredGoals.length === 0 && currentTab !== "완료한 도전" && (
)}
+ {!isLoading && filteredGoals.length === 0 && currentTab === "완료한 도전" && (
+
+
+
+
작은 목표부터 시작해서
+
하나씩 채워나가봐요!
+
+
+
곧 이곳이 당신의 성취로
가득 찰 거예요!
+
+
+ )}
{filteredGoals.map((goal) => {
const randomIndex = Math.floor(Math.random() * backgroundArr.length);
@@ -162,9 +192,6 @@ function Goals() {
) : (
)}
- {/* */}
@@ -383,7 +410,7 @@ const TitleFireContainer = styled.div`
`;
const Title = styled.div`
- font-size: 20px;
+ font-size: 18px;
font-weight: bolder;
margin-bottom: 3px;
`;
@@ -400,7 +427,7 @@ const FireContainer = styled.div`
`;
const Fire = styled.div`
- font-size: 18px;
+ font-size: 14px;
display: flex;
`;