Skip to content

Commit 14f95b0

Browse files
committed
modify mentions listing, renaming some vars in main
1 parent cb60a57 commit 14f95b0

File tree

5 files changed

+53
-31
lines changed

5 files changed

+53
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
import { ScrollArea, ScrollBar } from "@/shadcn/ui/scroll-area";
12
import { ChannelImg } from "../channel/ChannelImg";
23

34
export function Mentions({ mentions }: { mentions: ShortChannel[] }) {
45
return (
5-
<div className="flex flex-row gap-2 rounded-lg bg-base-3 p-4">
6-
{mentions.map((mention) => (
7-
<ChannelImg
8-
key={mention.id}
9-
className="h-14"
10-
channelId={mention.id}
11-
photo={mention.photo}
12-
size={40}
13-
/>
14-
))}
6+
<div className="rounded-lg bg-base-3 p-1">
7+
<ScrollArea type="hover" className="p-1">
8+
<div className="flex w-full flex-row gap-2">
9+
{mentions.map((mention) => (
10+
<ChannelImg
11+
key={mention.id}
12+
className="h-14"
13+
channelId={mention.id}
14+
photo={mention.photo}
15+
size={40}
16+
/>
17+
))}
18+
</div>
19+
<ScrollBar orientation="horizontal" />
20+
</ScrollArea>
1521
</div>
1622
);
1723
}

packages/react/src/hooks/useVideoSelection.ts

+16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ const selectedVideosAtom = atom<PlaceholderVideo[]>([]);
66
export const selectedVideoSetReadonlyAtom = atom(
77
(get) => new Set(get(selectedVideosAtom).map((v) => v.id)),
88
);
9+
/**
10+
* Custom hook to manage video selection state.
11+
*
12+
* Provides functionality to enable/disable selection mode, add/remove videos
13+
* from the selection, and clear the selection. Returns the current selection
14+
* mode, selected videos, and functions to manipulate the selection.
15+
*
16+
* @returns {Object} An object containing:
17+
* - selectionMode: boolean indicating if selection mode is active.
18+
* - setSelectionMode: function to toggle selection mode.
19+
* - selectedVideos: array of currently selected videos.
20+
* - setSelectedVideos: function to manually set selected videos.
21+
* - addVideo: function to add a video to the selection.
22+
* - removeVideo: function to remove a video from the selection by ID.
23+
* - clearSelection: function to clear all selected videos.
24+
*/
925
export const useVideoSelection = () => {
1026
const [selectionMode, setSelectionMode] = useAtom(selectionModeAtom);
1127
const [selectedVideos, setSelectedVideos] = useAtom(selectedVideosAtom);

packages/react/src/routes/favorites/favoritesHome.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,26 @@ export function FavoritesHome() {
5959
const [searchParams, setSearchParams] = useSearchParams();
6060
const { t } = useTranslation();
6161
// const { org } = useParams();
62-
const [tab, setTab] = useState(searchParams.get("tab") ?? "live");
62+
const [activeTab, setActiveTab] = useState(searchParams.get("tab") ?? "live");
6363

6464
// useEffect(() => {
6565
// navigate(`/org/${currentOrg}`, { replace: true });
6666
// }, [currentOrg, navigate]);
6767

6868
useEffect(() => {
69-
console.log(`tab changed ${tab}`);
70-
searchParams.set("tab", tab);
69+
console.log(`tab changed ${activeTab}`);
70+
searchParams.set("tab", activeTab);
7171
setSearchParams(searchParams, { replace: true });
72-
}, [searchParams, setSearchParams, tab]);
72+
}, [searchParams, setSearchParams, activeTab]);
7373

