Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: do not ssr time

bautistaaa7f233853b545
diff --git a/apps/web/src/app/[locale]/explore/_components/explore-card.tsx b/apps/web/src/app/[locale]/explore/_components/explore-card.tsx
index f51adf15..e7bcc323 100644
--- a/apps/web/src/app/[locale]/explore/_components/explore-card.tsx
+++ b/apps/web/src/app/[locale]/explore/_components/explore-card.tsx
@@ -1,6 +1,3 @@
-import { Circle, Diamond, MessageCircle, Plus, Sparkle, ThumbsUp, Triangle } from '@repo/ui/icons';
-import type { ExploreChallengeData } from './explore.action';
-import { getRelativeTime } from '~/utils/relativeTime';
import {
Card,
CardContent,
@@ -10,6 +7,13 @@ import {
} from '@repo/ui/components/card';
import { DifficultyBadge } from '@repo/ui/components/difficulty-badge';
import { Markdown } from '@repo/ui/components/markdown';
+import { Circle, Diamond, MessageCircle, Plus, Sparkle, ThumbsUp, Triangle } from '@repo/ui/icons';
+import dynamic from 'next/dynamic';
+import type { ExploreChallengeData } from './explore.action';
+
+const RelativeTime = dynamic(() => import('./relative-time'), {
+ ssr: false,
+});
interface ExploreCardProps {
challenge: Pick<
@@ -100,7 +104,7 @@ export function ExploreCard({ challenge }: ExploreCardProps) {
@{challenge.user.name}
</div>
<div className="text-muted-foreground whitespace-nowrap text-sm">
- {getRelativeTime(challenge.updatedAt)}
+ <RelativeTime date={challenge.updatedAt} />
</div>
</div>
<CardDescription className="relative h-20 pb-4">
diff --git a/apps/web/src/app/[locale]/explore/_components/index.tsx b/apps/web/src/app/[locale]/explore/_components/index.tsx
index b8c3ef73..0ea4dfe5 100644
--- a/apps/web/src/app/[locale]/explore/_components/index.tsx
+++ b/apps/web/src/app/[locale]/explore/_components/index.tsx
@@ -52,7 +52,6 @@ export async function Explore() {
redirectRoute="/explore/medium"
/>
</Suspense>
-
<Suspense fallback={<ExploreSectionSkeleton />}>
<ExploreSection
title="For the Experts"
diff --git a/apps/web/src/app/[locale]/explore/_components/relative-time.tsx b/apps/web/src/app/[locale]/explore/_components/relative-time.tsx
new file mode 100644
index 00000000..da671cd4
--- /dev/null
+++ b/apps/web/src/app/[locale]/explore/_components/relative-time.tsx
@@ -0,0 +1,5 @@
+import { getRelativeTime } from '~/utils/relativeTime';
+
+export default function RelativeTime({ date }: { date: Date }) {
+ return <>{getRelativeTime(date)}</>;
+}
diff --git a/packages/monaco/src/index.tsx b/packages/monaco/src/index.tsx
index 1591142a..bbc00000 100644
--- a/packages/monaco/src/index.tsx
+++ b/packages/monaco/src/index.tsx
@@ -234,9 +234,11 @@ export function CodePanel(props: CodePanelProps) {
Submit{tsErrors === undefined && ' (open test cases)'}
</Button>
</TooltipTrigger>
- <TooltipContent>
- <p>Login to Submit</p>
- </TooltipContent>
+ {disabled && (
+ <TooltipContent>
+ <p>Login to Submit</p>
+ </TooltipContent>
+ )}
</Tooltip>
</div>
</div>