Skip to content

Commit f0ed63d

Browse files
committed
insights: rename to "social media posts" and show links to sm
1 parent 52e6e36 commit f0ed63d

19 files changed

Lines changed: 145 additions & 53 deletions

app/@modal/(.)insights/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { notFound } from 'next/navigation';
22

3-
import { InsightDetailModal } from '@/app/components/insight-detail-modal';
3+
import { InsightDetailModal } from '@/components/insight/insight-detail-modal';
44
import { fetchInsightServer } from '@/graphql/helpers/fetch-insights-server';
55

66
type InsightModalPageProps = {

app/components/insight-post-card.tsx

Lines changed: 0 additions & 36 deletions
This file was deleted.

app/insights/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { notFound } from 'next/navigation';
22

3-
import { InsightDetailContent } from '@/app/components/insight-detail-content';
3+
import { InsightDetailContent } from '@/components/insight/insight-detail-content';
44
import { Header } from '@/components/header/header';
55
import { Page } from '@/components/page/page';
66
import { fetchInsightServer } from '@/graphql/helpers/fetch-insights-server';

app/insights/insights-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useState } from 'react';
44

5-
import { InsightPostCard } from '../components/insight-post-card';
5+
import { InsightPostCard } from '@/components/insight/insight-post-card';
66
import { Button } from '@/components/ui/button';
77
import { fetchInsightsClient } from '@/graphql/helpers/fetch-insights-client';
88
import type { InsightsQuery } from '@/types/generated/graphql';

app/insights/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default async function InsightsPage() {
1717
<>
1818
<Header />
1919
<Page className="gap-4">
20-
<h1 className="text-2xl font-semibold">Insights</h1>
20+
<h1 className="text-2xl font-semibold">Social Media Posts</h1>
2121
<InsightsList initialInsights={insights} />
2222
</Page>
2323
</>

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { BadgeSection } from './components/badge-section';
22
import { CountryRankingSection } from './components/country-ranking-section';
33
import { GlobalRankingSection } from './components/global-ranking-section';
4-
import InsightsCarousel from './components/insights-carousel';
54
import { LanguageRankingSection } from './components/language-ranking-section';
65
import { MessengerIntegrationSection } from './components/messenger-integration-section';
76
import { SearchProfile } from './components/search-profile';
87
import { Header } from '@/components/header/header';
8+
import InsightsCarousel from '@/components/insight/insights-carousel';
99
import { Link } from '@/components/link/link';
1010
import { Page } from '@/components/page/page';
1111

@@ -27,7 +27,7 @@ export default function Home() {
2727
</div>
2828
<div className="flex flex-col justify-center gap-4 md:ml-10 p-4 pt-5 md:pt-4">
2929
<div className="flex gap-2 z-1 relative items-baseline">
30-
<h2 className="text-xl md:text-2xl font-semibold">Latest Posts</h2>
30+
<h2 className="text-xl md:text-xl font-semibold">Social Media Posts</h2>
3131
<Link href="/insights" className="text-sm">
3232
Show all
3333
</Link>
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Card, CardContent } from '../ui/card';
2+
3+
export const InsightContainer = ({ children }: { children: React.ReactNode }) => {
4+
return (
5+
<Card className="py-4">
6+
<CardContent>{children}</CardContent>
7+
</Card>
8+
);
9+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { format, formatDistanceToNow } from 'date-fns';
2+
3+
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
4+
5+
type InsightCreatedAtProps = {
6+
createdAt: Date;
7+
};
8+
9+
export const InsightCreatedAt = ({ createdAt }: InsightCreatedAtProps) => {
10+
const isWithinLast24Hours = Date.now() - createdAt.getTime() < 24 * 60 * 60 * 1000;
11+
12+
if (isWithinLast24Hours) {
13+
return <div className="text-muted-foreground text-sm">{formatDistanceToNow(createdAt, { addSuffix: true })}</div>;
14+
}
15+
16+
return (
17+
<Tooltip>
18+
<TooltipTrigger asChild>
19+
<div className="text-muted-foreground text-sm">{format(createdAt, 'MMM d')}</div>
20+
</TooltipTrigger>
21+
<TooltipContent>{format(createdAt, "MMM d',' h:mm a")}</TooltipContent>
22+
</Tooltip>
23+
);
24+
};
File renamed without changes.

0 commit comments

Comments
 (0)