7474
// TODO: probably use a different flag than "Oshis", but idk between Members or What
7575
return (
7676
<>
7777
<Helmet>
7878
<title>{t("component.mainNav.favorites")} - Holodex</title>
7979
</Helmet>
80-
<Tabs defaultValue={tab} onValueChange={setTab}>
81-
<StickyTabsList tab={tab} fourthTab="Oshis" />
80+
<Tabs defaultValue={activeTab} onValueChange={setActiveTab}>
81+
<StickyTabsList activeTab={activeTab} membersTabLabel="Oshis" />
8282
<TabsContent value="live">
8383
<FavoritesLive />
8484
</TabsContent>

packages/react/src/routes/home/home.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function Home() {
3737
const { t } = useTranslation();
3838
const { org } = useParams();
3939
const setMostRecentOrg = useSetAtom(mostRecentOrgAtom);
40-
const [tab, setTab] = useState(searchParams.get("tab") ?? "live");
40+
const [activeTab, setActiveTab] = useState(searchParams.get("tab") ?? "live");
4141

4242
if (!org) {
4343
// it's weird ther's no org.
@@ -51,10 +51,10 @@ export function Home() {
5151
}, [org]);
5252

5353
useEffect(() => {
54-
console.log(`tab changed ${tab}`);
55-
searchParams.set("tab", tab);
54+
console.log(`tab changed ${activeTab}`);
55+
searchParams.set("tab", activeTab);
5656
setSearchParams(searchParams, { replace: true });
57-
}, [searchParams, setSearchParams, tab]);
57+
}, [searchParams, setSearchParams, activeTab]);
5858

5959
if (!org) return <Navigate to="/org404" />;
6060

@@ -63,8 +63,8 @@ export function Home() {
6363
<Helmet>
6464
<title>{org} - Holodex</title>
6565
</Helmet>
66-
<Tabs defaultValue={tab} onValueChange={setTab}>
67-
<StickyTabsList tab={tab} fourthTab="Members" />
66+
<Tabs defaultValue={activeTab} onValueChange={setActiveTab}>
67+
<StickyTabsList activeTab={activeTab} membersTabLabel="Members" />
6868
<TabsContent value="live">
6969
<LiveTab />
7070
</TabsContent>
@@ -83,11 +83,11 @@ export function Home() {
8383
}
8484

8585
function StickyTabsList({
86-
tab,
87-
fourthTab,
86+
activeTab,
87+
membersTabLabel,
8888
}: {
89-
tab: string;
90-
fourthTab: string;
89+
activeTab: string;
90+
membersTabLabel: string;
9191
}) {
9292
const { t } = useTranslation();
9393
// usehooks-ts way:
@@ -126,14 +126,14 @@ function StickyTabsList({
126126
<TabsTrigger value="clips">
127127
{t("views.home.recentVideoToggles.subber")}
128128
</TabsTrigger>
129-
<TabsTrigger value="members">{fourthTab}</TabsTrigger>
129+
<TabsTrigger value="members">{membersTabLabel}</TabsTrigger>
130130
<Separator orientation="vertical" className="relative h-10" />
131131
{/* The h-10 on this separator is actually load bearing - it maintains the height of the whole tab list */}
132132
{/* Optional Control Buttons */}
133-
{tab === "clips" && <ClipLanguageSelector />}
134-
{tab !== "members" && <CardSizeToggle />}
133+
{activeTab === "clips" && <ClipLanguageSelector />}
134+
{activeTab !== "members" && <CardSizeToggle />}
135135
{(user?.role === "admin" || user?.role === "editor") &&
136-
tab != "members" && <EditingStateToggle />}
136+
activeTab != "members" && <EditingStateToggle />}
137137
</TabsList>
138138
);
139139
}

packages/react/src/shadcn/ui/scroll-area.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const ScrollBar = React.forwardRef<
4040
>
4141
<ScrollAreaPrimitive.ScrollAreaThumb
4242
className={cn(
43-
"relative rounded-full bg-border",
43+
"relative rounded-full bg-base-6",
4444
orientation === "vertical" && "flex-1"
4545
)}
4646
/>

0 commit comments

Comments
 (0)