Skip to content

Commit

Permalink
๐Ÿ›fix(#93): ๋“œ๋ž˜๊ทธ์•ค๋“œ๋กญ
Browse files Browse the repository at this point in the history
  • Loading branch information
hyo-4 committed Nov 16, 2024
1 parent b32d5ab commit 3045997
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
7 changes: 6 additions & 1 deletion src/app/mypage/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ const MyPage = () => {
fetchGetCount();
}, []);

useEffect(() => {
if (name.length > 0 && email.length > 0) {
setLoading(false);
}
}, [name, email]);

const goToLetterType = () => {
router.push("/mypage/lettertype");
};
Expand Down Expand Up @@ -69,7 +75,6 @@ const MyPage = () => {
const response = await getLetterCount();
setLetterCount(response.data.letterCount);
setPlanetCount(response.data.spaceCount);
setLoading(false);
} catch (error) {
console.error("ํŽธ์ง€์ˆ˜, ํ–‰์„ฑ์ˆ˜ ์กฐํšŒ ์‹คํŒจ:", error);
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/planet/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const PlanetPage = () => {
console.log("๋ชจ๋“  ํŽธ์ง€ ์ˆ˜ ์กฐํšŒ ์„ฑ๊ณต:", response.data);
setCountLetter(response.data.letterCount);
setCurrentOrbits(response.data.content);
setIsLoading(false);

if (response.data.letterCount < 3 && getInitUserToast() !== "true") {
setShowTooltip(true);
setInitUserToast();
Expand Down Expand Up @@ -127,10 +127,8 @@ const PlanetPage = () => {
// });
// }
//setDroppedItem(null);
setIsLoading(false);
} catch (error) {
console.error("ํ–‰์„ฑ ํŽธ์ง€ ๋ชฉ๋ก ์กฐํšŒ ์‹คํŒจ:", error);
setIsLoading(false);
}
};

Expand All @@ -151,7 +149,6 @@ const PlanetPage = () => {
} catch (error) {
console.error("๋ฉ”์ธ ID ์กฐํšŒ ์‹คํŒจ:", error);
setSpaceInfo(null);
setIsLoading(false);

/* ๋ฉ”์ธ ID ์—†์„ ๊ฒฝ์šฐ ํšŒ์› ํƒˆํ‡ด๋กœ ๊ฐ„์ฃผ */
// router.push("/login");
Expand All @@ -166,6 +163,8 @@ const PlanetPage = () => {
} catch (error) {
console.error("๊ถค๋„ ํŽธ์ง€ ๋ชฉ๋ก ์กฐํšŒ ์‹คํŒจ:", error);
setOrbitMessages(null);
} finally {
setIsLoading(false);
}
};

Expand Down Expand Up @@ -695,4 +694,5 @@ const LoaderContainer = styled.div`
display: flex;
align-items: center;
justify-content: center;
background-color: ${theme.colors.bg};
`;
43 changes: 25 additions & 18 deletions src/components/common/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ const Tag = (props: TagProps) => {
const [editedName, setEditedName] = useState(name);
const [isHoldTriggered, setIsHoldTriggered] = useState<boolean>(false);
const [isDragging, setIsDragging] = useState<boolean>(false);
const [startPosition, setStartPosition] = useState<{
x: number;
y: number;
} | null>(null);
const startPositionRef = useRef<{ x: number; y: number }>({ x: 0, y: 0 });
const [translate, setTranslate] = useState({ x: 0, y: 0 });
const holdTimeout = useRef<NodeJS.Timeout | null>(null);
const tagRef = useRef<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -94,7 +91,7 @@ const Tag = (props: TagProps) => {

const handleDragEnd = () => {
setIsDragging(false);
setStartPosition(null);
startPositionRef.current = { x: 0, y: 0 };
};

const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -169,9 +166,13 @@ const Tag = (props: TagProps) => {
}
if (isDragable && tagType === "orbit") {
e.stopPropagation();
console.log("ํ„ฐ์น˜ ์‹œ์ž‘");
const touch = e.touches[0];
setStartPosition({ x: touch.clientX, y: touch.clientY });
console.log("ํ„ฐ์น˜ ์‹œ์ž‘", e.touches?.[0]);

const touch = e.touches?.[0];
if (touch) {
const position = { x: touch.clientX, y: touch.clientY };
startPositionRef.current = position;
}

e.currentTarget.addEventListener("touchmove", handleTouchMove, {
passive: false,
Expand All @@ -183,12 +184,14 @@ const Tag = (props: TagProps) => {
};

const handleTouchMove = (e: TouchEvent) => {
console.log("ํ„ฐ์น˜ ์›€์ง์ž„");
const startPosition = startPositionRef.current;
console.log("ํ„ฐ์น˜ ์›€์ง์ž„", startPosition);

if (startPosition) {
const touch = e.touches[0];
console.log(startPosition.x);
const deltaX = touch.clientX - 60;
const deltaY = touch.clientY - startPosition.y;

setTranslate({
x: touch.clientX - startPosition.x,
y: touch.clientY - startPosition.y,
Expand Down Expand Up @@ -377,25 +380,29 @@ const Box = styled.div<{
background: ${theme.colors.gray800};
${(props) => props.theme.fonts.body08};
display: flex;
${$hasEditIcon &&
css`
${
$hasEditIcon &&
css`
height: 47px;
padding: 9px 18px;
border-radius: 200px;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(2px);
${(props) => props.theme.fonts.title01};
gap: 4px;
`}
${$hasName === false &&
css`
`
}
${
$hasName === false &&
css`
padding: 7.5px 13px 7.5px 13px;
`}
`
}
`}
${({ $tagType, $orbitType }) =>
$tagType === "letter" &&
css`
$tagType === "letter" &&
css`
display: block;
max-width: 90px;
padding: ${$orbitType === "2" ? "7.5px 15px" : "11px 15px"};
Expand Down

0 comments on commit 3045997

Please sign in to comment.