Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import { MetadataLicenseType } from "@hey/indexer";
2import { Link } from "react-router";
3import { Select, Tooltip } from "@/components/Shared/UI";
4import getAssetLicense from "@/helpers/getAssetLicense";
5import { usePostLicenseStore } from "@/store/non-persisted/post/usePostLicenseStore";
6
7const LicensePicker = () => {
8 const { license, setLicense } = usePostLicenseStore();
9
10 const otherOptions: {
11 label: string;
12 selected: boolean;
13 value: MetadataLicenseType;
14 }[] = Object.values(MetadataLicenseType)
15 .filter((type) => getAssetLicense(type))
16 .map((type) => ({
17 label: getAssetLicense(type)?.label ?? "",
18 selected: license === type,
19 value: type
20 }));
21
22 const options: {
23 label: string;
24 selected: boolean;
25 value: MetadataLicenseType | null;
26 }[] = [
27 {
28 label: "All rights reserved",
29 selected: license === null,
30 value: null
31 },
32 ...otherOptions
33 ];
34
35 return (
36 <div className="my-5">
37 {/* <div className="divider mb-3" /> */}
38 <div className="mb-2 flex items-center justify-between">
39 <b>License</b>
40 <Tooltip
41 content={
42 <div className="max-w-xs py-2 leading-5">
43 Creator licenses dictate the use, sharing, and distribution of
44 music, art and other intellectual property - ranging from
45 restrictive to permissive. Once given, you can't change the
46 license.
47 </div>
48 }
49 placement="top"
50 >
51 <div className="text-gray-500 text-sm dark:text-gray-200">
52 What's this?
53 </div>
54 </Tooltip>
55 </div>
56 <Select
57 onChange={(value) => setLicense(value as MetadataLicenseType)}
58 options={options as any}
59 />
60 <div className="linkify mt-2 text-gray-500 text-sm dark:text-gray-200">
61 {getAssetLicense(license)?.helper ||
62 "You are not granting a license to the collector and retain all rights."}
63 <Link
64 className="ml-1.5"
65 target="_blank"
66 to="https://yoginth.notion.site/60f9d82c5a274a88b8444611c7a8a94a"
67 >
68 Learn more.
69 </Link>
70 </div>
71 </div>
72 );
73};
74
75export default LicensePicker;