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
4 changes: 0 additions & 4 deletions src/app/@gifModal/(.)i/foundmedia/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// 'use client';
import Gif from '@/features/media/components/Gif';
import GifModal from '@/features/media/components/GifModal';
// import Gif from '@/features/media/components/Gif';

export default async function Page() {
// export default function Page() {
// return <GifModal />;
return <Gif />;
}
25 changes: 17 additions & 8 deletions src/app/[username]/ProfileProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use client';
import React, { createContext, useContext, ReactNode } from 'react';
import { use } from 'react';
import { useProfileByUsername } from '@/features/profile/hooks';
import { useMyProfile } from '@/features/profile/hooks';
import React, {
createContext,
useContext,
ReactNode,
use,
useMemo,
} from 'react';
import { useProfileByUsername, useMyProfile } from '@/features/profile/hooks';
import { useAuthStore } from '@/features/authentication/store/authStore';
import { UserProfile } from '@/features/profile/types/api';
import Loader from '@/components/generic/Loader';
Expand All @@ -25,14 +29,14 @@ export const useProfileContext = () => {
};

interface ProfileProviderProps {
children: ReactNode;
params: Promise<{ username: string }>;
readonly children: ReactNode;
readonly params: Promise<{ username: string }>;
}

export function ProfileProvider({ children, params }: ProfileProviderProps) {
const { username } = use(params);
const currentUser = useAuthStore((s) => s.user);
const useMy = Boolean(currentUser && currentUser.username === username);
const useMy = Boolean(currentUser?.username === username);

const myProfileQuery = useMyProfile();
const {
Expand All @@ -49,6 +53,11 @@ export function ProfileProvider({ children, params }: ProfileProviderProps) {

const error = useMy ? myProfileQuery.error : errorByUsername;

const contextValue = useMemo(
() => ({ profile, isLoading, error, username }),
[profile, isLoading, error, username]
);

if (isLoading) {
return (
<div className="flex items-center justify-center min-h-screen">
Expand All @@ -71,7 +80,7 @@ export function ProfileProvider({ children, params }: ProfileProviderProps) {
}

return (
<ProfileContext.Provider value={{ profile, isLoading, error, username }}>
<ProfileContext.Provider value={contextValue}>
{children}
</ProfileContext.Provider>
);
Expand Down
5 changes: 2 additions & 3 deletions src/app/[username]/followers-you-know/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';
import React, { useEffect } from 'react';
import { use } from 'react';
import React, { useEffect, use } from 'react';
import { useRouter } from 'next/navigation';
import Breadcrumb from '@/components/ui/Breadcrumb';
import { Tabs, GenericUserList } from '@/components/generic';
Expand All @@ -10,7 +9,7 @@ import { useAuthStore } from '@/features/authentication/store/authStore';
import Loader from '@/components/generic/Loader';

interface FollowersYouKnowPageProps {
params: Promise<{
readonly params: Promise<{
username: string;
}>;
}
Expand Down
5 changes: 2 additions & 3 deletions src/app/[username]/followers/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';
import React from 'react';
import { use } from 'react';
import React, { use } from 'react';
import { useRouter } from 'next/navigation';
import Breadcrumb from '@/components/ui/Breadcrumb';
import { Tabs, GenericUserList } from '@/components/generic';
Expand All @@ -10,7 +9,7 @@ import { useAuthStore } from '@/features/authentication/store/authStore';
import Loader from '@/components/generic/Loader';

interface FollowersPageProps {
params: Promise<{
readonly params: Promise<{
username: string;
}>;
}
Expand Down
5 changes: 2 additions & 3 deletions src/app/[username]/following/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client';
import React from 'react';
import { use } from 'react';
import React, { use } from 'react';
import { useRouter } from 'next/navigation';
import Breadcrumb from '@/components/ui/Breadcrumb';
import { Tabs, GenericUserList } from '@/components/generic';
Expand All @@ -10,7 +9,7 @@ import { useAuthStore } from '@/features/authentication/store/authStore';
import Loader from '@/components/generic/Loader';

interface FollowingPageProps {
params: Promise<{
readonly params: Promise<{
username: string;
}>;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/[username]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import LayoutWrapper from '@/features/layout/components/LayoutWrapper';
import { ProfileProvider } from './ProfileProvider';

interface UsernameLayoutProps {
children: React.ReactNode;
params: Promise<{ username: string }>;
readonly children: React.ReactNode;
readonly params: Promise<{ username: string }>;
}

export default function UsernameLayout({
Expand Down
5 changes: 2 additions & 3 deletions src/app/[username]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ const UserPage = () => {
const { profile, username } = useProfileContext();
const { setCurrentProfile } = useProfileStore();
const currentUser = useAuthStore((s) => s.user);
const isMine = Boolean(currentUser && currentUser.username === username);
const isMine = Boolean(currentUser?.username === username);
const [showBlockedPosts, setShowBlockedPosts] = useState(false);
const router = useRouter();
// Update page title with unread count (uses "H" branding, static favicon)
usePageTitleNotifications('H', false);

useEffect(() => {
Expand All @@ -29,7 +28,7 @@ const UserPage = () => {
}, [profile, setCurrentProfile]);

const handleBack = () => {
window.history.back();
router.push('/home');
};

if (!profile) {
Expand Down
185 changes: 0 additions & 185 deletions src/app/auth-debug/page.tsx

This file was deleted.

Loading