Skip to content

Commit 0b32def

Browse files
authored
Merge pull request #212 from part3-4team-Taskify/minji
[Refactor] 사파리 대응 세로스크롤 방지 목적 window innerHeight 기준 높이 계산식 추가
2 parents 573148d + 1892356 commit 0b32def

File tree

11 files changed

+47
-11
lines changed

11 files changed

+47
-11
lines changed

src/components/Layouts/DashboardLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const DashboardLayout = ({
1616
dashboardId,
1717
}: DashboardLayoutProps) => {
1818
return (
19-
<div className="flex h-screen overflow-hidden">
19+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
2020
<SideMenu teamId={TEAM_ID} dashboardList={dashboardList} />
2121
<div className="flex flex-col flex-1">
2222
<HeaderDashboard variant="dashboard" dashboardId={dashboardId} />

src/components/button/GuestModeButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default function GuestModeButton() {
2424
router.push("/mydashboard");
2525
toast.success("게스트 모드로 로그인되었습니다.");
2626
} catch (error) {
27+
console.error("게스트 로그인 실패:", error);
2728
toast.error("게스트 로그인에 실패했습니다.");
2829
}
2930
};

src/components/sideMenu/SideMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default function SideMenu({
6565
return (
6666
<aside
6767
className={clsx(
68-
"z-20 flex flex-col h-screen overflow-y-auto lg:overflow-y-hidden overflow-x-hidden transition-all duration-200",
68+
"z-20 flex flex-col h-[calc(var(--vh)_*_100)] overflow-y-auto lg:overflow-y-hidden overflow-x-hidden transition-all duration-200",
6969
"bg-white border-r border-[var(--color-gray3)] py-5",
7070
isCollapsed
7171
? "w-[67px] items-center px-0"

src/pages/404.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Custom404() {
1717
}, [router]);
1818

1919
return (
20-
<div className="flex flex-col items-center justify-center text-center h-screen bg-[var(--color-gray5)] gap-2">
20+
<div className="flex flex-col items-center justify-center text-center h-[calc(var(--vh)_*_100)] bg-[var(--color-gray5)] gap-2">
2121
<h1 className="font-24b text-[var(--primary)]">404 Not Found</h1>
2222
<p className="font-16r text-black3">페이지를 찾을 수 없습니다.</p>
2323
<p className="font-16r text-black3">5초 후 홈페이지로 이동합니다.</p>

src/pages/_app.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
4747
initializeUser();
4848
}, []);
4949

50+
// 윈도우 기준 높이 사용
51+
useEffect(() => {
52+
const setVH = () => {
53+
const vh = window.innerHeight * 0.01;
54+
document.documentElement.style.setProperty("--vh", `${vh}px`);
55+
};
56+
57+
setVH();
58+
window.addEventListener("resize", setVH);
59+
60+
return () => {
61+
window.removeEventListener("resize", setVH);
62+
};
63+
}, []);
64+
5065
const router = useRouter();
5166
const pathname = router.pathname;
5267

src/pages/dashboard/[dashboardId]/edit.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { getDashboards } from "@/api/dashboards";
1111
import DeleteDashboardModal from "@/components/modal/DeleteDashboardModal";
1212
import { DashboardType } from "@/types/task";
1313
import { TEAM_ID } from "@/constants/team";
14+
import LoadingSpinner from "@/components/common/LoadingSpinner";
1415

1516
export default function EditDashboard() {
1617
const router = useRouter();
@@ -47,8 +48,12 @@ export default function EditDashboard() {
4748
}
4849
}, [isInitialized, user]);
4950

51+
if (!isInitialized || !user) {
52+
return <LoadingSpinner />;
53+
}
54+
5055
return (
51-
<div className="flex h-screen overflow-hidden">
56+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
5257
<SideMenu
5358
teamId={TEAM_ID}
5459
dashboardList={dashboardList}

src/pages/dashboard/[dashboardId]/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import ColumnsButton from "@/components/button/ColumnsButton";
1818
import AddColumnModal from "@/components/columnCard/AddColumnModal";
1919
import { TEAM_ID } from "@/constants/team";
2020
import { toast } from "react-toastify";
21+
import LoadingSpinner from "@/components/common/LoadingSpinner";
2122

2223
export default function Dashboard() {
2324
const router = useRouter();
@@ -100,8 +101,12 @@ export default function Dashboard() {
100101
(db) => db.id === Number(dashboardId)
101102
);
102103

104+
if (!isInitialized || !user) {
105+
return <LoadingSpinner />;
106+
}
107+
103108
return (
104-
<div className="flex h-screen min-h-screen">
109+
<div className="flex h-[calc(var(--vh)_*_100)]">
105110
<SideMenu
106111
teamId={TEAM_ID}
107112
dashboardList={dashboardList}

src/pages/login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default function LoginPage() {
4444
};
4545

4646
return (
47-
<div className="flex flex-col items-center justify-center h-screen bg-white py-10">
47+
<div className="flex flex-col items-center justify-center h-[calc(var(--vh)_*_100)] bg-white py-10">
4848
<div className="flex flex-col items-center justify-center mb-[30px]">
4949
<Image
5050
src="/svgs/main-logo.svg"

src/pages/mydashboard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { DeleteModal } from "@/components/modal/DeleteModal";
1313
import { TEAM_ID } from "@/constants/team";
1414
import { Search } from "lucide-react";
1515
import { toast } from "react-toastify";
16+
import LoadingSpinner from "@/components/common/LoadingSpinner";
1617

1718
import {
1819
DndContext,
@@ -132,8 +133,12 @@ export default function MyDashboardPage() {
132133
setDashboardList(newOrder);
133134
};
134135

136+
if (!isInitialized || !user) {
137+
return <LoadingSpinner />;
138+
}
139+
135140
return (
136-
<div className="flex h-screen overflow-hidden bg-[var(--color-violet5)]">
141+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden bg-[var(--color-violet5)]">
137142
<SideMenu
138143
teamId={TEAM_ID}
139144
dashboardList={dashboardList}

src/pages/mypage.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ import BackButton from "@/components/button/BackButton";
88
import { Dashboard, getDashboards } from "@/api/dashboards";
99
import { TEAM_ID } from "@/constants/team";
1010
import { toast } from "react-toastify";
11+
import LoadingSpinner from "@/components/common/LoadingSpinner";
1112

1213
export default function MyPage() {
1314
const { user, isInitialized } = useAuthGuard();
1415
const [dashboards, setDashboards] = useState<Dashboard[]>([]);
1516

17+
if (!isInitialized || !user) {
18+
return <LoadingSpinner />;
19+
}
20+
1621
// 사이드메뉴 대시보드 목록 api 호출
1722
const fetchDashboards = async () => {
1823
try {
@@ -25,13 +30,13 @@ export default function MyPage() {
2530
};
2631

2732
useEffect(() => {
28-
if (isInitialized) {
33+
if (isInitialized && user) {
2934
fetchDashboards();
3035
}
31-
}, [isInitialized]);
36+
}, [isInitialized, user]);
3237

3338
return (
34-
<div className="flex h-screen overflow-hidden">
39+
<div className="flex h-[calc(var(--vh)_*_100)] overflow-hidden">
3540
<SideMenu
3641
teamId={TEAM_ID}
3742
dashboardList={dashboards}

0 commit comments

Comments
 (0)