Skip to content

Commit 7a0f86f

Browse files
committed
improvements (generally)
1 parent 3151872 commit 7a0f86f

File tree

17 files changed

+94
-32
lines changed

17 files changed

+94
-32
lines changed

packages/react/package-lock.json

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
"react-hook-form": "^7.49.2",
8585
"react-i18next": "^15.2.0",
8686
"react-image": "^4.1.0",
87+
"react-linkify-it": "^1.0.8",
8788
"react-player": "^2.16.0",
8889
"react-resizable-panels": "^2.0.20",
8990
"react-rnd": "^10.4.11",

packages/react/src/components/about/ContactList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function ContactList() {
1616
{
1717
className:
1818
"border-violet-10 hover:bg-violet-4 hover:border-violet-10 text-violet-10 max-w-xs",
19-
href: "https://discord.gg/A24AbzgvRJ",
19+
href: "https://discord.gg/jctkgHBt4b",
2020
icon: "i-logos:discord-icon",
2121
label: t("about.contact.discord"),
2222
},

packages/react/src/components/header/header.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ export function Header({ id }: HeaderProps) {
4444
size="icon"
4545
variant="link"
4646
className={clsx(
47-
"h-12 w-12 p-0 opacity-100 transition-all hover:bg-secondaryA-2",
48-
{
49-
"-translate-y-8 duration-200 opacity-0": isSidebarOpen,
50-
},
47+
"h-12 w-12 p-0 opacity-100 transition-all starting:opacity-0 starting:-translate-y-6 duration-1000 hover:bg-secondaryA-2",
48+
isSidebarOpen && "hidden",
5149
)}
5250
asChild
5351
>

packages/react/src/components/header/userMenu/components/UserMenu.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "@/shadcn/ui/dropdown-menu";
1515
import { Avatar, AvatarFallback, AvatarImage } from "@/shadcn/ui/avatar";
1616
import { calendarDialogAtom } from "@/hooks/useFrame";
17+
import { Badge } from "@/shadcn/ui/badge";
1718

1819
export function UserMenu() {
1920
const { t } = useTranslation();
@@ -70,7 +71,8 @@ export function UserMenu() {
7071
</Avatar>
7172
<div className="flex flex-col gap-1 pl-4">
7273
<div className="overflow-hidden text-ellipsis font-semibold">
73-
{user.username}
74+
{user.username}{" "}
75+
<Badge size="sm">{user.role === "user" ? "" : user.role}</Badge>
7476
</div>
7577
<div className="flex flex-row gap-2 text-sm">
7678
<div className={user.discord_id ? "" : "saturate-0"}>
@@ -86,8 +88,6 @@ export function UserMenu() {
8688
</div> */}
8789
</div>
8890
<div className="flex flex-row capitalize text-primary-11">
89-
{user.role === "user" ? "" : user.role}
90-
9191
<div className="i-mage:stars-c mx-1 animate-pulse"></div>
9292

9393
{user.contribution_count + " " + t("component.mainNav.points")}

packages/react/src/components/layout/Frame.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,24 @@ export function CopyrightNotice() {
9595
<div className="mt-16 text-center text-sm text-base-7">
9696
© 2020-2024 Holodex v{lastTag}.{commitsSinceLastTag}
9797
<small className="ml-2 inline-block opacity-80">
98-
{abbreviatedSha} / {dayjs(new Date(committerDate)).format("lll")}
99-
</small>
98+
b.{abbreviatedSha} / {dayjs(new Date(committerDate)).format("lll")}
99+
</small>{" "}
100+
/{" "}
101+
<a
102+
href="https://discord.gg/jctkgHBt4b"
103+
target="_blank"
104+
className="hover:text-secondary-8 hover:underline"
105+
>
106+
Discord
107+
</a>{" "}
108+
/{" "}
109+
<a
110+
href="https://ko-fi.com/holodex"
111+
target="_blank"
112+
className="hover:text-secondary-8 hover:underline"
113+
>
114+
Ko-fi
115+
</a>
100116
</div>
101117
);
102118
}

packages/react/src/components/player/PlayerDescription.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { cn } from "@/lib/utils";
22
import { Button } from "@/shadcn/ui/button";
33
import { useState } from "react";
4+
import { LinkItUrl, LinkItTwitter } from "react-linkify-it";
45

56
export function PlayerDescription({
67
description,
@@ -20,7 +21,11 @@ export function PlayerDescription({
2021
"line-clamp-3": !isExpanded,
2122
})}
2223
>
23-
{description}
24+
<LinkItUrl className="text-primary underline hover:text-primary-12">
25+
<LinkItTwitter className="text-primary underline hover:text-primary-12">
26+
{description}
27+
</LinkItTwitter>
28+
</LinkItUrl>
2429
</div>
2530
{description.split(/\r\n|\r|\n/).length > lines && (
2631
<Button variant="ghost" onClick={() => setIsExpanded(!isExpanded)}>

packages/react/src/components/sidebar/sidebar.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,10 @@ export function Sidebar() {
7373
ref={ref}
7474
>
7575
<div className="flex min-h-[100dvh] flex-col bg-base-2">
76-
<div className="flex items-center gap-2 px-4 pb-2 pt-4">
76+
<div
77+
className="flex cursor-pointer items-center gap-2 px-4 pb-2 pt-4"
78+
onClick={() => navigate("/")}
79+
>
7780
<Logo className="ml-1.5 h-8 w-8" />
7881
<h2 className="text-3xl font-semibold tracking-tight">Holodex</h2>
7982
<div className="flex grow" />

packages/react/src/components/video/VideoCard.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export function VideoCard({
120120
const videoCardClasses = useMemo(
121121
() => ({
122122
outerLayer: clsx([
123+
"starting:opacity-0 opacity-100 transition-opacity duration-300",
123124
size == "list" && "rounded-sm hover:bg-base-3 @lg:px-2",
124125
(size == "list" || size == "sm") && "group relative flex gap-4 py-2",
125126
(size == "md" || size == "lg") && "group flex w-full flex-col gap-4",

packages/react/src/hooks/useAuth.ts

+9-6
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,25 @@ export function useAuth() {
4242
const client = useClient();
4343

4444
const { data: valid, error } = useQuery({
45-
queryKey: ["login-check"],
45+
queryKey: ["login-check", token],
4646
queryFn: (): Promise<RefreshUser | null> => {
47+
if (!token) return Promise.resolve(null);
48+
if (!client.loggedIn) return Promise.resolve(null);
4749
return client.get<RefreshUser>("/api/v2/user/refresh");
4850
},
49-
enabled: !!token && !!client.loggedIn,
51+
enabled: true,
5052
staleTime: 60 * 60 * 1000, // 1 hour
5153
});
5254

5355
useEffect(() => {
5456
if (error) toast({ title: error.message, variant: "error" });
5557
else if (valid) {
58+
console.log("saved new token", valid);
5659
setToken(valid?.jwt);
5760
setUser(valid?.user);
5861
}
5962
// eslint-disable-next-line react-hooks/exhaustive-deps
60-
}, [valid, error]);
63+
}, [valid, error, token]);
6164

6265
const login = useMutation({
6366
mutationFn: async ({
@@ -79,7 +82,7 @@ export function useAuth() {
7982
});
8083
setToken(jwt);
8184
setUser(user);
82-
navigate("/settings");
85+
navigate("/settings/user");
8386
} catch (e) {
8487
onFailure(e as Error);
8588
}
@@ -94,7 +97,7 @@ export function useAuth() {
9497
});
9598
setToken(jwt);
9699
setUser(user);
97-
navigate("/settings");
100+
navigate("/settings/user");
98101
} catch (e) {
99102
onFailure(e as Error);
100103
}
@@ -110,7 +113,7 @@ export function useAuth() {
110113
});
111114
setToken(jwt);
112115
setUser(user);
113-
navigate("/settings");
116+
navigate("/settings/user");
114117
} catch (e) {
115118
onFailure(e as Error);
116119
}

packages/react/src/routes/about/general.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const QuickLinks = () => {
129129
{
130130
className:
131131
"border-violet-10 hover:bg-violet-4 hover:border-violet-10 text-violet-10",
132-
href: "https://discord.gg/A24AbzgvRJ",
132+
href: "https://discord.gg/jctkgHBt4b",
133133
icon: "i-carbon:logo-discord",
134134
label: t("about.discordBtn"),
135135
},

packages/react/src/routes/channel/ChannelAbout.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useOutletContext } from "react-router-dom";
22
import { ChannelOutletContext } from "../channel";
33
import { useTranslation } from "react-i18next";
4+
import { LinkItTwitter, LinkItUrl } from "react-linkify-it";
45

56
export default function ChannelAbout() {
67
const { t } = useTranslation();
@@ -9,7 +10,11 @@ export default function ChannelAbout() {
910
return (
1011
<div className="container flex gap-4 py-4 max-sm:flex-col-reverse">
1112
<div className="w-full whitespace-pre-wrap rounded-lg bg-base-3 p-4">
12-
{channel.description}
13+
<LinkItUrl className="text-primary underline hover:text-primary-12">
14+
<LinkItTwitter className="text-primary underline hover:text-primary-12">
15+
{channel.description}
16+
</LinkItTwitter>
17+
</LinkItUrl>
1318
</div>
1419
<div className="h-fit w-full shrink-0 flex-col divide-y-2 divide-base-5 rounded-lg bg-base-3 p-4 md:w-80 [&>p]:py-2">
1520
<h3 className="pb-2 text-xl font-bold">

packages/react/src/routes/orgChannels.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function ChannelsOrg() {
134134
<>
135135
<Helmet>
136136
<title>
137-
TODO PUT CURRENT ORG HERE {t("component.mainNav.channels")} - Holodex
137+
{org} - {t("component.mainNav.channels")} - Holodex
138138
</title>
139139
</Helmet>
140140
<div className="h-full w-full px-4 md:p-8">

packages/react/src/routes/settings/user.tsx

+15-9
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,23 @@ export function SettingsUser() {
3535
return (
3636
<div className="flex flex-col">
3737
<div className="my-4 flex items-center gap-6">
38-
<img
39-
className="h-24 w-24 rounded-full"
40-
src={`https://api.dicebear.com/7.x/shapes/svg?seed=${user.id}`}
41-
/>
38+
<div className="flex flex-col items-center">
39+
<img
40+
className="h-24 w-24 rounded-full"
41+
src={`https://api.dicebear.com/7.x/shapes/svg?seed=${user.id}`}
42+
/>
43+
<Badge className="-mt-2">{user.role}</Badge>
44+
</div>
4245
<div className="flex flex-col gap-2">
4346
<div className="text-2xl font-bold md:text-4xl">{user.username}</div>
4447
<div className="capitalize text-base-11">
45-
{user.role} : {user.contribution_count}
48+
{user.contribution_count}
4649
{t("component.mainNav.points")}
4750
</div>
4851
<div className="flex flex-wrap gap-2 text-sm">
52+
<Badge className="border-base text-base-11" variant="outline">
53+
<kbd className="font-bold">#{user.id}</kbd>
54+
</Badge>
4955
<TooltipProvider>
5056
<Tooltip>
5157
<TooltipTrigger>
@@ -110,7 +116,7 @@ export function SettingsUser() {
110116
</div>
111117
<div className="ml-auto hidden flex-col gap-2 xl:flex">
112118
{user?.role !== "user" && (
113-
<Button variant="outline" asChild>
119+
<Button variant="base-outline" asChild>
114120
<Link
115121
to={
116122
/(en|lol)/.test(i18n.language)
@@ -119,8 +125,8 @@ export function SettingsUser() {
119125
}
120126
target="_blank"
121127
>
122-
<div className="i-heroicons:information-circle" />
123-
Editor Guide
128+
<div className="i-ion:book" />
129+
Editor's Guide
124130
</Link>
125131
</Button>
126132
)}
@@ -156,7 +162,7 @@ export function SettingsUser() {
156162
<SettingsItem label="API Key" fullWidth>
157163
<div className="ml-auto flex w-full max-w-md flex-col gap-4">
158164
<div className="flex items-center gap-2">
159-
<Input value={user.api_key} readOnly />
165+
<Input value={user.api_key ?? ""} placeholder="---" readOnly />
160166
<Button
161167
size="icon-lg"
162168
variant="ghost"

packages/react/src/shadcn/ui/badge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
55
import { cn } from "@/lib/utils"
66

77
const badgeVariants = cva(
8-
"inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",
8+
"inline-flex items-center rounded-md px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 cursor-default",
99
{
1010
variants: {
1111
variant: {

packages/react/src/shadcn/ui/button.variants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const buttonVariants = cva(
1212
outline:
1313
"border border-primary-5 bg-transparent hover:border-primaryA-6 hover:bg-primaryA-5 focus-visible:ring-primary-7",
1414
primary:
15-
"bg-primary-9 text-base-12 hover:bg-primaryA-4 focus-visible:ring-primary-7",
15+
"bg-primary-9 text-base-12 hover:bg-primary-7 focus-visible:ring-primary-7",
1616
secondary:
1717
"bg-secondary-9 text-base-12 hover:bg-secondaryA-4 focus-visible:ring-secondary-7",
1818
ghost:

packages/react/tailwind.config.js

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ const config = {
122122
plugins: [
123123
require("tailwindcss-animate"),
124124
require("@tailwindcss/container-queries"),
125+
/** @type {import('tailwindcss/types/config').PluginCreator} */
126+
({ addVariant }) => {
127+
addVariant("starting", "@starting-style");
128+
},
125129
],
126130
};
127131

0 commit comments

Comments
 (0)