Skip to content

Commit

Permalink
fix: UI Hydration issue
Browse files Browse the repository at this point in the history
  • Loading branch information
badalkhatri0924 committed Dec 29, 2023
1 parent f604ba0 commit b907922
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
57 changes: 29 additions & 28 deletions apps/web/lib/app/authenticator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,36 +52,37 @@ export function withAuthentication(Component: NextPage<any, any>, params: Params
}
}, [queryCall, setUser, user]);

if (!user || loading) {
return <></>;
}
if ((!user || loading) && showPageSkeleton) {
return <TeamPageSkeleton />;
}

return (
<>
{(!user || loading) && showPageSkeleton ? (
<TeamPageSkeleton />
) : (
<>
<Component {...props} />
{user && !isTeamMember && showCreateTeamModal && (
<CreateTeamModal
open={showCreateTeamModal}
closeModal={() => {
closeModalIfNewTeamCreated();
}}
joinTeamModal={() => {
setShowCreateTeamModal(false);
setShowJoinTeamModal(true);
}}
/>
)}
{user && !isTeamMember && showJoinTeamModal && (
<JoinTeamModal
open={showJoinTeamModal}
closeModal={() => {
closeModalIfNewTeamCreated();
}}
/>
)}
</>
<div>
<Component {...props} />
{user && !isTeamMember && showCreateTeamModal && (
<CreateTeamModal
open={showCreateTeamModal}
closeModal={() => {
closeModalIfNewTeamCreated();
}}
joinTeamModal={() => {
setShowCreateTeamModal(false);
setShowJoinTeamModal(true);
}}
/>
)}
{user && !isTeamMember && showJoinTeamModal && (
<JoinTeamModal
open={showJoinTeamModal}
closeModal={() => {
closeModalIfNewTeamCreated();
}}
/>
)}
</>
</div>
);
};

Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/components/Kanban.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const getBackgroundColor = (dropSnapshot: DroppableStateSnapshot) => {

// this function changes column header color when dragged
function headerStyleChanger(snapshot: DraggableStateSnapshot, bgColor: any) {
const backgroundColor = snapshot.isDragging ? '#0000ee' : bgColor;
const backgroundColor = snapshot.isDragging ? '#3826a6' : bgColor;

return {
backgroundColor
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/layout/main-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Props = PropsWithChildren<{

export function MainLayout({ children, title, showTimer, publicTeam, notFound, className, childrenClassName }: Props) {
return (
<>
<div>
<style jsx global>
{`
:root {
Expand Down Expand Up @@ -48,6 +48,6 @@ export function MainLayout({ children, title, showTimer, publicTeam, notFound, c
</Container>
</div>
<Toaster />
</>
</div>
);
}
6 changes: 4 additions & 2 deletions apps/web/lib/layout/navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { useModal, useOrganizationTeams } from '@app/hooks';
import { IClassName } from '@app/interfaces';
import { userState } from '@app/stores';
Expand Down Expand Up @@ -59,7 +61,7 @@ export function Navbar({
}, [pathname]);

return (
<>
<div>
{!user && !notFound && !publicTeam ? (
<HeaderSkeleton />
) : (
Expand Down Expand Up @@ -101,6 +103,6 @@ export function Navbar({
<RequestToJoinModal open={isOpen} closeModal={closeModal} />
</nav>
)}
</>
</div>
);
}

0 comments on commit b907922

Please sign in to comment.