Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

refactor: remove unused imports (#5)

authored by yoginth.com and committed by

GitHub b1ed33d5 9f92dfe6

+102 -107
+1 -1
apps/api/src/routes/og/getPost.ts
··· 14 14 const cacheKey = `og:post:${slug}`; 15 15 16 16 return generateOg({ 17 - buildHtml: (post: PostFragment, _jsonLd) => { 17 + buildHtml: (post: PostFragment) => { 18 18 const { author, metadata } = post; 19 19 const { usernameWithPrefix } = getAccount(author); 20 20 const filteredContent = getPostData(metadata)?.content || "";
+101 -106
apps/web/src/components/Shared/UI/Select.tsx
··· 7 7 } from "@headlessui/react"; 8 8 import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; 9 9 import { CheckCircleIcon, ChevronDownIcon } from "@heroicons/react/24/solid"; 10 - import { Fragment, forwardRef, memo, type ReactNode, useState } from "react"; 10 + import { Fragment, memo, type ReactNode, useState } from "react"; 11 11 import { Input } from "@/components/Shared/UI"; 12 12 import cn from "@/helpers/cn"; 13 13 ··· 28 28 showSearch?: boolean; 29 29 } 30 30 31 - const Select = forwardRef<HTMLSelectElement, SelectProps>( 32 - ( 33 - { 34 - className, 35 - defaultValue, 36 - iconClassName, 37 - onChange, 38 - options, 39 - showSearch = false 40 - }, 41 - _ref 42 - ) => { 43 - const [searchValue, setSearchValue] = useState(""); 44 - const selected = options?.find((option) => option.selected) || options?.[0]; 31 + const Select = ({ 32 + className, 33 + defaultValue, 34 + iconClassName, 35 + onChange, 36 + options, 37 + showSearch = false 38 + }: SelectProps) => { 39 + const [searchValue, setSearchValue] = useState(""); 40 + const selected = options?.find((option) => option.selected) || options?.[0]; 45 41 46 - return ( 47 - <Listbox onChange={onChange} value={defaultValue || selected?.value}> 48 - <div className="relative"> 49 - <ListboxButton 50 - className={cn( 51 - "flex w-full items-center justify-between space-x-3 rounded-xl border border-gray-300 bg-white px-3 py-2 text-left outline-hidden focus:border-gray-500 focus:ring-gray-400 dark:border-gray-700 dark:bg-gray-800", 52 - className 42 + return ( 43 + <Listbox onChange={onChange} value={defaultValue || selected?.value}> 44 + <div className="relative"> 45 + <ListboxButton 46 + className={cn( 47 + "flex w-full items-center justify-between space-x-3 rounded-xl border border-gray-300 bg-white px-3 py-2 text-left outline-hidden focus:border-gray-500 focus:ring-gray-400 dark:border-gray-700 dark:bg-gray-800", 48 + className 49 + )} 50 + > 51 + <span className="flex items-center space-x-2"> 52 + {selected?.icon && ( 53 + <img 54 + alt={selected?.label} 55 + className={iconClassName} 56 + src={selected?.icon} 57 + /> 53 58 )} 54 - > 55 - <span className="flex items-center space-x-2"> 56 - {selected?.icon && ( 57 - <img 58 - alt={selected?.label} 59 - className={iconClassName} 60 - src={selected?.icon} 59 + <span>{selected?.htmlLabel || selected?.label}</span> 60 + </span> 61 + <ChevronDownIcon className="mr-1 size-5 text-gray-400" /> 62 + </ListboxButton> 63 + <Transition 64 + as={Fragment} 65 + enter="transition ease-out duration-100" 66 + enterFrom="transform opacity-0 scale-95" 67 + enterTo="transform opacity-100 scale-100" 68 + leave="transition ease-in duration-75" 69 + leaveFrom="transform opacity-100 scale-100" 70 + leaveTo="transform opacity-0 scale-95" 71 + > 72 + <ListboxOptions className="no-scrollbar absolute z-[5] mt-2 max-h-60 w-full overflow-auto rounded-xl border border-gray-200 bg-white shadow-xs focus:outline-hidden dark:border-gray-700 dark:bg-gray-900"> 73 + {showSearch ? ( 74 + <div className="mx-4 mt-4"> 75 + <Input 76 + className="w-full" 77 + iconLeft={<MagnifyingGlassIcon />} 78 + onChange={(event) => { 79 + setSearchValue(event.target.value); 80 + }} 81 + placeholder="Search" 82 + type="text" 83 + value={searchValue} 61 84 /> 62 - )} 63 - <span>{selected?.htmlLabel || selected?.label}</span> 64 - </span> 65 - <ChevronDownIcon className="mr-1 size-5 text-gray-400" /> 66 - </ListboxButton> 67 - <Transition 68 - as={Fragment} 69 - enter="transition ease-out duration-100" 70 - enterFrom="transform opacity-0 scale-95" 71 - enterTo="transform opacity-100 scale-100" 72 - leave="transition ease-in duration-75" 73 - leaveFrom="transform opacity-100 scale-100" 74 - leaveTo="transform opacity-0 scale-95" 75 - > 76 - <ListboxOptions className="no-scrollbar absolute z-[5] mt-2 max-h-60 w-full overflow-auto rounded-xl border border-gray-200 bg-white shadow-xs focus:outline-hidden dark:border-gray-700 dark:bg-gray-900"> 77 - {showSearch ? ( 78 - <div className="mx-4 mt-4"> 79 - <Input 80 - className="w-full" 81 - iconLeft={<MagnifyingGlassIcon />} 82 - onChange={(event) => { 83 - setSearchValue(event.target.value); 84 - }} 85 - placeholder="Search" 86 - type="text" 87 - value={searchValue} 88 - /> 89 - </div> 90 - ) : null} 91 - {options 92 - ?.filter((option) => 93 - option.label.toLowerCase().includes(searchValue.toLowerCase()) 94 - ) 95 - .map((option, id) => ( 96 - <ListboxOption 97 - className={({ focus }: { focus: boolean }) => 98 - cn( 99 - { "dropdown-active": focus }, 100 - "m-2 cursor-pointer rounded-lg" 101 - ) 102 - } 103 - disabled={option.disabled} 104 - key={id} 105 - value={option.value} 106 - > 107 - {({ selected }) => ( 108 - <div className="mx-2 flex flex-col space-y-0 py-1.5"> 109 - <span className="flex w-full items-center justify-between space-x-3 text-gray-700 dark:text-gray-200"> 110 - <span className="flex items-center space-x-2"> 111 - {option.icon && ( 112 - <img 113 - alt={option.label} 114 - className={iconClassName} 115 - src={option.icon} 116 - /> 117 - )} 118 - <span className="block truncate"> 119 - {option.htmlLabel || option.label} 120 - </span> 85 + </div> 86 + ) : null} 87 + {options 88 + ?.filter((option) => 89 + option.label.toLowerCase().includes(searchValue.toLowerCase()) 90 + ) 91 + .map((option, id) => ( 92 + <ListboxOption 93 + className={({ focus }: { focus: boolean }) => 94 + cn( 95 + { "dropdown-active": focus }, 96 + "m-2 cursor-pointer rounded-lg" 97 + ) 98 + } 99 + disabled={option.disabled} 100 + key={id} 101 + value={option.value} 102 + > 103 + {({ selected }) => ( 104 + <div className="mx-2 flex flex-col space-y-0 py-1.5"> 105 + <span className="flex w-full items-center justify-between space-x-3 text-gray-700 dark:text-gray-200"> 106 + <span className="flex items-center space-x-2"> 107 + {option.icon && ( 108 + <img 109 + alt={option.label} 110 + className={iconClassName} 111 + src={option.icon} 112 + /> 113 + )} 114 + <span className="block truncate"> 115 + {option.htmlLabel || option.label} 121 116 </span> 122 - {selected ? ( 123 - <CheckCircleIcon className="size-5" /> 124 - ) : null} 125 117 </span> 126 - {option.helper ? ( 127 - <span className="text-gray-500 text-xs dark:text-gray-200"> 128 - {option.helper} 129 - </span> 118 + {selected ? ( 119 + <CheckCircleIcon className="size-5" /> 130 120 ) : null} 131 - </div> 132 - )} 133 - </ListboxOption> 134 - ))} 135 - </ListboxOptions> 136 - </Transition> 137 - </div> 138 - </Listbox> 139 - ); 140 - } 141 - ); 121 + </span> 122 + {option.helper ? ( 123 + <span className="text-gray-500 text-xs dark:text-gray-200"> 124 + {option.helper} 125 + </span> 126 + ) : null} 127 + </div> 128 + )} 129 + </ListboxOption> 130 + ))} 131 + </ListboxOptions> 132 + </Transition> 133 + </div> 134 + </Listbox> 135 + ); 136 + }; 142 137 143 138 export default memo(Select);