Skip to content

Commit

Permalink
fix route protect bug and change Sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeGoood committed Jul 24, 2024
1 parent 75fc890 commit 6be846f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/app/rpkm/activities/details/community/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const Page = () => {
href="https://lin.ee/i9Ezhg7"
borderClassName="bg-rpkm-cream"
backgroundClassName="bg-rpkm-green text-center text-lg text-rpkm-gray w-[60vw]"
target="_self"
>
Line OA ของกิจกรรม
</ActivityButton>
Expand Down
2 changes: 1 addition & 1 deletion src/app/rpkm/activities/map/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const page = () => {
'1.5px 1.5px 0 #000, -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000',
}}
>
ข้อมูลที่จัดแต่ละกิจกรรม
กิจกรรมชุมชน
</h2>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions src/components/rpkm/Sidebar/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function Menu() {
return (
<div className="w-full h-full text-left font-medium flex flex-col pb-[5vh]">
<Link
href="/rpkm/baan/home"
className="text-left"
href=""
className="text-left cursor-not-allowed text-gray-400"
>
ลงทะเบียนเลือกบ้าน
</Link>
Expand Down Expand Up @@ -82,19 +82,19 @@ function Menu() {
aria-label="Accordion 2"
title={<div>แผนที่</div>}
>
<div className="flex flex-col w-full justify-items-start text-sm px-2 -mt-2">
<div className="flex flex-col w-full justify-items-start text-sm px-2 -mt-2 ">
<div
//href="/rpkm/activities/map"
className="text-left text-gray-400 cursor-not-allowed"
>
ข้อมูลที่จัดแต่ละกิจกรรม
</div>
<Link
href="/rpkm/activities/map"
className="text-left"
>
ข้อมูลที่จัดแต่ละกิจกรรม
</Link>
<div
// href="/rpkm/activities/"
className="text-left text-gray-400 cursor-not-allowed"
>
กิจกรรมชุมชน
</div>
</Link>
</div>
</AccordionItem>
</Accordion>
Expand Down
14 changes: 13 additions & 1 deletion src/context/AuthContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ const AuthProvider: React.FC<{ children: ReactNode }> = ({
);
const now = (await getCurrentTime()).currentTime;

console.log(
'now',
now,
'firstdate',
firstdate,
'startRPKM',
startRPKM,
'endBannSelect',
endBannSelect,
'freshyNight',
freshyNight
);
//firstdate
if (path.includes('firstdate')) {
if (now < firstdate) {
Expand All @@ -135,7 +147,7 @@ const AuthProvider: React.FC<{ children: ReactNode }> = ({
}

// end baan select
if (path.includes('/baan')) {
if (path.includes('rpkm/baan')) {
if (now > endBannSelect) {
return router.push('/rpkm/activities/home');
}
Expand Down

0 comments on commit 6be846f

Please sign in to comment.