tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
Show artist genre tags on profile
tsiry-sandratraina.com
1 month ago
7e09045d
91f712d5
+27
-1
1 changed file
expand all
collapse all
unified
split
apps
web
src
pages
profile
Profile.tsx
+27
-1
apps/web/src/pages/profile/Profile.tsx
···
7
7
import dayjs from "dayjs";
8
8
import { useAtom, useSetAtom } from "jotai";
9
9
import _ from "lodash";
10
10
-
import { useEffect, useState } from "react";
10
10
+
import { useEffect, useMemo, useState } from "react";
11
11
import { profilesAtom } from "../../atoms/profiles";
12
12
import { userAtom } from "../../atoms/user";
13
13
import Shout from "../../components/Shout/Shout";
···
31
31
import { activeTabAtom } from "../../atoms/tab";
32
32
import Circles from "./circles";
33
33
import TopTrack from "./toptrack";
34
34
+
import { useArtistsQuery } from "../../hooks/useLibrary";
35
35
+
import { getLastDays } from "../../lib/date";
34
36
35
37
const Group = styled.div`
36
38
display: flex;
···
59
61
const profile = useProfileByDidQuery(did!);
60
62
const setUser = useSetAtom(userAtom);
61
63
const { tab } = useSearch({ strict: false });
64
64
+
const { data: artists } = useArtistsQuery(did!, 0, 100, ...getLastDays(7));
62
65
const { mutate: followAccount } = useFollowAccountMutation();
63
66
const { mutate: unfollowAccount } = useUnfollowAccountMutation();
64
67
const currentDid = localStorage.getItem("did");
···
67
70
1,
68
71
currentDid ? [currentDid] : undefined,
69
72
);
73
73
+
const tags = useMemo(() => {
74
74
+
if (!artists) {
75
75
+
return [];
76
76
+
}
77
77
+
return artists
78
78
+
.filter((x) => x.tags)
79
79
+
.map((x) => x.tags)
80
80
+
.flat()
81
81
+
.slice(0, 20);
82
82
+
}, [artists]);
70
83
71
84
const onFollow = () => {
72
85
if (!localStorage.getItem("token")) {
···
281
294
</>
282
295
)}
283
296
</Group>
297
297
+
{tags.length > 0 && (
298
298
+
<div className="mt-[30px] flex flex-wrap">
299
299
+
{tags.map((genre) => (
300
300
+
<span
301
301
+
className="mr-[15px] mb-[5px] text-[var(--color-genre)] text-[13px] whitespace-nowrap"
302
302
+
style={{ fontFamily: "RockfordSansRegular" }}
303
303
+
>
304
304
+
# {genre}
305
305
+
</span>
306
306
+
))}
307
307
+
</div>
308
308
+
)}
309
309
+
284
310
<div className="mt-[20px] flex justify-end">
285
311
<TopTrack />
286
312
</div>