Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Html, Head, Main, NextScript } from 'next/document';
import Document, { DocumentContext, DocumentInitialProps } from 'next/document';

class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
2 changes: 1 addition & 1 deletion src/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function UserDashboardPageContent() {

// Load from URL parameters or localStorage when the component mounts
useEffect(() => {
const componentParam = searchParams.get('component');
const componentParam = searchParams ? searchParams.get('component') : null;
if (componentParam) {
setActiveComponent(componentParam);
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/app/forum/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import Chatbot from "@/components/chatassistant/chatbot";
import { useUserPreferences } from '@/hooks/useUserPreferences';

export default function ForumDetailsPage() {
const { id } = useParams();
const params = useParams();
const id = (params?.id ?? '') as string;
const router = useRouter();
const { trackInteraction, getPersonalizedFeed } = useUserPreferences();
const [forum, setForum] = useState<IForum | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion src/app/meeting/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function MeetingPage() {
const params = useParams();
const router = useRouter();
const { user, isLoading: authLoading } = useAuth();
const meetingId = params.id as string;
const meetingId = (params?.id ?? '') as string;

const [meeting, setMeeting] = useState<Meeting | null>(null);
const [otherUser, setOtherUser] = useState<User | null>(null);
Expand Down
2 changes: 1 addition & 1 deletion src/app/session/[sessionId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function SessionWorkspace() {
const params = useParams();
const router = useRouter();
const { user } = useAuth();
const sessionId = params.sessionId as string;
const sessionId = (params?.sessionId ?? '') as string;
const currentUserId = user?._id

const [session, setSession] = useState<Session | null>(null);
Expand Down
4 changes: 2 additions & 2 deletions src/app/user/chat/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ function ChatPageContent() {

// Check if user came from dashboard and handle auto-selection of chat room
useEffect(() => {
const fromDashboard = searchParams.get('from') === 'dashboard';
const roomId = searchParams.get('roomId');
const fromDashboard = searchParams ? searchParams.get('from') === 'dashboard' : false;
const roomId = searchParams ? searchParams.get('roomId') : null;

if (fromDashboard) {
setForceRefresh(true);
Expand Down
8 changes: 4 additions & 4 deletions src/components/auth/AccountSuspended.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ export default function AccountSuspended() {

useEffect(() => {
// Try to get suspension data from URL params
const reason = searchParams.get("reason");
const notes = searchParams.get("notes");
const date = searchParams.get("date");
const admin = searchParams.get("admin");
const reason = searchParams ? searchParams.get("reason") : null;
const notes = searchParams ? searchParams.get("notes") : null;
const date = searchParams ? searchParams.get("date") : null;
const admin = searchParams ? searchParams.get("admin") : null;

if (reason || notes || date) {
setSuspensionData({
Expand Down
23 changes: 23 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Html, Head, Main, NextScript } from 'next/document';
import Document, { DocumentContext, DocumentInitialProps } from 'next/document';

class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
Loading