Skip to content

Commit

Permalink
fix: user pages can ignore acc activity stats
Browse files Browse the repository at this point in the history
  • Loading branch information
TheExGenesis committed Feb 7, 2025
1 parent c52d337 commit 6e87b57
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
3 changes: 1 addition & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const revalidate = 0

import CommunityStats from '@/components/CommunityStats'
import SearchTweets from '@/components/SearchTweets'
import { createServerClient } from '@/utils/supabase'
import { cookies } from 'next/headers'
import AvatarList from '@/components/AvatarList'
Expand Down Expand Up @@ -150,7 +149,7 @@ export default async function Homepage() {
<p>
Maintained & developed by{' '}
<a href="@https://x.com/exgenesis" className="hover:underline">
Xiq (@exgeneis)
Xiq (@exgenesis)
</a>{' '}
& contributors.
</p>
Expand Down
2 changes: 0 additions & 2 deletions src/app/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'
import ThemeToggle from '@/components/ThemeToggle'
import SearchTweets from '@/components/SearchTweets'
import AdvancedSearchForm from '@/components/AdvancedSearchForm'

export default function SearchTweetsPage() {
Expand All @@ -14,7 +13,6 @@ export default function SearchTweetsPage() {
<main className="flex flex-1 flex-col gap-6">
<h2 className="mb-4 text-4xl font-bold">Advanced Search</h2>
<AdvancedSearchForm />
{/* <SearchTweets supabase={null} /> */}
</main>
</div>
<footer className="w-full justify-center border-t border-t-foreground/10 p-8 text-center text-xs">
Expand Down
30 changes: 12 additions & 18 deletions src/app/user/[account_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ export default async function User({ params }: any) {

const userData = await getUserData(supabase, account_id)

if (!userData) {
return <div>Error fetching user data</div>
}

const { data: summaryData, error: summaryError } = await supabase
.from('account_activity_summary')
.select('mentioned_accounts')
.or(`account_id.eq.${account_id},username.ilike.${account_id}`)
.single()

if (!userData) {
return <div>Error fetching user data</div>
}

const showingSummaryData = !summaryError && summaryData?.mentioned_accounts

return (
Expand All @@ -79,7 +79,7 @@ export default async function User({ params }: any) {
<UserProfile userData={userData} />
</Suspense>

{showingSummaryData ? (
{showingSummaryData && (
<>
<h2 className="text-xl font-semibold">{'Most Mentioned Accounts'}</h2>
<Suspense fallback={<Skeleton className="h-[20vh] w-full" />}>
Expand All @@ -88,21 +88,15 @@ export default async function User({ params }: any) {
height="h-[20vh]"
/>
</Suspense>

<div className="my-16">
<h2 className="text-xl font-semibold">{'Top Tweets'}</h2>
<Suspense fallback={<Skeleton className="h-96 w-full" />}>
<AccountTopTweets userData={userData} />
</Suspense>
</div>
</>
) : (
<div className="my-8 rounded-lg bg-blue-50 p-4 text-blue-700 dark:bg-blue-900/30 dark:text-blue-200">
Archive statistics are being computed and should be available in about
5 minutes. Please check back soon to see interaction data and top
mentions.
</div>
)}

<div className="my-16">
<h2 className="text-xl font-semibold">{'Top Tweets'}</h2>
<Suspense fallback={<Skeleton className="h-96 w-full" />}>
<AccountTopTweets userData={userData} />
</Suspense>
</div>
</div>
)
}
3 changes: 2 additions & 1 deletion src/components/UploadHomepageSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default function UploadHomepageSection(props: {
}, [state.isProcessing])

useEffect(() => {
console.log('hey UploadHomepageSection')
const handleBeforeUnload = (e: BeforeUnloadEvent) => {
if (isProcessingRef.current) {
const message =
Expand Down Expand Up @@ -148,7 +149,7 @@ export default function UploadHomepageSection(props: {
}
>
<button className="cursor-pointer text-sm font-bold text-blue-500 hover:underline dark:text-blue-400">
Upload a new archive, or delete your data.
Upload a new archive, or delete your data. :)
</button>
</div>
) : (
Expand Down

0 comments on commit 6e87b57

Please sign in to comment.