Skip to content

Commit 41d8072

Browse files
committed
little changes
1 parent 3fd0ea8 commit 41d8072

File tree

9 files changed

+61
-11
lines changed

9 files changed

+61
-11
lines changed

app/components/account-tier-text.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,40 @@ export function AccountTierText({
44
accountTier,
55
children,
66
defaultColor = "text-inherit",
7+
className,
78
}: {
89
accountTier: string;
910
children: React.ReactNode;
1011
defaultColor?: string;
12+
className?: string;
1113
}) {
1214
if (accountTier.toLowerCase() === "pro") {
1315
return (
14-
<span className="bg-gradient-to-r from-orange-400 to-red-400 bg-clip-text text-transparent font-bold">
16+
<span
17+
className={cn(
18+
"bg-gradient-to-r from-orange-400 to-red-400 bg-clip-text text-transparent font-bold",
19+
className
20+
)}
21+
>
1522
{children}
1623
</span>
1724
);
1825
}
1926

2027
if (accountTier.toLowerCase() === "premium") {
2128
return (
22-
<span className="bg-gradient-to-r from-pink-500 to-purple-300 bg-clip-text text-transparent font-bold">
29+
<span
30+
className={cn(
31+
"bg-gradient-to-r from-pink-500 to-purple-300 bg-clip-text text-transparent font-bold",
32+
className
33+
)}
34+
>
2335
{children}
2436
</span>
2537
);
2638
}
2739

28-
return <span className={cn(defaultColor, "font-bold")}>{children}</span>;
40+
return (
41+
<span className={cn(defaultColor, "font-bold", className)}>{children}</span>
42+
);
2943
}

app/components/top-nav.tsx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { SignedIn, SignedOut, UserButton } from "@clerk/tanstack-start";
1+
import {
2+
SignedIn,
3+
SignedOut,
4+
UserButton,
5+
useUser,
6+
} from "@clerk/tanstack-start";
27
import { Video } from "lucide-react";
38
import { Button } from "@/components/ui/button";
49
import {
@@ -8,8 +13,15 @@ import {
813
DropdownMenuTrigger,
914
} from "@/components/ui/dropdown-menu";
1015
import { Link } from "@tanstack/react-router";
16+
import { AccountTierText } from "./account-tier-text";
17+
import { Badge } from "./ui/badge";
18+
import { safeParseAccountTier, TIER_TO_TEXT } from "@/lib/utils";
1119

1220
export default function TopNav() {
21+
const { user } = useUser();
22+
23+
const accountTier = safeParseAccountTier(user?.publicMetadata?.accountTier);
24+
1325
return (
1426
<div className="sticky md:top-2 flex justify-center z-[99] w-full">
1527
<header className="px-3 max-w-[64rem] md:w-[90%] w-full bg-white/95 md:dark:bg-zinc-950/30 dark:bg-zinc-950/50 md:border border-border/50 border-b md:rounded-full flex items-center justify-between h-14 reltive backdrop-blur-md shadow-sm sticky">
@@ -129,7 +141,16 @@ export default function TopNav() {
129141
</DropdownMenu>
130142
</SignedOut>
131143
<SignedIn>
132-
<span className="md:flex hidden items-center">
144+
<span className="md:flex hidden items-center gap-2">
145+
<Badge variant="outline" className="h-8">
146+
<AccountTierText
147+
accountTier={accountTier}
148+
className="pointer-events-none"
149+
>
150+
{TIER_TO_TEXT[accountTier]} Tier
151+
</AccountTierText>
152+
</Badge>
153+
133154
<UserButton />
134155
</span>
135156
<span className="flex md:hidden items-center">

app/globals.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap");
1+
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&display=swap");
22

33
@tailwind base;
44
@tailwind components;
55
@tailwind utilities;
66

77
body {
8-
font-family: "DM Sans", Arial, Helvetica, sans-serif;
8+
font-family: "Geist", Arial, Helvetica, sans-serif;
99
letter-spacing: 0.05rem;
1010
}
1111

app/lib/utils.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ export function formatBytes(
7575
const i = Math.floor(Math.log(bytes) / Math.log(1024));
7676

7777
return `${(bytes / 1024 ** i).toFixed(decimals)} ${
78-
sizeType === "accurate" ? accurateSizes[i] ?? "Bytes" : sizes[i] ?? "Bytes"
78+
sizeType === "accurate"
79+
? (accurateSizes[i] ?? "Bytes")
80+
: (sizes[i] ?? "Bytes")
7981
}`;
8082
}
8183

@@ -96,6 +98,13 @@ export function safeParseAccountTier(tier: unknown) {
9698
return parsed.data;
9799
}
98100

101+
export const TIER_TO_TEXT = {
102+
free: "Free",
103+
pro: "Pro",
104+
premium: "Premium",
105+
ultimate: "Ultimate",
106+
};
107+
99108
export function getIpFromHeaders(headers: Headers) {
100109
const forwardedFor = headers.get("x-forwarded-for");
101110
const realIp = headers.get("x-real-ip");

app/routes/__root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function RootDocument({ children }: Readonly<{ children: ReactNode }>) {
9999
<head>
100100
<HeadContent />
101101
</head>
102-
<body className="antialiased font-dmSans">
102+
<body className="antialiased font-geist">
103103
<div vaul-drawer-wrapper="">{children}</div>
104104
<Toaster theme="dark" />
105105
<TanStackRouterDevtools position="bottom-right" />

app/routes/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function RouteComponent() {
2020
<div className="container px-4 md:px-6">
2121
<div className="flex flex-col items-center space-y-4 text-center">
2222
<div className="space-y-2">
23-
<h1 className="text-4xl sm:text-6xl font-bold text-primary bg-clip-text">
23+
<h1 className="text-4xl sm:text-6xl font-bold text-primary bg-clip-text tracking-tight">
2424
Share Videos in a Flash
2525
</h1>
2626
<p className="mx-auto max-w-[700px] text-gray-500 md:text-xl dark:text-gray-400">

app/trigger/scheduled/delete-videos.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import type { videoDeletionTask } from "../video-deletion.js";
55
export const deleteVideosScheduledTask = schedules.task({
66
id: "delete-videos",
77
cron: "0 * * * *",
8+
machine: {
9+
preset: "micro",
10+
},
811
run: async () => {
912
const videosToDelete = await logger.trace(
1013
"Postgres videos to delete",

app/trigger/scheduled/increment-views.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const BATCH_SIZE = 15;
99
export const incrementViewsScheduledTask = schedules.task({
1010
id: "increment-views",
1111
cron: "*/5 * * * *",
12+
machine: {
13+
preset: "micro",
14+
},
1215
run: async () => {
1316
const { env } = await import("../../../app/lib/env");
1417

tailwind.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
theme: {
1414
extend: {
1515
fontFamily: {
16-
dmSans: '"DM Sans"',
16+
geist: '"Geist"',
1717
},
1818
colors: {
1919
background: "hsl(var(--background))",

0 commit comments

Comments
 (0)